id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
10,958
struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size, DisplayState *ds, const char *revision) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } s->env = cpu_init(); cpu_arm_set_model(s->env, revision ?: "pxa270"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); /* SDRAM & Internal Memory Storage */ cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; /* 416.0 MHz */ s->clkcfg = 0x00000009; /* Turbo mode active */ iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; /* Two PC Card sockets */ iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa27x_ssp[i].io_base; ssp[i].irq = s->pic[pxa27x_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); /* GPIO1 resets the processor */ /* The handler can be overriden by board-specific code */ pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
true
qemu
187337f8b0ec0813dd3876d1efe37d415fb81c2e
struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size, DisplayState *ds, const char *revision) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } s->env = cpu_init(); cpu_arm_set_model(s->env, revision ?: "pxa270"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa27x_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0], s->pic[PXA27X_PIC_OST_4_11]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 121); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa270_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa270_serial[i].io_base, 2, s->pic[pxa270_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa27x_ssp[i].io_base; ssp[i].irq = s->pic[pxa27x_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0xff); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
{ "code": [ " cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->pm_base, 0xff, iomemtype);", " cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->pm_base, 0xff, iomemtype);", " cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype);", " cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype);" ], "line_no": [ 105, 127, 139, 169, 199, 105, 127, 139, 169, 199 ] }
struct pxa2xx_state_s *FUNC_0(unsigned int VAR_0, DisplayState *VAR_1, const char *VAR_2) { struct pxa2xx_state_s *VAR_3; struct pxa2xx_ssp_s *VAR_4; int VAR_5, VAR_6; VAR_3 = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); if (VAR_2 && strncmp(VAR_2, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } VAR_3->env = cpu_init(); cpu_arm_set_model(VAR_3->env, VAR_2 ?: "pxa270"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, VAR_3->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, VAR_0, qemu_ram_alloc(VAR_0) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, 0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM); VAR_3->pic = pxa2xx_pic_init(0x40d00000, VAR_3->env); VAR_3->dma = pxa27x_dma_init(0x40000000, VAR_3->pic[PXA2XX_PIC_DMA]); pxa27x_timer_init(0x40a00000, &VAR_3->pic[PXA2XX_PIC_OST_0], VAR_3->pic[PXA27X_PIC_OST_4_11]); VAR_3->gpio = pxa2xx_gpio_init(0x40e00000, VAR_3->env, VAR_3->pic, 121); VAR_3->mmc = pxa2xx_mmci_init(0x41100000, VAR_3->pic[PXA2XX_PIC_MMC], VAR_3->dma); for (VAR_6 = 0; pxa270_serial[VAR_6].io_base; VAR_6 ++) if (serial_hds[VAR_6]) serial_mm_init(pxa270_serial[VAR_6].io_base, 2, VAR_3->pic[pxa270_serial[VAR_6].irqn], serial_hds[VAR_6], 1); else break; if (serial_hds[VAR_6]) VAR_3->fir = pxa2xx_fir_init(0x40800000, VAR_3->pic[PXA2XX_PIC_ICP], VAR_3->dma, serial_hds[VAR_6]); if (VAR_1) VAR_3->lcd = pxa2xx_lcdc_init(0x44000000, VAR_3->pic[PXA2XX_PIC_LCD], VAR_1); VAR_3->cm_base = 0x41300000; VAR_3->cm_regs[CCCR >> 4] = 0x02000210; VAR_3->clkcfg = 0x00000009; VAR_5 = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, VAR_3); cpu_register_physical_memory(VAR_3->cm_base, 0xfff, VAR_5); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, VAR_3); cpu_arm_set_cp_io(VAR_3->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, VAR_3); VAR_3->mm_base = 0x48000000; VAR_3->mm_regs[MDMRS >> 2] = 0x00020002; VAR_3->mm_regs[MDREFR >> 2] = 0x03ca4000; VAR_3->mm_regs[MECR >> 2] = 0x00000001; VAR_5 = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, VAR_3); cpu_register_physical_memory(VAR_3->mm_base, 0xfff, VAR_5); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, VAR_3); VAR_3->pm_base = 0x40f00000; VAR_5 = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, VAR_3); cpu_register_physical_memory(VAR_3->pm_base, 0xff, VAR_5); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, VAR_3); for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++); VAR_3->VAR_4 = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * VAR_6); VAR_4 = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * VAR_6); for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++) { VAR_3->VAR_4[VAR_6] = &VAR_4[VAR_6]; VAR_4[VAR_6].base = pxa27x_ssp[VAR_6].io_base; VAR_4[VAR_6].irq = VAR_3->pic[pxa27x_ssp[VAR_6].irqn]; VAR_5 = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &VAR_4[VAR_6]); cpu_register_physical_memory(VAR_4[VAR_6].base, 0xfff, VAR_5); register_savevm("pxa2xx_ssp", VAR_6, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, VAR_3); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, VAR_3->pic[PXA2XX_PIC_USBH1]); } VAR_3->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); VAR_3->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); VAR_3->rtc_base = 0x40900000; VAR_5 = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, VAR_3); cpu_register_physical_memory(VAR_3->rtc_base, 0xfff, VAR_5); pxa2xx_rtc_init(VAR_3); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, VAR_3); VAR_3->i2c[0] = pxa2xx_i2c_init(0x40301600, VAR_3->pic[PXA2XX_PIC_I2C], 0xffff); VAR_3->i2c[1] = pxa2xx_i2c_init(0x40f00100, VAR_3->pic[PXA2XX_PIC_PWRI2C], 0xff); VAR_3->i2s = pxa2xx_i2s_init(0x40400000, VAR_3->pic[PXA2XX_PIC_I2S], VAR_3->dma); pxa2xx_gpio_handler_set(VAR_3->gpio, 1, pxa2xx_reset, VAR_3); return VAR_3; }
[ "struct pxa2xx_state_s *FUNC_0(unsigned int VAR_0,\nDisplayState *VAR_1, const char *VAR_2)\n{", "struct pxa2xx_state_s *VAR_3;", "struct pxa2xx_ssp_s *VAR_4;", "int VAR_5, VAR_6;", "VAR_3 = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s));", "if (VAR_2 && strncmp(VAR_2, \"pxa27\", 5)) {", "fprintf(stderr, \"Machine requires a PXA27x processor.\\n\");", "exit(1);", "}", "VAR_3->env = cpu_init();", "cpu_arm_set_model(VAR_3->env, VAR_2 ?: \"pxa270\");", "register_savevm(\"cpu\", 0, 0, cpu_save, cpu_load, VAR_3->env);", "cpu_register_physical_memory(PXA2XX_SDRAM_BASE,\nVAR_0, qemu_ram_alloc(VAR_0) | IO_MEM_RAM);", "cpu_register_physical_memory(PXA2XX_INTERNAL_BASE,\n0x40000, qemu_ram_alloc(0x40000) | IO_MEM_RAM);", "VAR_3->pic = pxa2xx_pic_init(0x40d00000, VAR_3->env);", "VAR_3->dma = pxa27x_dma_init(0x40000000, VAR_3->pic[PXA2XX_PIC_DMA]);", "pxa27x_timer_init(0x40a00000, &VAR_3->pic[PXA2XX_PIC_OST_0],\nVAR_3->pic[PXA27X_PIC_OST_4_11]);", "VAR_3->gpio = pxa2xx_gpio_init(0x40e00000, VAR_3->env, VAR_3->pic, 121);", "VAR_3->mmc = pxa2xx_mmci_init(0x41100000, VAR_3->pic[PXA2XX_PIC_MMC], VAR_3->dma);", "for (VAR_6 = 0; pxa270_serial[VAR_6].io_base; VAR_6 ++)", "if (serial_hds[VAR_6])\nserial_mm_init(pxa270_serial[VAR_6].io_base, 2,\nVAR_3->pic[pxa270_serial[VAR_6].irqn], serial_hds[VAR_6], 1);", "else\nbreak;", "if (serial_hds[VAR_6])\nVAR_3->fir = pxa2xx_fir_init(0x40800000, VAR_3->pic[PXA2XX_PIC_ICP],\nVAR_3->dma, serial_hds[VAR_6]);", "if (VAR_1)\nVAR_3->lcd = pxa2xx_lcdc_init(0x44000000, VAR_3->pic[PXA2XX_PIC_LCD], VAR_1);", "VAR_3->cm_base = 0x41300000;", "VAR_3->cm_regs[CCCR >> 4] = 0x02000210;", "VAR_3->clkcfg = 0x00000009;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_cm_readfn,\npxa2xx_cm_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->cm_base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_cm\", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, VAR_3);", "cpu_arm_set_cp_io(VAR_3->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, VAR_3);", "VAR_3->mm_base = 0x48000000;", "VAR_3->mm_regs[MDMRS >> 2] = 0x00020002;", "VAR_3->mm_regs[MDREFR >> 2] = 0x03ca4000;", "VAR_3->mm_regs[MECR >> 2] = 0x00000001;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_mm_readfn,\npxa2xx_mm_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->mm_base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_mm\", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, VAR_3);", "VAR_3->pm_base = 0x40f00000;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_pm_readfn,\npxa2xx_pm_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->pm_base, 0xff, VAR_5);", "register_savevm(\"pxa2xx_pm\", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, VAR_3);", "for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++);", "VAR_3->VAR_4 = (struct pxa2xx_ssp_s **)\nqemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * VAR_6);", "VAR_4 = (struct pxa2xx_ssp_s *)\nqemu_mallocz(sizeof(struct pxa2xx_ssp_s) * VAR_6);", "for (VAR_6 = 0; pxa27x_ssp[VAR_6].io_base; VAR_6 ++) {", "VAR_3->VAR_4[VAR_6] = &VAR_4[VAR_6];", "VAR_4[VAR_6].base = pxa27x_ssp[VAR_6].io_base;", "VAR_4[VAR_6].irq = VAR_3->pic[pxa27x_ssp[VAR_6].irqn];", "VAR_5 = cpu_register_io_memory(0, pxa2xx_ssp_readfn,\npxa2xx_ssp_writefn, &VAR_4[VAR_6]);", "cpu_register_physical_memory(VAR_4[VAR_6].base, 0xfff, VAR_5);", "register_savevm(\"pxa2xx_ssp\", VAR_6, 0,\npxa2xx_ssp_save, pxa2xx_ssp_load, VAR_3);", "}", "if (usb_enabled) {", "usb_ohci_init_pxa(0x4c000000, 3, -1, VAR_3->pic[PXA2XX_PIC_USBH1]);", "}", "VAR_3->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);", "VAR_3->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);", "VAR_3->rtc_base = 0x40900000;", "VAR_5 = cpu_register_io_memory(0, pxa2xx_rtc_readfn,\npxa2xx_rtc_writefn, VAR_3);", "cpu_register_physical_memory(VAR_3->rtc_base, 0xfff, VAR_5);", "pxa2xx_rtc_init(VAR_3);", "register_savevm(\"pxa2xx_rtc\", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, VAR_3);", "VAR_3->i2c[0] = pxa2xx_i2c_init(0x40301600, VAR_3->pic[PXA2XX_PIC_I2C], 0xffff);", "VAR_3->i2c[1] = pxa2xx_i2c_init(0x40f00100, VAR_3->pic[PXA2XX_PIC_PWRI2C], 0xff);", "VAR_3->i2s = pxa2xx_i2s_init(0x40400000, VAR_3->pic[PXA2XX_PIC_I2S], VAR_3->dma);", "pxa2xx_gpio_handler_set(VAR_3->gpio, 1, pxa2xx_reset, VAR_3);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 37, 39 ], [ 41, 43 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 61 ], [ 65 ], [ 69 ], [ 71, 73, 75 ], [ 77, 79 ], [ 81, 83, 85 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 213 ], [ 221 ], [ 223 ], [ 225 ] ]
10,959
static void apc_init(target_phys_addr_t power_base, qemu_irq cpu_halt) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "apc"); qdev_init(dev); s = sysbus_from_qdev(dev); /* Power management (APC) XXX: not a Slavio device */ sysbus_mmio_map(s, 0, power_base); sysbus_connect_irq(s, 0, cpu_halt); }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
static void apc_init(target_phys_addr_t power_base, qemu_irq cpu_halt) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "apc"); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, power_base); sysbus_connect_irq(s, 0, cpu_halt); }
{ "code": [ " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);" ], "line_no": [ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 ] }
static void FUNC_0(target_phys_addr_t VAR_0, qemu_irq VAR_1) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "apc"); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, VAR_0); sysbus_connect_irq(s, 0, VAR_1); }
[ "static void FUNC_0(target_phys_addr_t VAR_0, qemu_irq VAR_1)\n{", "DeviceState *dev;", "SysBusDevice *s;", "dev = qdev_create(NULL, \"apc\");", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_mmio_map(s, 0, VAR_0);", "sysbus_connect_irq(s, 0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
10,961
static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; ByteIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; int ret = 0; int current_palette = 0; char *buffer; int i; /* default context members */ wc3->width = WC3_DEFAULT_WIDTH; wc3->height = WC3_DEFAULT_HEIGHT; wc3->palettes = NULL; wc3->palette_count = 0; wc3->pts = 0; wc3->video_stream_index = wc3->audio_stream_index = 0; /* skip the first 3 32-bit numbers */ url_fseek(pb, 12, SEEK_CUR); /* traverse through the chunks and load the header information before * the first BRCH tag */ fourcc_tag = get_le32(pb); size = (get_be32(pb) + 1) & (~1); do { switch (fourcc_tag) { case SOND_TAG: case INDX_TAG: /* SOND unknown, INDX unnecessary; ignore both */ url_fseek(pb, size, SEEK_CUR); break; case PC__TAG: /* need the number of palettes */ url_fseek(pb, 8, SEEK_CUR); wc3->palette_count = get_le32(pb); if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){ wc3->palette_count= 0; return -1; } wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE); break; case BNAM_TAG: /* load up the name */ buffer = av_malloc(size+1); if (!buffer) return AVERROR(ENOMEM); if ((ret = get_buffer(pb, buffer, size)) != size) return AVERROR(EIO); buffer[size] = 0; av_metadata_set2(&s->metadata, "title", buffer, AV_METADATA_DONT_STRDUP_VAL); break; case SIZE_TAG: /* video resolution override */ wc3->width = get_le32(pb); wc3->height = get_le32(pb); break; case PALT_TAG: /* one of several palettes */ if ((unsigned)current_palette >= wc3->palette_count) return AVERROR_INVALIDDATA; if ((ret = get_buffer(pb, &wc3->palettes[current_palette * PALETTE_SIZE], PALETTE_SIZE)) != PALETTE_SIZE) return AVERROR(EIO); /* transform the current palette in place */ for (i = current_palette * PALETTE_SIZE; i < (current_palette + 1) * PALETTE_SIZE; i++) { wc3->palettes[i] = wc3_pal_lookup[wc3->palettes[i]]; } current_palette++; break; default: av_log(s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24), (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24)); return AVERROR_INVALIDDATA; break; } fourcc_tag = get_le32(pb); /* chunk sizes are 16-bit aligned */ size = (get_be32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); } while (fourcc_tag != BRCH_TAG); /* initialize the decoder streams */ st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_XAN_WC3; st->codec->codec_tag = 0; /* no fourcc */ st->codec->width = wc3->width; st->codec->height = wc3->height; /* palette considerations */ st->codec->palctrl = &wc3->palette_control; st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->audio_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_PCM_S16LE; st->codec->codec_tag = 1; st->codec->channels = WC3_AUDIO_CHANNELS; st->codec->bits_per_coded_sample = WC3_AUDIO_BITS; st->codec->sample_rate = WC3_SAMPLE_RATE; st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample; st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; return 0; }
true
FFmpeg
24ae353dfbe61019a86093a9c5cd15476aabef49
static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; ByteIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; int ret = 0; int current_palette = 0; char *buffer; int i; wc3->width = WC3_DEFAULT_WIDTH; wc3->height = WC3_DEFAULT_HEIGHT; wc3->palettes = NULL; wc3->palette_count = 0; wc3->pts = 0; wc3->video_stream_index = wc3->audio_stream_index = 0; url_fseek(pb, 12, SEEK_CUR); fourcc_tag = get_le32(pb); size = (get_be32(pb) + 1) & (~1); do { switch (fourcc_tag) { case SOND_TAG: case INDX_TAG: url_fseek(pb, size, SEEK_CUR); break; case PC__TAG: url_fseek(pb, 8, SEEK_CUR); wc3->palette_count = get_le32(pb); if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){ wc3->palette_count= 0; return -1; } wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE); break; case BNAM_TAG: buffer = av_malloc(size+1); if (!buffer) return AVERROR(ENOMEM); if ((ret = get_buffer(pb, buffer, size)) != size) return AVERROR(EIO); buffer[size] = 0; av_metadata_set2(&s->metadata, "title", buffer, AV_METADATA_DONT_STRDUP_VAL); break; case SIZE_TAG: wc3->width = get_le32(pb); wc3->height = get_le32(pb); break; case PALT_TAG: if ((unsigned)current_palette >= wc3->palette_count) return AVERROR_INVALIDDATA; if ((ret = get_buffer(pb, &wc3->palettes[current_palette * PALETTE_SIZE], PALETTE_SIZE)) != PALETTE_SIZE) return AVERROR(EIO); for (i = current_palette * PALETTE_SIZE; i < (current_palette + 1) * PALETTE_SIZE; i++) { wc3->palettes[i] = wc3_pal_lookup[wc3->palettes[i]]; } current_palette++; break; default: av_log(s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24), (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24)); return AVERROR_INVALIDDATA; break; } fourcc_tag = get_le32(pb); size = (get_be32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); } while (fourcc_tag != BRCH_TAG); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_XAN_WC3; st->codec->codec_tag = 0; st->codec->width = wc3->width; st->codec->height = wc3->height; st->codec->palctrl = &wc3->palette_control; st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->audio_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_PCM_S16LE; st->codec->codec_tag = 1; st->codec->channels = WC3_AUDIO_CHANNELS; st->codec->bits_per_coded_sample = WC3_AUDIO_BITS; st->codec->sample_rate = WC3_SAMPLE_RATE; st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample; st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; return 0; }
{ "code": [ " int current_palette = 0;", " int i;", " wc3->palettes = NULL;", " wc3->palette_count = 0;", " url_fseek(pb, 8, SEEK_CUR);", " wc3->palette_count = get_le32(pb);", " if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){", " wc3->palette_count= 0;", " return -1;", " wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);", " if ((unsigned)current_palette >= wc3->palette_count)", " return AVERROR_INVALIDDATA;", " if ((ret = get_buffer(pb,", " &wc3->palettes[current_palette * PALETTE_SIZE],", " PALETTE_SIZE)) != PALETTE_SIZE)", " return AVERROR(EIO);", " for (i = current_palette * PALETTE_SIZE;", " i < (current_palette + 1) * PALETTE_SIZE; i++) {", " wc3->palettes[i] = wc3_pal_lookup[wc3->palettes[i]];", " current_palette++;", " st->codec->palctrl = &wc3->palette_control;", " int i;", " return AVERROR_INVALIDDATA;" ], "line_no": [ 19, 23, 33, 35, 81, 83, 85, 87, 89, 93, 139, 141, 143, 145, 147, 111, 155, 157, 159, 163, 227, 23, 141 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { Wc3DemuxContext *wc3 = VAR_0->priv_data; ByteIOContext *pb = VAR_0->pb; unsigned int VAR_2; unsigned int VAR_3; AVStream *st; int VAR_4 = 0; int VAR_5 = 0; char *VAR_6; int VAR_7; wc3->width = WC3_DEFAULT_WIDTH; wc3->height = WC3_DEFAULT_HEIGHT; wc3->palettes = NULL; wc3->palette_count = 0; wc3->pts = 0; wc3->video_stream_index = wc3->audio_stream_index = 0; url_fseek(pb, 12, SEEK_CUR); VAR_2 = get_le32(pb); VAR_3 = (get_be32(pb) + 1) & (~1); do { switch (VAR_2) { case SOND_TAG: case INDX_TAG: url_fseek(pb, VAR_3, SEEK_CUR); break; case PC__TAG: url_fseek(pb, 8, SEEK_CUR); wc3->palette_count = get_le32(pb); if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){ wc3->palette_count= 0; return -1; } wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE); break; case BNAM_TAG: VAR_6 = av_malloc(VAR_3+1); if (!VAR_6) return AVERROR(ENOMEM); if ((VAR_4 = get_buffer(pb, VAR_6, VAR_3)) != VAR_3) return AVERROR(EIO); VAR_6[VAR_3] = 0; av_metadata_set2(&VAR_0->metadata, "title", VAR_6, AV_METADATA_DONT_STRDUP_VAL); break; case SIZE_TAG: wc3->width = get_le32(pb); wc3->height = get_le32(pb); break; case PALT_TAG: if ((unsigned)VAR_5 >= wc3->palette_count) return AVERROR_INVALIDDATA; if ((VAR_4 = get_buffer(pb, &wc3->palettes[VAR_5 * PALETTE_SIZE], PALETTE_SIZE)) != PALETTE_SIZE) return AVERROR(EIO); for (VAR_7 = VAR_5 * PALETTE_SIZE; VAR_7 < (VAR_5 + 1) * PALETTE_SIZE; VAR_7++) { wc3->palettes[VAR_7] = wc3_pal_lookup[wc3->palettes[VAR_7]]; } VAR_5++; break; default: av_log(VAR_0, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", (uint8_t)VAR_2, (uint8_t)(VAR_2 >> 8), (uint8_t)(VAR_2 >> 16), (uint8_t)(VAR_2 >> 24), (uint8_t)VAR_2, (uint8_t)(VAR_2 >> 8), (uint8_t)(VAR_2 >> 16), (uint8_t)(VAR_2 >> 24)); return AVERROR_INVALIDDATA; break; } VAR_2 = get_le32(pb); VAR_3 = (get_be32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); } while (VAR_2 != BRCH_TAG); st = av_new_stream(VAR_0, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_XAN_WC3; st->codec->codec_tag = 0; st->codec->width = wc3->width; st->codec->height = wc3->height; st->codec->palctrl = &wc3->palette_control; st = av_new_stream(VAR_0, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); wc3->audio_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_PCM_S16LE; st->codec->codec_tag = 1; st->codec->channels = WC3_AUDIO_CHANNELS; st->codec->bits_per_coded_sample = WC3_AUDIO_BITS; st->codec->sample_rate = WC3_SAMPLE_RATE; st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample; st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{", "Wc3DemuxContext *wc3 = VAR_0->priv_data;", "ByteIOContext *pb = VAR_0->pb;", "unsigned int VAR_2;", "unsigned int VAR_3;", "AVStream *st;", "int VAR_4 = 0;", "int VAR_5 = 0;", "char *VAR_6;", "int VAR_7;", "wc3->width = WC3_DEFAULT_WIDTH;", "wc3->height = WC3_DEFAULT_HEIGHT;", "wc3->palettes = NULL;", "wc3->palette_count = 0;", "wc3->pts = 0;", "wc3->video_stream_index = wc3->audio_stream_index = 0;", "url_fseek(pb, 12, SEEK_CUR);", "VAR_2 = get_le32(pb);", "VAR_3 = (get_be32(pb) + 1) & (~1);", "do {", "switch (VAR_2) {", "case SOND_TAG:\ncase INDX_TAG:\nurl_fseek(pb, VAR_3, SEEK_CUR);", "break;", "case PC__TAG:\nurl_fseek(pb, 8, SEEK_CUR);", "wc3->palette_count = get_le32(pb);", "if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){", "wc3->palette_count= 0;", "return -1;", "}", "wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);", "break;", "case BNAM_TAG:\nVAR_6 = av_malloc(VAR_3+1);", "if (!VAR_6)\nreturn AVERROR(ENOMEM);", "if ((VAR_4 = get_buffer(pb, VAR_6, VAR_3)) != VAR_3)\nreturn AVERROR(EIO);", "VAR_6[VAR_3] = 0;", "av_metadata_set2(&VAR_0->metadata, \"title\", VAR_6,\nAV_METADATA_DONT_STRDUP_VAL);", "break;", "case SIZE_TAG:\nwc3->width = get_le32(pb);", "wc3->height = get_le32(pb);", "break;", "case PALT_TAG:\nif ((unsigned)VAR_5 >= wc3->palette_count)\nreturn AVERROR_INVALIDDATA;", "if ((VAR_4 = get_buffer(pb,\n&wc3->palettes[VAR_5 * PALETTE_SIZE],\nPALETTE_SIZE)) != PALETTE_SIZE)\nreturn AVERROR(EIO);", "for (VAR_7 = VAR_5 * PALETTE_SIZE;", "VAR_7 < (VAR_5 + 1) * PALETTE_SIZE; VAR_7++) {", "wc3->palettes[VAR_7] = wc3_pal_lookup[wc3->palettes[VAR_7]];", "}", "VAR_5++;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \" unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\\n\",\n(uint8_t)VAR_2, (uint8_t)(VAR_2 >> 8), (uint8_t)(VAR_2 >> 16), (uint8_t)(VAR_2 >> 24),\n(uint8_t)VAR_2, (uint8_t)(VAR_2 >> 8), (uint8_t)(VAR_2 >> 16), (uint8_t)(VAR_2 >> 24));", "return AVERROR_INVALIDDATA;", "break;", "}", "VAR_2 = get_le32(pb);", "VAR_3 = (get_be32(pb) + 1) & (~1);", "if (url_feof(pb))\nreturn AVERROR(EIO);", "} while (VAR_2 != BRCH_TAG);", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR(ENOMEM);", "av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);", "wc3->video_stream_index = st->index;", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = CODEC_ID_XAN_WC3;", "st->codec->codec_tag = 0;", "st->codec->width = wc3->width;", "st->codec->height = wc3->height;", "st->codec->palctrl = &wc3->palette_control;", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR(ENOMEM);", "av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);", "wc3->audio_stream_index = st->index;", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->codec_id = CODEC_ID_PCM_S16LE;", "st->codec->codec_tag = 1;", "st->codec->channels = WC3_AUDIO_CHANNELS;", "st->codec->bits_per_coded_sample = WC3_AUDIO_BITS;", "st->codec->sample_rate = WC3_SAMPLE_RATE;", "st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *\nst->codec->bits_per_coded_sample;", "st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65, 67, 71 ], [ 73 ], [ 77, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 103 ], [ 105, 107 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 123, 127 ], [ 129 ], [ 131 ], [ 135, 139, 141 ], [ 143, 145, 147, 149 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 189 ], [ 191, 193 ], [ 197 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 227 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 261 ], [ 263 ] ]
10,963
struct icp_state *xics_system_init(int nr_irqs) { CPUPPCState *env; CPUState *cpu; int max_server_num; struct icp_state *icp; struct ics_state *ics; max_server_num = -1; for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); if (cpu->cpu_index > max_server_num) { max_server_num = cpu->cpu_index; } } icp = g_malloc0(sizeof(*icp)); icp->nr_servers = max_server_num + 1; icp->ss = g_malloc0(icp->nr_servers*sizeof(struct icp_server_state)); for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); struct icp_server_state *ss = &icp->ss[cpu->cpu_index]; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: ss->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: ss->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: hw_error("XICS interrupt model does not support this CPU bus " "model\n"); exit(1); } } ics = g_malloc0(sizeof(*ics)); ics->nr_irqs = nr_irqs; ics->offset = XICS_IRQ_BASE; ics->irqs = g_malloc0(nr_irqs * sizeof(struct ics_irq_state)); ics->islsi = g_malloc0(nr_irqs * sizeof(bool)); icp->ics = ics; ics->icp = icp; ics->qirqs = qemu_allocate_irqs(ics_set_irq, ics, nr_irqs); spapr_register_hypercall(H_CPPR, h_cppr); spapr_register_hypercall(H_IPI, h_ipi); spapr_register_hypercall(H_XIRR, h_xirr); spapr_register_hypercall(H_EOI, h_eoi); spapr_rtas_register("ibm,set-xive", rtas_set_xive); spapr_rtas_register("ibm,get-xive", rtas_get_xive); spapr_rtas_register("ibm,int-off", rtas_int_off); spapr_rtas_register("ibm,int-on", rtas_int_on); qemu_register_reset(xics_reset, icp); return icp; }
true
qemu
7b5651605836fd29572fd4c8769af5378d351712
struct icp_state *xics_system_init(int nr_irqs) { CPUPPCState *env; CPUState *cpu; int max_server_num; struct icp_state *icp; struct ics_state *ics; max_server_num = -1; for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); if (cpu->cpu_index > max_server_num) { max_server_num = cpu->cpu_index; } } icp = g_malloc0(sizeof(*icp)); icp->nr_servers = max_server_num + 1; icp->ss = g_malloc0(icp->nr_servers*sizeof(struct icp_server_state)); for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); struct icp_server_state *ss = &icp->ss[cpu->cpu_index]; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: ss->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: ss->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: hw_error("XICS interrupt model does not support this CPU bus " "model\n"); exit(1); } } ics = g_malloc0(sizeof(*ics)); ics->nr_irqs = nr_irqs; ics->offset = XICS_IRQ_BASE; ics->irqs = g_malloc0(nr_irqs * sizeof(struct ics_irq_state)); ics->islsi = g_malloc0(nr_irqs * sizeof(bool)); icp->ics = ics; ics->icp = icp; ics->qirqs = qemu_allocate_irqs(ics_set_irq, ics, nr_irqs); spapr_register_hypercall(H_CPPR, h_cppr); spapr_register_hypercall(H_IPI, h_ipi); spapr_register_hypercall(H_XIRR, h_xirr); spapr_register_hypercall(H_EOI, h_eoi); spapr_rtas_register("ibm,set-xive", rtas_set_xive); spapr_rtas_register("ibm,get-xive", rtas_get_xive); spapr_rtas_register("ibm,int-off", rtas_int_off); spapr_rtas_register("ibm,int-on", rtas_int_on); qemu_register_reset(xics_reset, icp); return icp; }
{ "code": [ "struct icp_state *xics_system_init(int nr_irqs)", " CPUPPCState *env;", " CPUState *cpu;", " int max_server_num;", " struct icp_state *icp;", " struct ics_state *ics;", " max_server_num = -1;", " for (env = first_cpu; env != NULL; env = env->next_cpu) {", " cpu = CPU(ppc_env_get_cpu(env));", " if (cpu->cpu_index > max_server_num) {", " max_server_num = cpu->cpu_index;", " icp = g_malloc0(sizeof(*icp));", " icp->nr_servers = max_server_num + 1;", " icp->ss = g_malloc0(icp->nr_servers*sizeof(struct icp_server_state));", " for (env = first_cpu; env != NULL; env = env->next_cpu) {", " cpu = CPU(ppc_env_get_cpu(env));", " struct icp_server_state *ss = &icp->ss[cpu->cpu_index];", " switch (PPC_INPUT(env)) {", " case PPC_FLAGS_INPUT_POWER7:", " ss->output = env->irq_inputs[POWER7_INPUT_INT];", " break;", " case PPC_FLAGS_INPUT_970:", " ss->output = env->irq_inputs[PPC970_INPUT_INT];", " break;", " default:", " hw_error(\"XICS interrupt model does not support this CPU bus \"", " \"model\\n\");", " exit(1);" ], "line_no": [ 1, 5, 7, 9, 11, 13, 17, 19, 21, 23, 25, 33, 35, 37, 19, 21, 45, 49, 51, 53, 55, 59, 61, 55, 67, 69, 71, 73 ] }
struct icp_state *FUNC_0(int VAR_0) { CPUPPCState *env; CPUState *cpu; int VAR_1; struct icp_state *VAR_2; struct ics_state *VAR_3; VAR_1 = -1; for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); if (cpu->cpu_index > VAR_1) { VAR_1 = cpu->cpu_index; } } VAR_2 = g_malloc0(sizeof(*VAR_2)); VAR_2->nr_servers = VAR_1 + 1; VAR_2->ss = g_malloc0(VAR_2->nr_servers*sizeof(struct icp_server_state)); for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); struct icp_server_state *ss = &VAR_2->ss[cpu->cpu_index]; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: ss->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: ss->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: hw_error("XICS interrupt model does not support this CPU bus " "model\n"); exit(1); } } VAR_3 = g_malloc0(sizeof(*VAR_3)); VAR_3->VAR_0 = VAR_0; VAR_3->offset = XICS_IRQ_BASE; VAR_3->irqs = g_malloc0(VAR_0 * sizeof(struct ics_irq_state)); VAR_3->islsi = g_malloc0(VAR_0 * sizeof(bool)); VAR_2->VAR_3 = VAR_3; VAR_3->VAR_2 = VAR_2; VAR_3->qirqs = qemu_allocate_irqs(ics_set_irq, VAR_3, VAR_0); spapr_register_hypercall(H_CPPR, h_cppr); spapr_register_hypercall(H_IPI, h_ipi); spapr_register_hypercall(H_XIRR, h_xirr); spapr_register_hypercall(H_EOI, h_eoi); spapr_rtas_register("ibm,set-xive", rtas_set_xive); spapr_rtas_register("ibm,get-xive", rtas_get_xive); spapr_rtas_register("ibm,int-off", rtas_int_off); spapr_rtas_register("ibm,int-on", rtas_int_on); qemu_register_reset(xics_reset, VAR_2); return VAR_2; }
[ "struct icp_state *FUNC_0(int VAR_0)\n{", "CPUPPCState *env;", "CPUState *cpu;", "int VAR_1;", "struct icp_state *VAR_2;", "struct ics_state *VAR_3;", "VAR_1 = -1;", "for (env = first_cpu; env != NULL; env = env->next_cpu) {", "cpu = CPU(ppc_env_get_cpu(env));", "if (cpu->cpu_index > VAR_1) {", "VAR_1 = cpu->cpu_index;", "}", "}", "VAR_2 = g_malloc0(sizeof(*VAR_2));", "VAR_2->nr_servers = VAR_1 + 1;", "VAR_2->ss = g_malloc0(VAR_2->nr_servers*sizeof(struct icp_server_state));", "for (env = first_cpu; env != NULL; env = env->next_cpu) {", "cpu = CPU(ppc_env_get_cpu(env));", "struct icp_server_state *ss = &VAR_2->ss[cpu->cpu_index];", "switch (PPC_INPUT(env)) {", "case PPC_FLAGS_INPUT_POWER7:\nss->output = env->irq_inputs[POWER7_INPUT_INT];", "break;", "case PPC_FLAGS_INPUT_970:\nss->output = env->irq_inputs[PPC970_INPUT_INT];", "break;", "default:\nhw_error(\"XICS interrupt model does not support this CPU bus \"\n\"model\\n\");", "exit(1);", "}", "}", "VAR_3 = g_malloc0(sizeof(*VAR_3));", "VAR_3->VAR_0 = VAR_0;", "VAR_3->offset = XICS_IRQ_BASE;", "VAR_3->irqs = g_malloc0(VAR_0 * sizeof(struct ics_irq_state));", "VAR_3->islsi = g_malloc0(VAR_0 * sizeof(bool));", "VAR_2->VAR_3 = VAR_3;", "VAR_3->VAR_2 = VAR_2;", "VAR_3->qirqs = qemu_allocate_irqs(ics_set_irq, VAR_3, VAR_0);", "spapr_register_hypercall(H_CPPR, h_cppr);", "spapr_register_hypercall(H_IPI, h_ipi);", "spapr_register_hypercall(H_XIRR, h_xirr);", "spapr_register_hypercall(H_EOI, h_eoi);", "spapr_rtas_register(\"ibm,set-xive\", rtas_set_xive);", "spapr_rtas_register(\"ibm,get-xive\", rtas_get_xive);", "spapr_rtas_register(\"ibm,int-off\", rtas_int_off);", "spapr_rtas_register(\"ibm,int-on\", rtas_int_on);", "qemu_register_reset(xics_reset, VAR_2);", "return VAR_2;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ] ]
10,966
static uint16_t nvme_write_zeros(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req) { NvmeRwCmd *rw = (NvmeRwCmd *)cmd; const uint8_t lba_index = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); const uint8_t data_shift = ns->id_ns.lbaf[lba_index].ds; uint64_t slba = le64_to_cpu(rw->slba); uint32_t nlb = le16_to_cpu(rw->nlb) + 1; uint64_t aio_slba = slba << (data_shift - BDRV_SECTOR_BITS); uint32_t aio_nlb = nlb << (data_shift - BDRV_SECTOR_BITS); if (slba + nlb > ns->id_ns.nsze) { return NVME_LBA_RANGE | NVME_DNR; } req->has_sg = false; block_acct_start(blk_get_stats(n->conf.blk), &req->acct, 0, BLOCK_ACCT_WRITE); req->aiocb = blk_aio_pwrite_zeroes(n->conf.blk, aio_slba, aio_nlb, BDRV_REQ_MAY_UNMAP, nvme_rw_cb, req); return NVME_NO_COMPLETE; }
true
qemu
1ee24514aed34760fb2863d98bea3a1b705d9c9f
static uint16_t nvme_write_zeros(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req) { NvmeRwCmd *rw = (NvmeRwCmd *)cmd; const uint8_t lba_index = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); const uint8_t data_shift = ns->id_ns.lbaf[lba_index].ds; uint64_t slba = le64_to_cpu(rw->slba); uint32_t nlb = le16_to_cpu(rw->nlb) + 1; uint64_t aio_slba = slba << (data_shift - BDRV_SECTOR_BITS); uint32_t aio_nlb = nlb << (data_shift - BDRV_SECTOR_BITS); if (slba + nlb > ns->id_ns.nsze) { return NVME_LBA_RANGE | NVME_DNR; } req->has_sg = false; block_acct_start(blk_get_stats(n->conf.blk), &req->acct, 0, BLOCK_ACCT_WRITE); req->aiocb = blk_aio_pwrite_zeroes(n->conf.blk, aio_slba, aio_nlb, BDRV_REQ_MAY_UNMAP, nvme_rw_cb, req); return NVME_NO_COMPLETE; }
{ "code": [ " if (slba + nlb > ns->id_ns.nsze) {" ], "line_no": [ 23 ] }
static uint16_t FUNC_0(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req) { NvmeRwCmd *rw = (NvmeRwCmd *)cmd; const uint8_t VAR_0 = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); const uint8_t VAR_1 = ns->id_ns.lbaf[VAR_0].ds; uint64_t slba = le64_to_cpu(rw->slba); uint32_t nlb = le16_to_cpu(rw->nlb) + 1; uint64_t aio_slba = slba << (VAR_1 - BDRV_SECTOR_BITS); uint32_t aio_nlb = nlb << (VAR_1 - BDRV_SECTOR_BITS); if (slba + nlb > ns->id_ns.nsze) { return NVME_LBA_RANGE | NVME_DNR; } req->has_sg = false; block_acct_start(blk_get_stats(n->conf.blk), &req->acct, 0, BLOCK_ACCT_WRITE); req->aiocb = blk_aio_pwrite_zeroes(n->conf.blk, aio_slba, aio_nlb, BDRV_REQ_MAY_UNMAP, nvme_rw_cb, req); return NVME_NO_COMPLETE; }
[ "static uint16_t FUNC_0(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd,\nNvmeRequest *req)\n{", "NvmeRwCmd *rw = (NvmeRwCmd *)cmd;", "const uint8_t VAR_0 = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas);", "const uint8_t VAR_1 = ns->id_ns.lbaf[VAR_0].ds;", "uint64_t slba = le64_to_cpu(rw->slba);", "uint32_t nlb = le16_to_cpu(rw->nlb) + 1;", "uint64_t aio_slba = slba << (VAR_1 - BDRV_SECTOR_BITS);", "uint32_t aio_nlb = nlb << (VAR_1 - BDRV_SECTOR_BITS);", "if (slba + nlb > ns->id_ns.nsze) {", "return NVME_LBA_RANGE | NVME_DNR;", "}", "req->has_sg = false;", "block_acct_start(blk_get_stats(n->conf.blk), &req->acct, 0,\nBLOCK_ACCT_WRITE);", "req->aiocb = blk_aio_pwrite_zeroes(n->conf.blk, aio_slba, aio_nlb,\nBDRV_REQ_MAY_UNMAP, nvme_rw_cb, req);", "return NVME_NO_COMPLETE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ] ]
10,967
static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket* avpkt) { WmallDecodeCtx *s = avctx->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* buf = avpkt->data; int buf_size = avpkt->size; int num_bits_prev_frame, packet_sequence_number, spliced_packet; s->frame->nb_samples = 0; if (!buf_size && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = 0; if (!decode_frame(s)) s->num_saved_bits = 0; } else if (s->packet_done || s->packet_loss) { s->packet_done = 0; if (!buf_size) return 0; s->next_packet_start = buf_size - FFMIN(avctx->block_align, buf_size); buf_size = FFMIN(avctx->block_align, buf_size); s->buf_bit_size = buf_size << 3; /* parse packet header */ init_get_bits(gb, buf, s->buf_bit_size); packet_sequence_number = get_bits(gb, 4); skip_bits(gb, 1); // Skip seekable_frame_in_packet, currently unused spliced_packet = get_bits1(gb); if (spliced_packet) avpriv_request_sample(avctx, "Bitstream splicing"); /* get number of bits that need to be added to the previous frame */ num_bits_prev_frame = get_bits(gb, s->log2_frame_size); /* check for packet loss */ if (!s->packet_loss && ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %"PRIx8" vs %x\n", s->packet_sequence_number, packet_sequence_number); s->packet_sequence_number = packet_sequence_number; if (num_bits_prev_frame > 0) { int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb); if (num_bits_prev_frame >= remaining_packet_bits) { num_bits_prev_frame = remaining_packet_bits; s->packet_done = 1; /* Append the previous frame data to the remaining data from the * previous packet to create a full frame. */ save_bits(s, gb, num_bits_prev_frame, 1); /* decode the cross packet frame if it is valid */ if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { ff_dlog(avctx, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); if (s->packet_loss) { /* Reset number of saved bits so that the decoder does not start * to decode incomplete frames in the s->len_prefix == 0 case. */ s->num_saved_bits = 0; s->packet_loss = 0; init_put_bits(&s->pb, s->frame_data, s->max_frame_size); } else { int frame_size; s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; init_get_bits(gb, avpkt->data, s->buf_bit_size); skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (frame_size = show_bits(gb, s->log2_frame_size)) && frame_size <= remaining_bits(s, gb)) { save_bits(s, gb, frame_size, 0); s->packet_done = !decode_frame(s); } else if (!s->len_prefix && s->num_saved_bits > get_bits_count(&s->gb)) { /* when the frames do not have a length prefix, we don't know the * compressed length of the individual frames however, we know what * part of a new packet belongs to the previous frame therefore we * save the incoming packet first, then we append the "previous * frame" data from the next packet so that we get a buffer that * only contains full frames */ s->packet_done = !decode_frame(s); } else { s->packet_done = 1; if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { /* save the rest of the data so that it can be decoded * with the next packet */ save_bits(s, gb, remaining_bits(s, gb), 0); *got_frame_ptr = s->frame->nb_samples > 0; av_frame_move_ref(data, s->frame); s->packet_offset = get_bits_count(gb) & 7; return (s->packet_loss) ? AVERROR_INVALIDDATA : buf_size ? get_bits_count(gb) >> 3 : 0;
true
FFmpeg
67318187fbba382d887f9581dde48a50842f1bea
static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket* avpkt) { WmallDecodeCtx *s = avctx->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* buf = avpkt->data; int buf_size = avpkt->size; int num_bits_prev_frame, packet_sequence_number, spliced_packet; s->frame->nb_samples = 0; if (!buf_size && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = 0; if (!decode_frame(s)) s->num_saved_bits = 0; } else if (s->packet_done || s->packet_loss) { s->packet_done = 0; if (!buf_size) return 0; s->next_packet_start = buf_size - FFMIN(avctx->block_align, buf_size); buf_size = FFMIN(avctx->block_align, buf_size); s->buf_bit_size = buf_size << 3; init_get_bits(gb, buf, s->buf_bit_size); packet_sequence_number = get_bits(gb, 4); skip_bits(gb, 1); spliced_packet = get_bits1(gb); if (spliced_packet) avpriv_request_sample(avctx, "Bitstream splicing"); num_bits_prev_frame = get_bits(gb, s->log2_frame_size); if (!s->packet_loss && ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %"PRIx8" vs %x\n", s->packet_sequence_number, packet_sequence_number); s->packet_sequence_number = packet_sequence_number; if (num_bits_prev_frame > 0) { int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb); if (num_bits_prev_frame >= remaining_packet_bits) { num_bits_prev_frame = remaining_packet_bits; s->packet_done = 1; save_bits(s, gb, num_bits_prev_frame, 1); if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { ff_dlog(avctx, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); if (s->packet_loss) { s->num_saved_bits = 0; s->packet_loss = 0; init_put_bits(&s->pb, s->frame_data, s->max_frame_size); } else { int frame_size; s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; init_get_bits(gb, avpkt->data, s->buf_bit_size); skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (frame_size = show_bits(gb, s->log2_frame_size)) && frame_size <= remaining_bits(s, gb)) { save_bits(s, gb, frame_size, 0); s->packet_done = !decode_frame(s); } else if (!s->len_prefix && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = !decode_frame(s); } else { s->packet_done = 1; if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { save_bits(s, gb, remaining_bits(s, gb), 0); *got_frame_ptr = s->frame->nb_samples > 0; av_frame_move_ref(data, s->frame); s->packet_offset = get_bits_count(gb) & 7; return (s->packet_loss) ? AVERROR_INVALIDDATA : buf_size ? get_bits_count(gb) >> 3 : 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket* VAR_3) { WmallDecodeCtx *s = VAR_0->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; int VAR_6, VAR_7, VAR_8; s->frame->nb_samples = 0; if (!VAR_5 && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = 0; if (!decode_frame(s)) s->num_saved_bits = 0; } else if (s->packet_done || s->packet_loss) { s->packet_done = 0; if (!VAR_5) return 0; s->next_packet_start = VAR_5 - FFMIN(VAR_0->block_align, VAR_5); VAR_5 = FFMIN(VAR_0->block_align, VAR_5); s->buf_bit_size = VAR_5 << 3; init_get_bits(gb, VAR_4, s->buf_bit_size); VAR_7 = get_bits(gb, 4); skip_bits(gb, 1); VAR_8 = get_bits1(gb); if (VAR_8) avpriv_request_sample(VAR_0, "Bitstream splicing"); VAR_6 = get_bits(gb, s->log2_frame_size); if (!s->packet_loss && ((s->VAR_7 + 1) & 0xF) != VAR_7) { av_log(VAR_0, AV_LOG_ERROR, "Packet loss detected! seq %"PRIx8" vs %x\n", s->VAR_7, VAR_7); s->VAR_7 = VAR_7; if (VAR_6 > 0) { int VAR_9 = s->buf_bit_size - get_bits_count(gb); if (VAR_6 >= VAR_9) { VAR_6 = VAR_9; s->packet_done = 1; save_bits(s, gb, VAR_6, 1); if (VAR_6 < VAR_9 && !s->packet_loss) decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { ff_dlog(VAR_0, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); if (s->packet_loss) { s->num_saved_bits = 0; s->packet_loss = 0; init_put_bits(&s->pb, s->frame_data, s->max_frame_size); } else { int VAR_10; s->buf_bit_size = (VAR_3->size - s->next_packet_start) << 3; init_get_bits(gb, VAR_3->VAR_1, s->buf_bit_size); skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (VAR_10 = show_bits(gb, s->log2_frame_size)) && VAR_10 <= remaining_bits(s, gb)) { save_bits(s, gb, VAR_10, 0); s->packet_done = !decode_frame(s); } else if (!s->len_prefix && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = !decode_frame(s); } else { s->packet_done = 1; if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { save_bits(s, gb, remaining_bits(s, gb), 0); *VAR_2 = s->frame->nb_samples > 0; av_frame_move_ref(VAR_1, s->frame); s->packet_offset = get_bits_count(gb) & 7; return (s->packet_loss) ? AVERROR_INVALIDDATA : VAR_5 ? get_bits_count(gb) >> 3 : 0;
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket* VAR_3)\n{", "WmallDecodeCtx *s = VAR_0->priv_data;", "GetBitContext* gb = &s->pgb;", "const uint8_t* VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "int VAR_6, VAR_7, VAR_8;", "s->frame->nb_samples = 0;", "if (!VAR_5 && s->num_saved_bits > get_bits_count(&s->gb)) {", "s->packet_done = 0;", "if (!decode_frame(s))\ns->num_saved_bits = 0;", "} else if (s->packet_done || s->packet_loss) {", "s->packet_done = 0;", "if (!VAR_5)\nreturn 0;", "s->next_packet_start = VAR_5 - FFMIN(VAR_0->block_align, VAR_5);", "VAR_5 = FFMIN(VAR_0->block_align, VAR_5);", "s->buf_bit_size = VAR_5 << 3;", "init_get_bits(gb, VAR_4, s->buf_bit_size);", "VAR_7 = get_bits(gb, 4);", "skip_bits(gb, 1);", "VAR_8 = get_bits1(gb);", "if (VAR_8)\navpriv_request_sample(VAR_0, \"Bitstream splicing\");", "VAR_6 = get_bits(gb, s->log2_frame_size);", "if (!s->packet_loss &&\n((s->VAR_7 + 1) & 0xF) != VAR_7) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Packet loss detected! seq %\"PRIx8\" vs %x\\n\",\ns->VAR_7, VAR_7);", "s->VAR_7 = VAR_7;", "if (VAR_6 > 0) {", "int VAR_9 = s->buf_bit_size - get_bits_count(gb);", "if (VAR_6 >= VAR_9) {", "VAR_6 = VAR_9;", "s->packet_done = 1;", "save_bits(s, gb, VAR_6, 1);", "if (VAR_6 < VAR_9 && !s->packet_loss)\ndecode_frame(s);", "} else if (s->num_saved_bits - s->frame_offset) {", "ff_dlog(VAR_0, \"ignoring %x previously saved bits\\n\",\ns->num_saved_bits - s->frame_offset);", "if (s->packet_loss) {", "s->num_saved_bits = 0;", "s->packet_loss = 0;", "init_put_bits(&s->pb, s->frame_data, s->max_frame_size);", "} else {", "int VAR_10;", "s->buf_bit_size = (VAR_3->size - s->next_packet_start) << 3;", "init_get_bits(gb, VAR_3->VAR_1, s->buf_bit_size);", "skip_bits(gb, s->packet_offset);", "if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size &&\n(VAR_10 = show_bits(gb, s->log2_frame_size)) &&\nVAR_10 <= remaining_bits(s, gb)) {", "save_bits(s, gb, VAR_10, 0);", "s->packet_done = !decode_frame(s);", "} else if (!s->len_prefix", "&& s->num_saved_bits > get_bits_count(&s->gb)) {", "s->packet_done = !decode_frame(s);", "} else {", "s->packet_done = 1;", "if (s->packet_done && !s->packet_loss &&\nremaining_bits(s, gb) > 0) {", "save_bits(s, gb, remaining_bits(s, gb), 0);", "*VAR_2 = s->frame->nb_samples > 0;", "av_frame_move_ref(VAR_1, s->frame);", "s->packet_offset = get_bits_count(gb) & 7;", "return (s->packet_loss) ? AVERROR_INVALIDDATA : VAR_5 ? get_bits_count(gb) >> 3 : 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12, 13 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 18 ], [ 19 ], [ 20 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26, 27 ], [ 29 ], [ 31, 32 ], [ 33, 34, 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 44 ], [ 46, 47 ], [ 48 ], [ 49, 50 ], [ 51 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62, 63, 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 75 ], [ 76 ], [ 77 ], [ 78, 79 ], [ 82 ], [ 83 ], [ 84 ], [ 85 ], [ 86 ] ]
10,968
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1) { int size, l; if (f->is_write) { abort(); } size = size1; while (size > 0) { l = f->buf_size - f->buf_index; if (l == 0) { qemu_fill_buffer(f); l = f->buf_size - f->buf_index; if (l == 0) { break; } } if (l > size) { l = size; } memcpy(buf, f->buf + f->buf_index, l); f->buf_index += l; buf += l; size -= l; } return size1 - size; }
true
qemu
c63807244fb55071675907460a0ecf228c1766c8
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1) { int size, l; if (f->is_write) { abort(); } size = size1; while (size > 0) { l = f->buf_size - f->buf_index; if (l == 0) { qemu_fill_buffer(f); l = f->buf_size - f->buf_index; if (l == 0) { break; } } if (l > size) { l = size; } memcpy(buf, f->buf + f->buf_index, l); f->buf_index += l; buf += l; size -= l; } return size1 - size; }
{ "code": [ "int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size1)", " int size, l;", " size = size1;", " while (size > 0) {", " l = f->buf_size - f->buf_index;", " if (l == 0) {", " qemu_fill_buffer(f);", " l = f->buf_size - f->buf_index;", " if (l == 0) {", " break;", " if (l > size) {", " l = size;", " memcpy(buf, f->buf + f->buf_index, l);", " f->buf_index += l;", " buf += l;", " size -= l;", " return size1 - size;" ], "line_no": [ 1, 5, 17, 19, 21, 23, 25, 27, 29, 31, 37, 39, 43, 45, 47, 49, 53 ] }
int FUNC_0(QEMUFile *VAR_0, uint8_t *VAR_1, int VAR_2) { int VAR_3, VAR_4; if (VAR_0->is_write) { abort(); } VAR_3 = VAR_2; while (VAR_3 > 0) { VAR_4 = VAR_0->buf_size - VAR_0->buf_index; if (VAR_4 == 0) { qemu_fill_buffer(VAR_0); VAR_4 = VAR_0->buf_size - VAR_0->buf_index; if (VAR_4 == 0) { break; } } if (VAR_4 > VAR_3) { VAR_4 = VAR_3; } memcpy(VAR_1, VAR_0->VAR_1 + VAR_0->buf_index, VAR_4); VAR_0->buf_index += VAR_4; VAR_1 += VAR_4; VAR_3 -= VAR_4; } return VAR_2 - VAR_3; }
[ "int FUNC_0(QEMUFile *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4;", "if (VAR_0->is_write) {", "abort();", "}", "VAR_3 = VAR_2;", "while (VAR_3 > 0) {", "VAR_4 = VAR_0->buf_size - VAR_0->buf_index;", "if (VAR_4 == 0) {", "qemu_fill_buffer(VAR_0);", "VAR_4 = VAR_0->buf_size - VAR_0->buf_index;", "if (VAR_4 == 0) {", "break;", "}", "}", "if (VAR_4 > VAR_3) {", "VAR_4 = VAR_3;", "}", "memcpy(VAR_1, VAR_0->VAR_1 + VAR_0->buf_index, VAR_4);", "VAR_0->buf_index += VAR_4;", "VAR_1 += VAR_4;", "VAR_3 -= VAR_4;", "}", "return VAR_2 - VAR_3;", "}" ]
[ 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
10,969
static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIContext *avi = s->priv_data; ByteIOContext *pb = s->pb; int n, d[8], size; offset_t i, sync; void* dstr; if (ENABLE_DV_DEMUXER && avi->dv_demux) { size = dv_get_packet(avi->dv_demux, pkt); if (size >= 0) return size; } if(avi->non_interleaved){ int best_stream_index = 0; AVStream *best_st= NULL; AVIStream *best_ast; int64_t best_ts= INT64_MAX; int i; for(i=0; i<s->nb_streams; i++){ AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; int64_t ts= ast->frame_offset; if(ast->sample_size) ts /= ast->sample_size; ts= av_rescale(ts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den); // av_log(NULL, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset); if(ts < best_ts && st->nb_index_entries){ best_ts= ts; best_st= st; best_stream_index= i; } } best_ast = best_st->priv_data; best_ts= av_rescale(best_ts, best_st->time_base.den, AV_TIME_BASE * (int64_t)best_st->time_base.num); //FIXME a little ugly if(best_ast->remaining) i= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD); else i= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY); // av_log(NULL, AV_LOG_DEBUG, "%d\n", i); if(i>=0){ int64_t pos= best_st->index_entries[i].pos; pos += best_ast->packet_size - best_ast->remaining; url_fseek(s->pb, pos + 8, SEEK_SET); // av_log(NULL, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); assert(best_ast->remaining <= best_ast->packet_size); avi->stream_index= best_stream_index; if(!best_ast->remaining) best_ast->packet_size= best_ast->remaining= best_st->index_entries[i].size; } } resync: if(avi->stream_index >= 0){ AVStream *st= s->streams[ avi->stream_index ]; AVIStream *ast= st->priv_data; int size; if(ast->sample_size <= 1) // minorityreport.AVI block_align=1024 sample_size=1 IMA-ADPCM size= INT_MAX; else if(ast->sample_size < 32) size= 64*ast->sample_size; else size= ast->sample_size; if(size > ast->remaining) size= ast->remaining; av_get_packet(pb, pkt, size); if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){ ast->has_pal=0; pkt->size += 4*256; pkt->data = av_realloc(pkt->data, pkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if(pkt->data) memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256); } if (ENABLE_DV_DEMUXER && avi->dv_demux) { dstr = pkt->destruct; size = dv_produce_packet(avi->dv_demux, pkt, pkt->data, pkt->size); pkt->destruct = dstr; pkt->flags |= PKT_FLAG_KEY; } else { /* XXX: how to handle B frames in avi ? */ pkt->dts = ast->frame_offset; // pkt->dts += ast->start; if(ast->sample_size) pkt->dts /= ast->sample_size; //av_log(NULL, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size); pkt->stream_index = avi->stream_index; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { AVIndexEntry *e; int index; assert(st->index_entries); index= av_index_search_timestamp(st, pkt->dts, 0); e= &st->index_entries[index]; if(index >= 0 && e->timestamp == ast->frame_offset){ if (e->flags & AVINDEX_KEYFRAME) pkt->flags |= PKT_FLAG_KEY; } } else { pkt->flags |= PKT_FLAG_KEY; } if(ast->sample_size) ast->frame_offset += pkt->size; else ast->frame_offset++; } ast->remaining -= size; if(!ast->remaining){ avi->stream_index= -1; ast->packet_size= 0; } return size; } memset(d, -1, sizeof(int)*8); for(i=sync=url_ftell(pb); !url_feof(pb); i++) { int j; for(j=0; j<7; j++) d[j]= d[j+1]; d[7]= get_byte(pb); size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); if( d[2] >= '0' && d[2] <= '9' && d[3] >= '0' && d[3] <= '9'){ n= (d[2] - '0') * 10 + (d[3] - '0'); }else{ n= 100; //invalid stream id } //av_log(NULL, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); if(i + size > avi->fsize || d[0]<0) continue; //parse ix## if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ url_fskip(pb, size); //av_log(NULL, AV_LOG_DEBUG, "SKIP\n"); goto resync; } if( d[0] >= '0' && d[0] <= '9' && d[1] >= '0' && d[1] <= '9'){ n= (d[0] - '0') * 10 + (d[1] - '0'); }else{ n= 100; //invalid stream id } //parse ##dc/##wb if(n < s->nb_streams){ AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if(s->nb_streams>=2){ AVStream *st1 = s->streams[1]; AVIStream *ast1= st1->priv_data; //workaround for broken small-file-bug402.avi if( d[2] == 'w' && d[3] == 'b' && n==0 && st ->codec->codec_type == CODEC_TYPE_VIDEO && st1->codec->codec_type == CODEC_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ){ n=1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream+prefix combination, assuming audio\n"); } } if( (st->discard >= AVDISCARD_DEFAULT && size==0) /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & PKT_FLAG_KEY))*/ //FIXME needs a little reordering || st->discard >= AVDISCARD_ALL){ if(ast->sample_size) ast->frame_offset += pkt->size; else ast->frame_offset++; url_fskip(pb, size); goto resync; } if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { int k = get_byte(pb); int last = (k + get_byte(pb) - 1) & 0xFF; get_le16(pb); //flags for (; k <= last; k++) ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16); ast->has_pal= 1; goto resync; } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || d[2]*256+d[3] == ast->prefix /*|| (d[2] == 'd' && d[3] == 'c') || (d[2] == 'w' && d[3] == 'b')*/) { //av_log(NULL, AV_LOG_DEBUG, "OK\n"); if(d[2]*256+d[3] == ast->prefix) ast->prefix_count++; else{ ast->prefix= d[2]*256+d[3]; ast->prefix_count= 0; } avi->stream_index= n; ast->packet_size= size + 8; ast->remaining= size; { uint64_t pos= url_ftell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset / FFMAX(1, ast->sample_size), size, 0, AVINDEX_KEYFRAME); } } goto resync; } } } }
true
FFmpeg
fce88d52ca0b694a614e2cf030c3f622db65b164
static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIContext *avi = s->priv_data; ByteIOContext *pb = s->pb; int n, d[8], size; offset_t i, sync; void* dstr; if (ENABLE_DV_DEMUXER && avi->dv_demux) { size = dv_get_packet(avi->dv_demux, pkt); if (size >= 0) return size; } if(avi->non_interleaved){ int best_stream_index = 0; AVStream *best_st= NULL; AVIStream *best_ast; int64_t best_ts= INT64_MAX; int i; for(i=0; i<s->nb_streams; i++){ AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; int64_t ts= ast->frame_offset; if(ast->sample_size) ts /= ast->sample_size; ts= av_rescale(ts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den); if(ts < best_ts && st->nb_index_entries){ best_ts= ts; best_st= st; best_stream_index= i; } } best_ast = best_st->priv_data; best_ts= av_rescale(best_ts, best_st->time_base.den, AV_TIME_BASE * (int64_t)best_st->time_base.num); if(best_ast->remaining) i= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD); else i= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY); if(i>=0){ int64_t pos= best_st->index_entries[i].pos; pos += best_ast->packet_size - best_ast->remaining; url_fseek(s->pb, pos + 8, SEEK_SET); assert(best_ast->remaining <= best_ast->packet_size); avi->stream_index= best_stream_index; if(!best_ast->remaining) best_ast->packet_size= best_ast->remaining= best_st->index_entries[i].size; } } resync: if(avi->stream_index >= 0){ AVStream *st= s->streams[ avi->stream_index ]; AVIStream *ast= st->priv_data; int size; if(ast->sample_size <= 1) size= INT_MAX; else if(ast->sample_size < 32) size= 64*ast->sample_size; else size= ast->sample_size; if(size > ast->remaining) size= ast->remaining; av_get_packet(pb, pkt, size); if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){ ast->has_pal=0; pkt->size += 4*256; pkt->data = av_realloc(pkt->data, pkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if(pkt->data) memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256); } if (ENABLE_DV_DEMUXER && avi->dv_demux) { dstr = pkt->destruct; size = dv_produce_packet(avi->dv_demux, pkt, pkt->data, pkt->size); pkt->destruct = dstr; pkt->flags |= PKT_FLAG_KEY; } else { pkt->dts = ast->frame_offset; if(ast->sample_size) pkt->dts /= ast->sample_size; pkt->stream_index = avi->stream_index; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { AVIndexEntry *e; int index; assert(st->index_entries); index= av_index_search_timestamp(st, pkt->dts, 0); e= &st->index_entries[index]; if(index >= 0 && e->timestamp == ast->frame_offset){ if (e->flags & AVINDEX_KEYFRAME) pkt->flags |= PKT_FLAG_KEY; } } else { pkt->flags |= PKT_FLAG_KEY; } if(ast->sample_size) ast->frame_offset += pkt->size; else ast->frame_offset++; } ast->remaining -= size; if(!ast->remaining){ avi->stream_index= -1; ast->packet_size= 0; } return size; } memset(d, -1, sizeof(int)*8); for(i=sync=url_ftell(pb); !url_feof(pb); i++) { int j; for(j=0; j<7; j++) d[j]= d[j+1]; d[7]= get_byte(pb); size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); if( d[2] >= '0' && d[2] <= '9' && d[3] >= '0' && d[3] <= '9'){ n= (d[2] - '0') * 10 + (d[3] - '0'); }else{ n= 100; } if(i + size > avi->fsize || d[0]<0) continue; if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ url_fskip(pb, size); goto resync; } if( d[0] >= '0' && d[0] <= '9' && d[1] >= '0' && d[1] <= '9'){ n= (d[0] - '0') * 10 + (d[1] - '0'); }else{ n= 100; } if(n < s->nb_streams){ AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if(s->nb_streams>=2){ AVStream *st1 = s->streams[1]; AVIStream *ast1= st1->priv_data; if( d[2] == 'w' && d[3] == 'b' && n==0 && st ->codec->codec_type == CODEC_TYPE_VIDEO && st1->codec->codec_type == CODEC_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ){ n=1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream+prefix combination, assuming audio\n"); } } if( (st->discard >= AVDISCARD_DEFAULT && size==0) || st->discard >= AVDISCARD_ALL){ if(ast->sample_size) ast->frame_offset += pkt->size; else ast->frame_offset++; url_fskip(pb, size); goto resync; } if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { int k = get_byte(pb); int last = (k + get_byte(pb) - 1) & 0xFF; get_le16(pb); for (; k <= last; k++) ast->pal[k] = get_be32(pb)>>8; ast->has_pal= 1; goto resync; } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || d[2]*256+d[3] == ast->prefix ) { if(d[2]*256+d[3] == ast->prefix) ast->prefix_count++; else{ ast->prefix= d[2]*256+d[3]; ast->prefix_count= 0; } avi->stream_index= n; ast->packet_size= size + 8; ast->remaining= size; { uint64_t pos= url_ftell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset / FFMAX(1, ast->sample_size), size, 0, AVINDEX_KEYFRAME); } } goto resync; } } } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { AVIContext *avi = VAR_0->priv_data; ByteIOContext *pb = VAR_0->pb; int VAR_2, VAR_3[8], VAR_8; offset_t VAR_7, sync; void* VAR_5; if (ENABLE_DV_DEMUXER && avi->dv_demux) { VAR_8 = dv_get_packet(avi->dv_demux, VAR_1); if (VAR_8 >= 0) return VAR_8; } if(avi->non_interleaved){ int VAR_6 = 0; AVStream *best_st= NULL; AVIStream *best_ast; int64_t best_ts= INT64_MAX; int VAR_7; for(VAR_7=0; VAR_7<VAR_0->nb_streams; VAR_7++){ AVStream *st = VAR_0->streams[VAR_7]; AVIStream *ast = st->priv_data; int64_t ts= ast->frame_offset; if(ast->sample_size) ts /= ast->sample_size; ts= av_rescale(ts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den); if(ts < best_ts && st->nb_index_entries){ best_ts= ts; best_st= st; VAR_6= VAR_7; } } best_ast = best_st->priv_data; best_ts= av_rescale(best_ts, best_st->time_base.den, AV_TIME_BASE * (int64_t)best_st->time_base.num); if(best_ast->remaining) VAR_7= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD); else VAR_7= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY); if(VAR_7>=0){ int64_t pos= best_st->index_entries[VAR_7].pos; pos += best_ast->packet_size - best_ast->remaining; url_fseek(VAR_0->pb, pos + 8, SEEK_SET); assert(best_ast->remaining <= best_ast->packet_size); avi->stream_index= VAR_6; if(!best_ast->remaining) best_ast->packet_size= best_ast->remaining= best_st->index_entries[VAR_7].VAR_8; } } resync: if(avi->stream_index >= 0){ AVStream *st= VAR_0->streams[ avi->stream_index ]; AVIStream *ast= st->priv_data; int VAR_8; if(ast->sample_size <= 1) VAR_8= INT_MAX; else if(ast->sample_size < 32) VAR_8= 64*ast->sample_size; else VAR_8= ast->sample_size; if(VAR_8 > ast->remaining) VAR_8= ast->remaining; av_get_packet(pb, VAR_1, VAR_8); if(ast->has_pal && VAR_1->data && VAR_1->VAR_8<(unsigned)INT_MAX/2){ ast->has_pal=0; VAR_1->VAR_8 += 4*256; VAR_1->data = av_realloc(VAR_1->data, VAR_1->VAR_8 + FF_INPUT_BUFFER_PADDING_SIZE); if(VAR_1->data) memcpy(VAR_1->data + VAR_1->VAR_8 - 4*256, ast->pal, 4*256); } if (ENABLE_DV_DEMUXER && avi->dv_demux) { VAR_5 = VAR_1->destruct; VAR_8 = dv_produce_packet(avi->dv_demux, VAR_1, VAR_1->data, VAR_1->VAR_8); VAR_1->destruct = VAR_5; VAR_1->flags |= PKT_FLAG_KEY; } else { VAR_1->dts = ast->frame_offset; if(ast->sample_size) VAR_1->dts /= ast->sample_size; VAR_1->stream_index = avi->stream_index; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { AVIndexEntry *e; int VAR_8; assert(st->index_entries); VAR_8= av_index_search_timestamp(st, VAR_1->dts, 0); e= &st->index_entries[VAR_8]; if(VAR_8 >= 0 && e->timestamp == ast->frame_offset){ if (e->flags & AVINDEX_KEYFRAME) VAR_1->flags |= PKT_FLAG_KEY; } } else { VAR_1->flags |= PKT_FLAG_KEY; } if(ast->sample_size) ast->frame_offset += VAR_1->VAR_8; else ast->frame_offset++; } ast->remaining -= VAR_8; if(!ast->remaining){ avi->stream_index= -1; ast->packet_size= 0; } return VAR_8; } memset(VAR_3, -1, sizeof(int)*8); for(VAR_7=sync=url_ftell(pb); !url_feof(pb); VAR_7++) { int j; for(j=0; j<7; j++) VAR_3[j]= VAR_3[j+1]; VAR_3[7]= get_byte(pb); VAR_8= VAR_3[4] + (VAR_3[5]<<8) + (VAR_3[6]<<16) + (VAR_3[7]<<24); if( VAR_3[2] >= '0' && VAR_3[2] <= '9' && VAR_3[3] >= '0' && VAR_3[3] <= '9'){ VAR_2= (VAR_3[2] - '0') * 10 + (VAR_3[3] - '0'); }else{ VAR_2= 100; } if(VAR_7 + VAR_8 > avi->fsize || VAR_3[0]<0) continue; if( (VAR_3[0] == 'VAR_7' && VAR_3[1] == 'x' && VAR_2 < VAR_0->nb_streams) ||(VAR_3[0] == 'J' && VAR_3[1] == 'U' && VAR_3[2] == 'N' && VAR_3[3] == 'K') ||(VAR_3[0] == 'VAR_7' && VAR_3[1] == 'VAR_3' && VAR_3[2] == 'x' && VAR_3[3] == '1')){ url_fskip(pb, VAR_8); goto resync; } if( VAR_3[0] >= '0' && VAR_3[0] <= '9' && VAR_3[1] >= '0' && VAR_3[1] <= '9'){ VAR_2= (VAR_3[0] - '0') * 10 + (VAR_3[1] - '0'); }else{ VAR_2= 100; } if(VAR_2 < VAR_0->nb_streams){ AVStream *st; AVIStream *ast; st = VAR_0->streams[VAR_2]; ast = st->priv_data; if(VAR_0->nb_streams>=2){ AVStream *st1 = VAR_0->streams[1]; AVIStream *ast1= st1->priv_data; if( VAR_3[2] == 'w' && VAR_3[3] == 'b' && VAR_2==0 && st ->codec->codec_type == CODEC_TYPE_VIDEO && st1->codec->codec_type == CODEC_TYPE_AUDIO && ast->prefix == 'VAR_3'*256+'c' && (VAR_3[2]*256+VAR_3[3] == ast1->prefix || !ast1->prefix_count) ){ VAR_2=1; st = st1; ast = ast1; av_log(VAR_0, AV_LOG_WARNING, "Invalid stream+prefix combination, assuming audio\VAR_2"); } } if( (st->discard >= AVDISCARD_DEFAULT && VAR_8==0) || st->discard >= AVDISCARD_ALL){ if(ast->sample_size) ast->frame_offset += VAR_1->VAR_8; else ast->frame_offset++; url_fskip(pb, VAR_8); goto resync; } if (VAR_3[2] == 'p' && VAR_3[3] == 'c' && VAR_8<=4*256+4) { int k = get_byte(pb); int last = (k + get_byte(pb) - 1) & 0xFF; get_le16(pb); for (; k <= last; k++) ast->pal[k] = get_be32(pb)>>8; ast->has_pal= 1; goto resync; } else if( ((ast->prefix_count<5 || sync+9 > VAR_7) && VAR_3[2]<128 && VAR_3[3]<128) || VAR_3[2]*256+VAR_3[3] == ast->prefix ) { if(VAR_3[2]*256+VAR_3[3] == ast->prefix) ast->prefix_count++; else{ ast->prefix= VAR_3[2]*256+VAR_3[3]; ast->prefix_count= 0; } avi->stream_index= VAR_2; ast->packet_size= VAR_8 + 8; ast->remaining= VAR_8; { uint64_t pos= url_ftell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset / FFMAX(1, ast->sample_size), VAR_8, 0, AVINDEX_KEYFRAME); } } goto resync; } } } }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "AVIContext *avi = VAR_0->priv_data;", "ByteIOContext *pb = VAR_0->pb;", "int VAR_2, VAR_3[8], VAR_8;", "offset_t VAR_7, sync;", "void* VAR_5;", "if (ENABLE_DV_DEMUXER && avi->dv_demux) {", "VAR_8 = dv_get_packet(avi->dv_demux, VAR_1);", "if (VAR_8 >= 0)\nreturn VAR_8;", "}", "if(avi->non_interleaved){", "int VAR_6 = 0;", "AVStream *best_st= NULL;", "AVIStream *best_ast;", "int64_t best_ts= INT64_MAX;", "int VAR_7;", "for(VAR_7=0; VAR_7<VAR_0->nb_streams; VAR_7++){", "AVStream *st = VAR_0->streams[VAR_7];", "AVIStream *ast = st->priv_data;", "int64_t ts= ast->frame_offset;", "if(ast->sample_size)\nts /= ast->sample_size;", "ts= av_rescale(ts, AV_TIME_BASE * (int64_t)st->time_base.num, st->time_base.den);", "if(ts < best_ts && st->nb_index_entries){", "best_ts= ts;", "best_st= st;", "VAR_6= VAR_7;", "}", "}", "best_ast = best_st->priv_data;", "best_ts= av_rescale(best_ts, best_st->time_base.den, AV_TIME_BASE * (int64_t)best_st->time_base.num);", "if(best_ast->remaining)\nVAR_7= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);", "else\nVAR_7= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY);", "if(VAR_7>=0){", "int64_t pos= best_st->index_entries[VAR_7].pos;", "pos += best_ast->packet_size - best_ast->remaining;", "url_fseek(VAR_0->pb, pos + 8, SEEK_SET);", "assert(best_ast->remaining <= best_ast->packet_size);", "avi->stream_index= VAR_6;", "if(!best_ast->remaining)\nbest_ast->packet_size=\nbest_ast->remaining= best_st->index_entries[VAR_7].VAR_8;", "}", "}", "resync:\nif(avi->stream_index >= 0){", "AVStream *st= VAR_0->streams[ avi->stream_index ];", "AVIStream *ast= st->priv_data;", "int VAR_8;", "if(ast->sample_size <= 1)\nVAR_8= INT_MAX;", "else if(ast->sample_size < 32)\nVAR_8= 64*ast->sample_size;", "else\nVAR_8= ast->sample_size;", "if(VAR_8 > ast->remaining)\nVAR_8= ast->remaining;", "av_get_packet(pb, VAR_1, VAR_8);", "if(ast->has_pal && VAR_1->data && VAR_1->VAR_8<(unsigned)INT_MAX/2){", "ast->has_pal=0;", "VAR_1->VAR_8 += 4*256;", "VAR_1->data = av_realloc(VAR_1->data, VAR_1->VAR_8 + FF_INPUT_BUFFER_PADDING_SIZE);", "if(VAR_1->data)\nmemcpy(VAR_1->data + VAR_1->VAR_8 - 4*256, ast->pal, 4*256);", "}", "if (ENABLE_DV_DEMUXER && avi->dv_demux) {", "VAR_5 = VAR_1->destruct;", "VAR_8 = dv_produce_packet(avi->dv_demux, VAR_1,\nVAR_1->data, VAR_1->VAR_8);", "VAR_1->destruct = VAR_5;", "VAR_1->flags |= PKT_FLAG_KEY;", "} else {", "VAR_1->dts = ast->frame_offset;", "if(ast->sample_size)\nVAR_1->dts /= ast->sample_size;", "VAR_1->stream_index = avi->stream_index;", "if (st->codec->codec_type == CODEC_TYPE_VIDEO) {", "AVIndexEntry *e;", "int VAR_8;", "assert(st->index_entries);", "VAR_8= av_index_search_timestamp(st, VAR_1->dts, 0);", "e= &st->index_entries[VAR_8];", "if(VAR_8 >= 0 && e->timestamp == ast->frame_offset){", "if (e->flags & AVINDEX_KEYFRAME)\nVAR_1->flags |= PKT_FLAG_KEY;", "}", "} else {", "VAR_1->flags |= PKT_FLAG_KEY;", "}", "if(ast->sample_size)\nast->frame_offset += VAR_1->VAR_8;", "else\nast->frame_offset++;", "}", "ast->remaining -= VAR_8;", "if(!ast->remaining){", "avi->stream_index= -1;", "ast->packet_size= 0;", "}", "return VAR_8;", "}", "memset(VAR_3, -1, sizeof(int)*8);", "for(VAR_7=sync=url_ftell(pb); !url_feof(pb); VAR_7++) {", "int j;", "for(j=0; j<7; j++)", "VAR_3[j]= VAR_3[j+1];", "VAR_3[7]= get_byte(pb);", "VAR_8= VAR_3[4] + (VAR_3[5]<<8) + (VAR_3[6]<<16) + (VAR_3[7]<<24);", "if( VAR_3[2] >= '0' && VAR_3[2] <= '9'\n&& VAR_3[3] >= '0' && VAR_3[3] <= '9'){", "VAR_2= (VAR_3[2] - '0') * 10 + (VAR_3[3] - '0');", "}else{", "VAR_2= 100;", "}", "if(VAR_7 + VAR_8 > avi->fsize || VAR_3[0]<0)\ncontinue;", "if( (VAR_3[0] == 'VAR_7' && VAR_3[1] == 'x' && VAR_2 < VAR_0->nb_streams)\n||(VAR_3[0] == 'J' && VAR_3[1] == 'U' && VAR_3[2] == 'N' && VAR_3[3] == 'K')\n||(VAR_3[0] == 'VAR_7' && VAR_3[1] == 'VAR_3' && VAR_3[2] == 'x' && VAR_3[3] == '1')){", "url_fskip(pb, VAR_8);", "goto resync;", "}", "if( VAR_3[0] >= '0' && VAR_3[0] <= '9'\n&& VAR_3[1] >= '0' && VAR_3[1] <= '9'){", "VAR_2= (VAR_3[0] - '0') * 10 + (VAR_3[1] - '0');", "}else{", "VAR_2= 100;", "}", "if(VAR_2 < VAR_0->nb_streams){", "AVStream *st;", "AVIStream *ast;", "st = VAR_0->streams[VAR_2];", "ast = st->priv_data;", "if(VAR_0->nb_streams>=2){", "AVStream *st1 = VAR_0->streams[1];", "AVIStream *ast1= st1->priv_data;", "if( VAR_3[2] == 'w' && VAR_3[3] == 'b'\n&& VAR_2==0\n&& st ->codec->codec_type == CODEC_TYPE_VIDEO\n&& st1->codec->codec_type == CODEC_TYPE_AUDIO\n&& ast->prefix == 'VAR_3'*256+'c'\n&& (VAR_3[2]*256+VAR_3[3] == ast1->prefix || !ast1->prefix_count)\n){", "VAR_2=1;", "st = st1;", "ast = ast1;", "av_log(VAR_0, AV_LOG_WARNING, \"Invalid stream+prefix combination, assuming audio\\VAR_2\");", "}", "}", "if( (st->discard >= AVDISCARD_DEFAULT && VAR_8==0)\n|| st->discard >= AVDISCARD_ALL){", "if(ast->sample_size) ast->frame_offset += VAR_1->VAR_8;", "else ast->frame_offset++;", "url_fskip(pb, VAR_8);", "goto resync;", "}", "if (VAR_3[2] == 'p' && VAR_3[3] == 'c' && VAR_8<=4*256+4) {", "int k = get_byte(pb);", "int last = (k + get_byte(pb) - 1) & 0xFF;", "get_le16(pb);", "for (; k <= last; k++)", "ast->pal[k] = get_be32(pb)>>8;", "ast->has_pal= 1;", "goto resync;", "} else if( ((ast->prefix_count<5 || sync+9 > VAR_7) && VAR_3[2]<128 && VAR_3[3]<128) ||", "VAR_3[2]*256+VAR_3[3] == ast->prefix\n) {", "if(VAR_3[2]*256+VAR_3[3] == ast->prefix)\nast->prefix_count++;", "else{", "ast->prefix= VAR_3[2]*256+VAR_3[3];", "ast->prefix_count= 0;", "}", "avi->stream_index= VAR_2;", "ast->packet_size= VAR_8 + 8;", "ast->remaining= VAR_8;", "{", "uint64_t pos= url_ftell(pb) - 8;", "if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){", "av_add_index_entry(st, pos, ast->frame_offset / FFMAX(1, ast->sample_size), VAR_8, 0, AVINDEX_KEYFRAME);", "}", "}", "goto resync;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10, 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23, 24 ], [ 25 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35, 36 ], [ 37, 38 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 45 ], [ 46 ], [ 47, 48, 49 ], [ 50 ], [ 51 ], [ 52, 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57, 58 ], [ 59, 60 ], [ 61, 62 ], [ 63, 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70, 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75, 76 ], [ 77 ], [ 78 ], [ 79 ], [ 81 ], [ 83, 84 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94, 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100, 101 ], [ 102, 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112 ], [ 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119, 120 ], [ 121 ], [ 122 ], [ 123 ], [ 124 ], [ 126, 127 ], [ 129, 131, 132 ], [ 133 ], [ 135 ], [ 136 ], [ 137, 138 ], [ 139 ], [ 140 ], [ 141 ], [ 142 ], [ 144 ], [ 145 ], [ 146 ], [ 147 ], [ 148 ], [ 149 ], [ 150 ], [ 151 ], [ 153, 154, 155, 156, 157, 158, 159 ], [ 160 ], [ 161 ], [ 162 ], [ 163 ], [ 164 ], [ 165 ], [ 166, 168 ], [ 169 ], [ 170 ], [ 171 ], [ 172 ], [ 173 ], [ 174 ], [ 175 ], [ 176 ], [ 177 ], [ 178 ], [ 179 ], [ 180 ], [ 181 ], [ 182 ], [ 183, 185 ], [ 187, 188 ], [ 189 ], [ 190 ], [ 191 ], [ 192 ], [ 193 ], [ 194 ], [ 195 ], [ 196 ], [ 197 ], [ 198 ], [ 199 ], [ 200 ], [ 201 ], [ 202 ], [ 203 ], [ 204 ], [ 205 ], [ 206 ] ]
10,972
static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start) { BDRVQcow2State *s = bs->opaque; int nr = s->cluster_sectors; uint64_t off; int ret; ret = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &nr, &off); assert(nr == s->cluster_sectors); return ret == QCOW2_CLUSTER_UNALLOCATED || ret == QCOW2_CLUSTER_ZERO; }
true
qemu
ebb718a5c7240f6ffb308e0d0b67a92c3b63b91c
static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start) { BDRVQcow2State *s = bs->opaque; int nr = s->cluster_sectors; uint64_t off; int ret; ret = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &nr, &off); assert(nr == s->cluster_sectors); return ret == QCOW2_CLUSTER_UNALLOCATED || ret == QCOW2_CLUSTER_ZERO; }
{ "code": [ " BDRVQcow2State *s = bs->opaque;", "static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start)", " BDRVQcow2State *s = bs->opaque;", " int nr = s->cluster_sectors;", " uint64_t off;", " int ret;", " ret = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &nr, &off);", " assert(nr == s->cluster_sectors);", " return ret == QCOW2_CLUSTER_UNALLOCATED || ret == QCOW2_CLUSTER_ZERO;" ], "line_no": [ 5, 1, 5, 7, 9, 11, 15, 17, 19 ] }
static bool FUNC_0(BlockDriverState *bs, int64_t start) { BDRVQcow2State *s = bs->opaque; int VAR_0 = s->cluster_sectors; uint64_t off; int VAR_1; VAR_1 = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &VAR_0, &off); assert(VAR_0 == s->cluster_sectors); return VAR_1 == QCOW2_CLUSTER_UNALLOCATED || VAR_1 == QCOW2_CLUSTER_ZERO; }
[ "static bool FUNC_0(BlockDriverState *bs, int64_t start)\n{", "BDRVQcow2State *s = bs->opaque;", "int VAR_0 = s->cluster_sectors;", "uint64_t off;", "int VAR_1;", "VAR_1 = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &VAR_0, &off);", "assert(VAR_0 == s->cluster_sectors);", "return VAR_1 == QCOW2_CLUSTER_UNALLOCATED || VAR_1 == QCOW2_CLUSTER_ZERO;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
10,973
void spapr_lmb_release(DeviceState *dev) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_hotplug_handler(dev)); PCDIMMDevice *dimm = PC_DIMM(dev); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev)); /* This information will get lost if a migration occurs * during the unplug process. In this case recover it. */ if (ds == NULL) { ds = spapr_recover_pending_dimm_state(spapr, PC_DIMM(dev)); g_assert(ds); /* The DRC being examined by the caller at least must be counted */ g_assert(ds->nr_lmbs); } if (--ds->nr_lmbs) { return; } spapr_pending_dimm_unplugs_remove(spapr, ds); /* * Now that all the LMBs have been removed by the guest, call the * pc-dimm unplug handler to cleanup up the pc-dimm device. */ pc_dimm_memory_unplug(dev, &spapr->hotplug_memory, mr); object_unparent(OBJECT(dev)); }
true
qemu
0479097859372a760843ad1b9c6ed3705c6423ca
void spapr_lmb_release(DeviceState *dev) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_hotplug_handler(dev)); PCDIMMDevice *dimm = PC_DIMM(dev); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev)); if (ds == NULL) { ds = spapr_recover_pending_dimm_state(spapr, PC_DIMM(dev)); g_assert(ds); g_assert(ds->nr_lmbs); } if (--ds->nr_lmbs) { return; } spapr_pending_dimm_unplugs_remove(spapr, ds); pc_dimm_memory_unplug(dev, &spapr->hotplug_memory, mr); object_unparent(OBJECT(dev)); }
{ "code": [ " MemoryRegion *mr = ddc->get_memory_region(dimm);", " MemoryRegion *mr = ddc->get_memory_region(dimm);", " MemoryRegion *mr = ddc->get_memory_region(dimm);", " MemoryRegion *mr = ddc->get_memory_region(dimm);", " MemoryRegion *mr = ddc->get_memory_region(dimm);", " MemoryRegion *mr = ddc->get_memory_region(dimm);", " MemoryRegion *mr = ddc->get_memory_region(dimm);" ], "line_no": [ 11, 11, 11, 11, 11, 11, 11 ] }
void FUNC_0(DeviceState *VAR_0) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_hotplug_handler(VAR_0)); PCDIMMDevice *dimm = PC_DIMM(VAR_0); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(VAR_0)); if (ds == NULL) { ds = spapr_recover_pending_dimm_state(spapr, PC_DIMM(VAR_0)); g_assert(ds); g_assert(ds->nr_lmbs); } if (--ds->nr_lmbs) { return; } spapr_pending_dimm_unplugs_remove(spapr, ds); pc_dimm_memory_unplug(VAR_0, &spapr->hotplug_memory, mr); object_unparent(OBJECT(VAR_0)); }
[ "void FUNC_0(DeviceState *VAR_0)\n{", "sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_hotplug_handler(VAR_0));", "PCDIMMDevice *dimm = PC_DIMM(VAR_0);", "PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);", "MemoryRegion *mr = ddc->get_memory_region(dimm);", "sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(VAR_0));", "if (ds == NULL) {", "ds = spapr_recover_pending_dimm_state(spapr, PC_DIMM(VAR_0));", "g_assert(ds);", "g_assert(ds->nr_lmbs);", "}", "if (--ds->nr_lmbs) {", "return;", "}", "spapr_pending_dimm_unplugs_remove(spapr, ds);", "pc_dimm_memory_unplug(VAR_0, &spapr->hotplug_memory, mr);", "object_unparent(OBJECT(VAR_0));", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 55 ], [ 57 ], [ 59 ] ]
10,975
static void pc_xen_hvm_init(MachineState *machine) { PCIBus *bus; pc_xen_hvm_init_pci(machine); bus = pci_find_primary_bus(); if (bus != NULL) { pci_create_simple(bus, -1, "xen-platform");
true
qemu
a88ae0d44b6b5830b752641b2198735272f13eaf
static void pc_xen_hvm_init(MachineState *machine) { PCIBus *bus; pc_xen_hvm_init_pci(machine); bus = pci_find_primary_bus(); if (bus != NULL) { pci_create_simple(bus, -1, "xen-platform");
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { PCIBus *bus; pc_xen_hvm_init_pci(VAR_0); bus = pci_find_primary_bus(); if (bus != NULL) { pci_create_simple(bus, -1, "xen-platform");
[ "static void FUNC_0(MachineState *VAR_0)\n{", "PCIBus *bus;", "pc_xen_hvm_init_pci(VAR_0);", "bus = pci_find_primary_bus();", "if (bus != NULL) {", "pci_create_simple(bus, -1, \"xen-platform\");" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ]
10,976
static int usb_xhci_post_load(void *opaque, int version_id) { XHCIState *xhci = opaque; PCIDevice *pci_dev = PCI_DEVICE(xhci); XHCISlot *slot; XHCIEPContext *epctx; dma_addr_t dcbaap, pctx; uint32_t slot_ctx[4]; uint32_t ep_ctx[5]; int slotid, epid, state, intr; dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); for (slotid = 1; slotid <= xhci->numslots; slotid++) { slot = &xhci->slots[slotid-1]; if (!slot->addressed) { slot->ctx = xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid)); xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); slot->uport = xhci_lookup_uport(xhci, slot_ctx); assert(slot->uport && slot->uport->dev); for (epid = 1; epid <= 31; epid++) { pctx = slot->ctx + 32 * epid; xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx)); state = ep_ctx[0] & EP_STATE_MASK; if (state == EP_DISABLED) { epctx = xhci_alloc_epctx(xhci, slotid, epid); slot->eps[epid-1] = epctx; xhci_init_epctx(epctx, pctx, ep_ctx); epctx->state = state; if (state == EP_RUNNING) { /* kick endpoint after vmload is finished */ timer_mod(epctx->kick_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); for (intr = 0; intr < xhci->numintrs; intr++) { if (xhci->intr[intr].msix_used) { msix_vector_use(pci_dev, intr); } else { msix_vector_unuse(pci_dev, intr); return 0;
true
qemu
f2ad97ff81da51c064b9e87720ff48a0874f45d4
static int usb_xhci_post_load(void *opaque, int version_id) { XHCIState *xhci = opaque; PCIDevice *pci_dev = PCI_DEVICE(xhci); XHCISlot *slot; XHCIEPContext *epctx; dma_addr_t dcbaap, pctx; uint32_t slot_ctx[4]; uint32_t ep_ctx[5]; int slotid, epid, state, intr; dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); for (slotid = 1; slotid <= xhci->numslots; slotid++) { slot = &xhci->slots[slotid-1]; if (!slot->addressed) { slot->ctx = xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid)); xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); slot->uport = xhci_lookup_uport(xhci, slot_ctx); assert(slot->uport && slot->uport->dev); for (epid = 1; epid <= 31; epid++) { pctx = slot->ctx + 32 * epid; xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx)); state = ep_ctx[0] & EP_STATE_MASK; if (state == EP_DISABLED) { epctx = xhci_alloc_epctx(xhci, slotid, epid); slot->eps[epid-1] = epctx; xhci_init_epctx(epctx, pctx, ep_ctx); epctx->state = state; if (state == EP_RUNNING) { timer_mod(epctx->kick_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); for (intr = 0; intr < xhci->numintrs; intr++) { if (xhci->intr[intr].msix_used) { msix_vector_use(pci_dev, intr); } else { msix_vector_unuse(pci_dev, intr); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, int VAR_1) { XHCIState *xhci = VAR_0; PCIDevice *pci_dev = PCI_DEVICE(xhci); XHCISlot *slot; XHCIEPContext *epctx; dma_addr_t dcbaap, pctx; uint32_t slot_ctx[4]; uint32_t ep_ctx[5]; int VAR_2, VAR_3, VAR_4, VAR_5; dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); for (VAR_2 = 1; VAR_2 <= xhci->numslots; VAR_2++) { slot = &xhci->slots[VAR_2-1]; if (!slot->addressed) { slot->ctx = xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * VAR_2)); xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); slot->uport = xhci_lookup_uport(xhci, slot_ctx); assert(slot->uport && slot->uport->dev); for (VAR_3 = 1; VAR_3 <= 31; VAR_3++) { pctx = slot->ctx + 32 * VAR_3; xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx)); VAR_4 = ep_ctx[0] & EP_STATE_MASK; if (VAR_4 == EP_DISABLED) { epctx = xhci_alloc_epctx(xhci, VAR_2, VAR_3); slot->eps[VAR_3-1] = epctx; xhci_init_epctx(epctx, pctx, ep_ctx); epctx->VAR_4 = VAR_4; if (VAR_4 == EP_RUNNING) { timer_mod(epctx->kick_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); for (VAR_5 = 0; VAR_5 < xhci->numintrs; VAR_5++) { if (xhci->VAR_5[VAR_5].msix_used) { msix_vector_use(pci_dev, VAR_5); } else { msix_vector_unuse(pci_dev, VAR_5); return 0;
[ "static int FUNC_0(void *VAR_0, int VAR_1)\n{", "XHCIState *xhci = VAR_0;", "PCIDevice *pci_dev = PCI_DEVICE(xhci);", "XHCISlot *slot;", "XHCIEPContext *epctx;", "dma_addr_t dcbaap, pctx;", "uint32_t slot_ctx[4];", "uint32_t ep_ctx[5];", "int VAR_2, VAR_3, VAR_4, VAR_5;", "dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);", "for (VAR_2 = 1; VAR_2 <= xhci->numslots; VAR_2++) {", "slot = &xhci->slots[VAR_2-1];", "if (!slot->addressed) {", "slot->ctx =\nxhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * VAR_2));", "xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx));", "slot->uport = xhci_lookup_uport(xhci, slot_ctx);", "assert(slot->uport && slot->uport->dev);", "for (VAR_3 = 1; VAR_3 <= 31; VAR_3++) {", "pctx = slot->ctx + 32 * VAR_3;", "xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx));", "VAR_4 = ep_ctx[0] & EP_STATE_MASK;", "if (VAR_4 == EP_DISABLED) {", "epctx = xhci_alloc_epctx(xhci, VAR_2, VAR_3);", "slot->eps[VAR_3-1] = epctx;", "xhci_init_epctx(epctx, pctx, ep_ctx);", "epctx->VAR_4 = VAR_4;", "if (VAR_4 == EP_RUNNING) {", "timer_mod(epctx->kick_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));", "for (VAR_5 = 0; VAR_5 < xhci->numintrs; VAR_5++) {", "if (xhci->VAR_5[VAR_5].msix_used) {", "msix_vector_use(pci_dev, VAR_5);", "} else {", "msix_vector_unuse(pci_dev, VAR_5);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 98 ] ]
10,977
void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci, MemoryRegion *parent) { ar->tmr.update_sci = update_sci; ar->tmr.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, acpi_pm_tmr_timer, ar); memory_region_init_io(&ar->tmr.io, memory_region_owner(parent), &acpi_pm_tmr_ops, ar, "acpi-tmr", 4); memory_region_clear_global_locking(&ar->tmr.io); memory_region_add_subregion(parent, 8, &ar->tmr.io); }
false
qemu
1beb99f787ba110a9de44254e7d62a1cb9117de8
void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci, MemoryRegion *parent) { ar->tmr.update_sci = update_sci; ar->tmr.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, acpi_pm_tmr_timer, ar); memory_region_init_io(&ar->tmr.io, memory_region_owner(parent), &acpi_pm_tmr_ops, ar, "acpi-tmr", 4); memory_region_clear_global_locking(&ar->tmr.io); memory_region_add_subregion(parent, 8, &ar->tmr.io); }
{ "code": [], "line_no": [] }
void FUNC_0(ACPIREGS *VAR_0, acpi_update_sci_fn VAR_1, MemoryRegion *VAR_2) { VAR_0->tmr.VAR_1 = VAR_1; VAR_0->tmr.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, acpi_pm_tmr_timer, VAR_0); memory_region_init_io(&VAR_0->tmr.io, memory_region_owner(VAR_2), &acpi_pm_tmr_ops, VAR_0, "acpi-tmr", 4); memory_region_clear_global_locking(&VAR_0->tmr.io); memory_region_add_subregion(VAR_2, 8, &VAR_0->tmr.io); }
[ "void FUNC_0(ACPIREGS *VAR_0, acpi_update_sci_fn VAR_1,\nMemoryRegion *VAR_2)\n{", "VAR_0->tmr.VAR_1 = VAR_1;", "VAR_0->tmr.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, acpi_pm_tmr_timer, VAR_0);", "memory_region_init_io(&VAR_0->tmr.io, memory_region_owner(VAR_2),\n&acpi_pm_tmr_ops, VAR_0, \"acpi-tmr\", 4);", "memory_region_clear_global_locking(&VAR_0->tmr.io);", "memory_region_add_subregion(VAR_2, 8, &VAR_0->tmr.io);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ] ]
10,978
INLINE int16 extractFloat32Exp( float32 a ) { return ( a>>23 ) & 0xFF; }
false
qemu
f090c9d4ad5812fb92843d6470a1111c15190c4c
INLINE int16 extractFloat32Exp( float32 a ) { return ( a>>23 ) & 0xFF; }
{ "code": [], "line_no": [] }
INLINE VAR_0 extractFloat32Exp( float32 a ) { return ( a>>23 ) & 0xFF; }
[ "INLINE VAR_0 extractFloat32Exp( float32 a )\n{", "return ( a>>23 ) & 0xFF;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ] ]
10,979
START_TEST(simple_string) { int i; struct { const char *encoded; const char *decoded; } test_cases[] = { { "\"hello world\"", "hello world" }, { "\"the quick brown fox jumped over the fence\"", "the quick brown fox jumped over the fence" }, {} }; for (i = 0; test_cases[i].encoded; i++) { QObject *obj; QString *str; obj = qobject_from_json(test_cases[i].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QSTRING); str = qobject_to_qstring(obj); fail_unless(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0); str = qobject_to_json(obj); fail_unless(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0); qobject_decref(obj); QDECREF(str); } }
false
qemu
ef76dc59fa5203d146a2acf85a0ad5a5971a4824
START_TEST(simple_string) { int i; struct { const char *encoded; const char *decoded; } test_cases[] = { { "\"hello world\"", "hello world" }, { "\"the quick brown fox jumped over the fence\"", "the quick brown fox jumped over the fence" }, {} }; for (i = 0; test_cases[i].encoded; i++) { QObject *obj; QString *str; obj = qobject_from_json(test_cases[i].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QSTRING); str = qobject_to_qstring(obj); fail_unless(strcmp(qstring_get_str(str), test_cases[i].decoded) == 0); str = qobject_to_json(obj); fail_unless(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0); qobject_decref(obj); QDECREF(str); } }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { int VAR_1; struct { const char *encoded; const char *decoded; } VAR_2[] = { { "\"hello world\"", "hello world" }, { "\"the quick brown fox jumped over the fence\"", "the quick brown fox jumped over the fence" }, {} }; for (VAR_1 = 0; VAR_2[VAR_1].encoded; VAR_1++) { QObject *obj; QString *str; obj = qobject_from_json(VAR_2[VAR_1].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QSTRING); str = qobject_to_qstring(obj); fail_unless(strcmp(qstring_get_str(str), VAR_2[VAR_1].decoded) == 0); str = qobject_to_json(obj); fail_unless(strcmp(qstring_get_str(str), VAR_2[VAR_1].encoded) == 0); qobject_decref(obj); QDECREF(str); } }
[ "FUNC_0(VAR_0)\n{", "int VAR_1;", "struct {", "const char *encoded;", "const char *decoded;", "} VAR_2[] = {", "{ \"\\\"hello world\\\"\", \"hello world\" },", "{ \"\\\"the quick brown fox jumped over the fence\\\"\",", "\"the quick brown fox jumped over the fence\" },", "{}", "};", "for (VAR_1 = 0; VAR_2[VAR_1].encoded; VAR_1++) {", "QObject *obj;", "QString *str;", "obj = qobject_from_json(VAR_2[VAR_1].encoded);", "fail_unless(obj != NULL);", "fail_unless(qobject_type(obj) == QTYPE_QSTRING);", "str = qobject_to_qstring(obj);", "fail_unless(strcmp(qstring_get_str(str), VAR_2[VAR_1].decoded) == 0);", "str = qobject_to_json(obj);", "fail_unless(strcmp(qstring_get_str(str), VAR_2[VAR_1].encoded) == 0);", "qobject_decref(obj);", "QDECREF(str);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ] ]
10,980
int decode_luma_residual(const H264Context *h, H264SliceContext *sl, GetBitContext *gb, const uint8_t *scan, const uint8_t *scan8x8, int pixel_shift, int mb_type, int cbp, int p) { int i4x4, i8x8; int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1]; if(IS_INTRA16x16(mb_type)){ AV_ZERO128(sl->mb_luma_dc[p]+0); AV_ZERO128(sl->mb_luma_dc[p]+8); AV_ZERO128(sl->mb_luma_dc[p]+16); AV_ZERO128(sl->mb_luma_dc[p]+24); if (decode_residual(h, sl, gb, sl->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX + p, scan, NULL, 16) < 0) { return -1; //FIXME continue if partitioned and other return -1 too } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8 + p*16; if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){ return -1; } } } return 0xf; }else{ fill_rectangle(&sl->non_zero_count_cache[scan8[p*16]], 4, 4, 8, 0, 1); return 0; } }else{ int cqm = (IS_INTRA( mb_type ) ? 0:3)+p; /* For CAVLC 4:4:4, we need to keep track of the luma 8x8 CBP for deblocking nnz purposes. */ int new_cbp = 0; for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ int16_t *buf = &sl->mb[64*i8x8+256*p << pixel_shift]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8 + p*16; if( decode_residual(h, sl, gb, buf, index, scan8x8+16*i4x4, h->dequant8_coeff[cqm][qscale], 16) < 0 ) return -1; } nnz = &sl->non_zero_count_cache[scan8[4 * i8x8 + p * 16]]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; new_cbp |= !!nnz[0] << i8x8; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8 + p*16; if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, scan, h->dequant4_coeff[cqm][qscale], 16) < 0 ){ return -1; } new_cbp |= sl->non_zero_count_cache[scan8[index]] << i8x8; } } }else{ uint8_t * const nnz = &sl->non_zero_count_cache[scan8[4 * i8x8 + p * 16]]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } return new_cbp; } }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
int decode_luma_residual(const H264Context *h, H264SliceContext *sl, GetBitContext *gb, const uint8_t *scan, const uint8_t *scan8x8, int pixel_shift, int mb_type, int cbp, int p) { int i4x4, i8x8; int qscale = p == 0 ? sl->qscale : sl->chroma_qp[p - 1]; if(IS_INTRA16x16(mb_type)){ AV_ZERO128(sl->mb_luma_dc[p]+0); AV_ZERO128(sl->mb_luma_dc[p]+8); AV_ZERO128(sl->mb_luma_dc[p]+16); AV_ZERO128(sl->mb_luma_dc[p]+24); if (decode_residual(h, sl, gb, sl->mb_luma_dc[p], LUMA_DC_BLOCK_INDEX + p, scan, NULL, 16) < 0) { return -1; } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8 + p*16; if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, scan + 1, h->dequant4_coeff[p][qscale], 15) < 0 ){ return -1; } } } return 0xf; }else{ fill_rectangle(&sl->non_zero_count_cache[scan8[p*16]], 4, 4, 8, 0, 1); return 0; } }else{ int cqm = (IS_INTRA( mb_type ) ? 0:3)+p; int new_cbp = 0; for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ int16_t *buf = &sl->mb[64*i8x8+256*p << pixel_shift]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8 + p*16; if( decode_residual(h, sl, gb, buf, index, scan8x8+16*i4x4, h->dequant8_coeff[cqm][qscale], 16) < 0 ) return -1; } nnz = &sl->non_zero_count_cache[scan8[4 * i8x8 + p * 16]]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; new_cbp |= !!nnz[0] << i8x8; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8 + p*16; if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, scan, h->dequant4_coeff[cqm][qscale], 16) < 0 ){ return -1; } new_cbp |= sl->non_zero_count_cache[scan8[index]] << i8x8; } } }else{ uint8_t * const nnz = &sl->non_zero_count_cache[scan8[4 * i8x8 + p * 16]]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } return new_cbp; } }
{ "code": [], "line_no": [] }
int FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1, GetBitContext *VAR_2, const uint8_t *VAR_3, const uint8_t *VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8) { int VAR_9, VAR_10; int VAR_11 = VAR_8 == 0 ? VAR_1->VAR_11 : VAR_1->chroma_qp[VAR_8 - 1]; if(IS_INTRA16x16(VAR_6)){ AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+0); AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+8); AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+16); AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+24); if (decode_residual(VAR_0, VAR_1, VAR_2, VAR_1->mb_luma_dc[VAR_8], LUMA_DC_BLOCK_INDEX + VAR_8, VAR_3, NULL, 16) < 0) { return -1; } assert((VAR_7&15) == 0 || (VAR_7&15) == 15); if(VAR_7&15){ for(VAR_10=0; VAR_10<4; VAR_10++){ for(VAR_9=0; VAR_9<4; VAR_9++){ const int VAR_15= VAR_9 + 4*VAR_10 + VAR_8*16; if( decode_residual(VAR_0, VAR_1, VAR_2, VAR_1->mb + (16*VAR_15 << VAR_5), VAR_15, VAR_3 + 1, VAR_0->dequant4_coeff[VAR_8][VAR_11], 15) < 0 ){ return -1; } } } return 0xf; }else{ fill_rectangle(&VAR_1->non_zero_count_cache[scan8[VAR_8*16]], 4, 4, 8, 0, 1); return 0; } }else{ int VAR_13 = (IS_INTRA( VAR_6 ) ? 0:3)+VAR_8; int VAR_14 = 0; for(VAR_10=0; VAR_10<4; VAR_10++){ if(VAR_7 & (1<<VAR_10)){ if(IS_8x8DCT(VAR_6)){ int16_t *buf = &VAR_1->mb[64*VAR_10+256*VAR_8 << VAR_5]; uint8_t *nnz; for(VAR_9=0; VAR_9<4; VAR_9++){ const int VAR_15= VAR_9 + 4*VAR_10 + VAR_8*16; if( decode_residual(VAR_0, VAR_1, VAR_2, buf, VAR_15, VAR_4+16*VAR_9, VAR_0->dequant8_coeff[VAR_13][VAR_11], 16) < 0 ) return -1; } nnz = &VAR_1->non_zero_count_cache[scan8[4 * VAR_10 + VAR_8 * 16]]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; VAR_14 |= !!nnz[0] << VAR_10; }else{ for(VAR_9=0; VAR_9<4; VAR_9++){ const int VAR_15= VAR_9 + 4*VAR_10 + VAR_8*16; if( decode_residual(VAR_0, VAR_1, VAR_2, VAR_1->mb + (16*VAR_15 << VAR_5), VAR_15, VAR_3, VAR_0->dequant4_coeff[VAR_13][VAR_11], 16) < 0 ){ return -1; } VAR_14 |= VAR_1->non_zero_count_cache[scan8[VAR_15]] << VAR_10; } } }else{ uint8_t * const nnz = &VAR_1->non_zero_count_cache[scan8[4 * VAR_10 + VAR_8 * 16]]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } return VAR_14; } }
[ "int FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1,\nGetBitContext *VAR_2, const uint8_t *VAR_3,\nconst uint8_t *VAR_4, int VAR_5,\nint VAR_6, int VAR_7, int VAR_8)\n{", "int VAR_9, VAR_10;", "int VAR_11 = VAR_8 == 0 ? VAR_1->VAR_11 : VAR_1->chroma_qp[VAR_8 - 1];", "if(IS_INTRA16x16(VAR_6)){", "AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+0);", "AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+8);", "AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+16);", "AV_ZERO128(VAR_1->mb_luma_dc[VAR_8]+24);", "if (decode_residual(VAR_0, VAR_1, VAR_2, VAR_1->mb_luma_dc[VAR_8], LUMA_DC_BLOCK_INDEX + VAR_8, VAR_3, NULL, 16) < 0) {", "return -1;", "}", "assert((VAR_7&15) == 0 || (VAR_7&15) == 15);", "if(VAR_7&15){", "for(VAR_10=0; VAR_10<4; VAR_10++){", "for(VAR_9=0; VAR_9<4; VAR_9++){", "const int VAR_15= VAR_9 + 4*VAR_10 + VAR_8*16;", "if( decode_residual(VAR_0, VAR_1, VAR_2, VAR_1->mb + (16*VAR_15 << VAR_5),\nVAR_15, VAR_3 + 1, VAR_0->dequant4_coeff[VAR_8][VAR_11], 15) < 0 ){", "return -1;", "}", "}", "}", "return 0xf;", "}else{", "fill_rectangle(&VAR_1->non_zero_count_cache[scan8[VAR_8*16]], 4, 4, 8, 0, 1);", "return 0;", "}", "}else{", "int VAR_13 = (IS_INTRA( VAR_6 ) ? 0:3)+VAR_8;", "int VAR_14 = 0;", "for(VAR_10=0; VAR_10<4; VAR_10++){", "if(VAR_7 & (1<<VAR_10)){", "if(IS_8x8DCT(VAR_6)){", "int16_t *buf = &VAR_1->mb[64*VAR_10+256*VAR_8 << VAR_5];", "uint8_t *nnz;", "for(VAR_9=0; VAR_9<4; VAR_9++){", "const int VAR_15= VAR_9 + 4*VAR_10 + VAR_8*16;", "if( decode_residual(VAR_0, VAR_1, VAR_2, buf, VAR_15, VAR_4+16*VAR_9,\nVAR_0->dequant8_coeff[VAR_13][VAR_11], 16) < 0 )\nreturn -1;", "}", "nnz = &VAR_1->non_zero_count_cache[scan8[4 * VAR_10 + VAR_8 * 16]];", "nnz[0] += nnz[1] + nnz[8] + nnz[9];", "VAR_14 |= !!nnz[0] << VAR_10;", "}else{", "for(VAR_9=0; VAR_9<4; VAR_9++){", "const int VAR_15= VAR_9 + 4*VAR_10 + VAR_8*16;", "if( decode_residual(VAR_0, VAR_1, VAR_2, VAR_1->mb + (16*VAR_15 << VAR_5), VAR_15,\nVAR_3, VAR_0->dequant4_coeff[VAR_13][VAR_11], 16) < 0 ){", "return -1;", "}", "VAR_14 |= VAR_1->non_zero_count_cache[scan8[VAR_15]] << VAR_10;", "}", "}", "}else{", "uint8_t * const nnz = &VAR_1->non_zero_count_cache[scan8[4 * VAR_10 + VAR_8 * 16]];", "nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;", "}", "}", "return VAR_14;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ] ]
10,981
static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) { nuv_frametype frametype; if (!vst && !myth) return 1; // no codec data needed while (!avio_feof(pb)) { int size, subtype; frametype = avio_r8(pb); switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { if (vst->codecpar->extradata) { av_freep(&vst->codecpar->extradata); vst->codecpar->extradata_size = 0; } if (ff_get_extradata(NULL, vst->codecpar, pb, size) < 0) return AVERROR(ENOMEM); size = 0; if (!myth) return 0; } break; case NUV_MYTHEXT: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; avio_rl32(pb); // version if (vst) { vst->codecpar->codec_tag = avio_rl32(pb); vst->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, vst->codecpar->codec_tag); if (vst->codecpar->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codecpar->codec_id = AV_CODEC_ID_NUV; } else avio_skip(pb, 4); if (ast) { int id; ast->codecpar->codec_tag = avio_rl32(pb); ast->codecpar->sample_rate = avio_rl32(pb); ast->codecpar->bits_per_coded_sample = avio_rl32(pb); ast->codecpar->channels = avio_rl32(pb); ast->codecpar->channel_layout = 0; id = ff_wav_codec_get_id(ast->codecpar->codec_tag, ast->codecpar->bits_per_coded_sample); if (id == AV_CODEC_ID_NONE) { id = ff_codec_get_id(nuv_audio_tags, ast->codecpar->codec_tag); if (id == AV_CODEC_ID_PCM_S16LE) id = ff_get_pcm_codec_id(ast->codecpar->bits_per_coded_sample, 0, 0, ~1); } ast->codecpar->codec_id = id; ast->need_parsing = AVSTREAM_PARSE_FULL; } else avio_skip(pb, 4 * 4); size -= 6 * 4; avio_skip(pb, size); return 0; case NUV_SEEKP: size = 11; break; default: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); break; } avio_skip(pb, size); } return 0; }
false
FFmpeg
f748e3b5a219061db021d8b6b7ebb097c65f23c5
static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) { nuv_frametype frametype; if (!vst && !myth) return 1; while (!avio_feof(pb)) { int size, subtype; frametype = avio_r8(pb); switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { if (vst->codecpar->extradata) { av_freep(&vst->codecpar->extradata); vst->codecpar->extradata_size = 0; } if (ff_get_extradata(NULL, vst->codecpar, pb, size) < 0) return AVERROR(ENOMEM); size = 0; if (!myth) return 0; } break; case NUV_MYTHEXT: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; avio_rl32(pb); if (vst) { vst->codecpar->codec_tag = avio_rl32(pb); vst->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, vst->codecpar->codec_tag); if (vst->codecpar->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codecpar->codec_id = AV_CODEC_ID_NUV; } else avio_skip(pb, 4); if (ast) { int id; ast->codecpar->codec_tag = avio_rl32(pb); ast->codecpar->sample_rate = avio_rl32(pb); ast->codecpar->bits_per_coded_sample = avio_rl32(pb); ast->codecpar->channels = avio_rl32(pb); ast->codecpar->channel_layout = 0; id = ff_wav_codec_get_id(ast->codecpar->codec_tag, ast->codecpar->bits_per_coded_sample); if (id == AV_CODEC_ID_NONE) { id = ff_codec_get_id(nuv_audio_tags, ast->codecpar->codec_tag); if (id == AV_CODEC_ID_PCM_S16LE) id = ff_get_pcm_codec_id(ast->codecpar->bits_per_coded_sample, 0, 0, ~1); } ast->codecpar->codec_id = id; ast->need_parsing = AVSTREAM_PARSE_FULL; } else avio_skip(pb, 4 * 4); size -= 6 * 4; avio_skip(pb, size); return 0; case NUV_SEEKP: size = 11; break; default: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); break; } avio_skip(pb, size); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1, AVStream *VAR_2, int VAR_3) { nuv_frametype frametype; if (!VAR_1 && !VAR_3) return 1; while (!avio_feof(VAR_0)) { int VAR_4, VAR_5; frametype = avio_r8(VAR_0); switch (frametype) { case NUV_EXTRADATA: VAR_5 = avio_r8(VAR_0); avio_skip(VAR_0, 6); VAR_4 = PKTSIZE(avio_rl32(VAR_0)); if (VAR_1 && VAR_5 == 'R') { if (VAR_1->codecpar->extradata) { av_freep(&VAR_1->codecpar->extradata); VAR_1->codecpar->extradata_size = 0; } if (ff_get_extradata(NULL, VAR_1->codecpar, VAR_0, VAR_4) < 0) return AVERROR(ENOMEM); VAR_4 = 0; if (!VAR_3) return 0; } break; case NUV_MYTHEXT: avio_skip(VAR_0, 7); VAR_4 = PKTSIZE(avio_rl32(VAR_0)); if (VAR_4 != 128 * 4) break; avio_rl32(VAR_0); if (VAR_1) { VAR_1->codecpar->codec_tag = avio_rl32(VAR_0); VAR_1->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, VAR_1->codecpar->codec_tag); if (VAR_1->codecpar->codec_tag == MKTAG('R', 'J', 'P', 'G')) VAR_1->codecpar->codec_id = AV_CODEC_ID_NUV; } else avio_skip(VAR_0, 4); if (VAR_2) { int VAR_6; VAR_2->codecpar->codec_tag = avio_rl32(VAR_0); VAR_2->codecpar->sample_rate = avio_rl32(VAR_0); VAR_2->codecpar->bits_per_coded_sample = avio_rl32(VAR_0); VAR_2->codecpar->channels = avio_rl32(VAR_0); VAR_2->codecpar->channel_layout = 0; VAR_6 = ff_wav_codec_get_id(VAR_2->codecpar->codec_tag, VAR_2->codecpar->bits_per_coded_sample); if (VAR_6 == AV_CODEC_ID_NONE) { VAR_6 = ff_codec_get_id(nuv_audio_tags, VAR_2->codecpar->codec_tag); if (VAR_6 == AV_CODEC_ID_PCM_S16LE) VAR_6 = ff_get_pcm_codec_id(VAR_2->codecpar->bits_per_coded_sample, 0, 0, ~1); } VAR_2->codecpar->codec_id = VAR_6; VAR_2->need_parsing = AVSTREAM_PARSE_FULL; } else avio_skip(VAR_0, 4 * 4); VAR_4 -= 6 * 4; avio_skip(VAR_0, VAR_4); return 0; case NUV_SEEKP: VAR_4 = 11; break; default: avio_skip(VAR_0, 7); VAR_4 = PKTSIZE(avio_rl32(VAR_0)); break; } avio_skip(VAR_0, VAR_4); } return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1,\nAVStream *VAR_2, int VAR_3)\n{", "nuv_frametype frametype;", "if (!VAR_1 && !VAR_3)\nreturn 1;", "while (!avio_feof(VAR_0)) {", "int VAR_4, VAR_5;", "frametype = avio_r8(VAR_0);", "switch (frametype) {", "case NUV_EXTRADATA:\nVAR_5 = avio_r8(VAR_0);", "avio_skip(VAR_0, 6);", "VAR_4 = PKTSIZE(avio_rl32(VAR_0));", "if (VAR_1 && VAR_5 == 'R') {", "if (VAR_1->codecpar->extradata) {", "av_freep(&VAR_1->codecpar->extradata);", "VAR_1->codecpar->extradata_size = 0;", "}", "if (ff_get_extradata(NULL, VAR_1->codecpar, VAR_0, VAR_4) < 0)\nreturn AVERROR(ENOMEM);", "VAR_4 = 0;", "if (!VAR_3)\nreturn 0;", "}", "break;", "case NUV_MYTHEXT:\navio_skip(VAR_0, 7);", "VAR_4 = PKTSIZE(avio_rl32(VAR_0));", "if (VAR_4 != 128 * 4)\nbreak;", "avio_rl32(VAR_0);", "if (VAR_1) {", "VAR_1->codecpar->codec_tag = avio_rl32(VAR_0);", "VAR_1->codecpar->codec_id =\nff_codec_get_id(ff_codec_bmp_tags, VAR_1->codecpar->codec_tag);", "if (VAR_1->codecpar->codec_tag == MKTAG('R', 'J', 'P', 'G'))\nVAR_1->codecpar->codec_id = AV_CODEC_ID_NUV;", "} else", "avio_skip(VAR_0, 4);", "if (VAR_2) {", "int VAR_6;", "VAR_2->codecpar->codec_tag = avio_rl32(VAR_0);", "VAR_2->codecpar->sample_rate = avio_rl32(VAR_0);", "VAR_2->codecpar->bits_per_coded_sample = avio_rl32(VAR_0);", "VAR_2->codecpar->channels = avio_rl32(VAR_0);", "VAR_2->codecpar->channel_layout = 0;", "VAR_6 = ff_wav_codec_get_id(VAR_2->codecpar->codec_tag,\nVAR_2->codecpar->bits_per_coded_sample);", "if (VAR_6 == AV_CODEC_ID_NONE) {", "VAR_6 = ff_codec_get_id(nuv_audio_tags, VAR_2->codecpar->codec_tag);", "if (VAR_6 == AV_CODEC_ID_PCM_S16LE)\nVAR_6 = ff_get_pcm_codec_id(VAR_2->codecpar->bits_per_coded_sample,\n0, 0, ~1);", "}", "VAR_2->codecpar->codec_id = VAR_6;", "VAR_2->need_parsing = AVSTREAM_PARSE_FULL;", "} else", "avio_skip(VAR_0, 4 * 4);", "VAR_4 -= 6 * 4;", "avio_skip(VAR_0, VAR_4);", "return 0;", "case NUV_SEEKP:\nVAR_4 = 11;", "break;", "default:\navio_skip(VAR_0, 7);", "VAR_4 = PKTSIZE(avio_rl32(VAR_0));", "break;", "}", "avio_skip(VAR_0, VAR_4);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113, 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ] ]
10,983
ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr, ram_addr_t start) { unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS; unsigned long nr = base + (start >> TARGET_PAGE_BITS); uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr)); unsigned long size = base + (mr_size >> TARGET_PAGE_BITS); unsigned long next; if (ram_bulk_stage && nr > base) { next = nr + 1; } else { next = find_next_bit(migration_bitmap, size, nr); } if (next < size) { clear_bit(next, migration_bitmap); migration_dirty_pages--; } return (next - base) << TARGET_PAGE_BITS; }
false
qemu
2ff64038a59e8de2baa485806be0838f49f70b79
ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr, ram_addr_t start) { unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS; unsigned long nr = base + (start >> TARGET_PAGE_BITS); uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr)); unsigned long size = base + (mr_size >> TARGET_PAGE_BITS); unsigned long next; if (ram_bulk_stage && nr > base) { next = nr + 1; } else { next = find_next_bit(migration_bitmap, size, nr); } if (next < size) { clear_bit(next, migration_bitmap); migration_dirty_pages--; } return (next - base) << TARGET_PAGE_BITS; }
{ "code": [], "line_no": [] }
ram_addr_t FUNC_0(MemoryRegion *mr, ram_addr_t start) { unsigned long VAR_0 = mr->ram_addr >> TARGET_PAGE_BITS; unsigned long VAR_1 = VAR_0 + (start >> TARGET_PAGE_BITS); uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr)); unsigned long VAR_2 = VAR_0 + (mr_size >> TARGET_PAGE_BITS); unsigned long VAR_3; if (ram_bulk_stage && VAR_1 > VAR_0) { VAR_3 = VAR_1 + 1; } else { VAR_3 = find_next_bit(migration_bitmap, VAR_2, VAR_1); } if (VAR_3 < VAR_2) { clear_bit(VAR_3, migration_bitmap); migration_dirty_pages--; } return (VAR_3 - VAR_0) << TARGET_PAGE_BITS; }
[ "ram_addr_t FUNC_0(MemoryRegion *mr,\nram_addr_t start)\n{", "unsigned long VAR_0 = mr->ram_addr >> TARGET_PAGE_BITS;", "unsigned long VAR_1 = VAR_0 + (start >> TARGET_PAGE_BITS);", "uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr));", "unsigned long VAR_2 = VAR_0 + (mr_size >> TARGET_PAGE_BITS);", "unsigned long VAR_3;", "if (ram_bulk_stage && VAR_1 > VAR_0) {", "VAR_3 = VAR_1 + 1;", "} else {", "VAR_3 = find_next_bit(migration_bitmap, VAR_2, VAR_1);", "}", "if (VAR_3 < VAR_2) {", "clear_bit(VAR_3, migration_bitmap);", "migration_dirty_pages--;", "}", "return (VAR_3 - VAR_0) << TARGET_PAGE_BITS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
10,985
static uint64_t unassigned_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem read " TARGET_FMT_plx "\n", addr); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, addr, 0, 0, 0, size); #endif return 0; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t unassigned_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem read " TARGET_FMT_plx "\n", addr); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, addr, 0, 0, 0, size); #endif return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem read " TARGET_FMT_plx "\n", addr); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, addr, 0, 0, 0, size); #endif return 0; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "#ifdef DEBUG_UNASSIGNED\nprintf(\"Unassigned mem read \" TARGET_FMT_plx \"\\n\", addr);", "#endif\n#if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)\ncpu_unassigned_access(cpu_single_env, addr, 0, 0, 0, size);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11, 13, 15 ], [ 17, 19 ], [ 21 ] ]
10,987
build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets, const char *oem_id, const char *oem_table_id) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int i; const int table_data_len = (sizeof(uint32_t) * table_offsets->len); rsdt_len = sizeof(*rsdt) + table_data_len; rsdt = acpi_data_push(table_data, rsdt_len); memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len); for (i = 0; i < table_offsets->len; ++i) { /* rsdt->table_offset_entry to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_FILE, table_data, &rsdt->table_offset_entry[i], sizeof(uint32_t)); } build_header(linker, table_data, (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id); }
false
qemu
0e9b9edae7bebfd31fdbead4ccbbce03876a7edd
build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets, const char *oem_id, const char *oem_table_id) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int i; const int table_data_len = (sizeof(uint32_t) * table_offsets->len); rsdt_len = sizeof(*rsdt) + table_data_len; rsdt = acpi_data_push(table_data, rsdt_len); memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len); for (i = 0; i < table_offsets->len; ++i) { bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_FILE, table_data, &rsdt->table_offset_entry[i], sizeof(uint32_t)); } build_header(linker, table_data, (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, GArray *VAR_1, GArray *VAR_2, const char *VAR_3, const char *VAR_4) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int VAR_5; const int VAR_6 = (sizeof(uint32_t) * VAR_2->len); rsdt_len = sizeof(*rsdt) + VAR_6; rsdt = acpi_data_push(VAR_0, rsdt_len); memcpy(rsdt->table_offset_entry, VAR_2->data, VAR_6); for (VAR_5 = 0; VAR_5 < VAR_2->len; ++VAR_5) { bios_linker_loader_add_pointer(VAR_1, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_FILE, VAR_0, &rsdt->table_offset_entry[VAR_5], sizeof(uint32_t)); } build_header(VAR_1, VAR_0, (void *)rsdt, "RSDT", rsdt_len, 1, VAR_3, VAR_4); }
[ "FUNC_0(GArray *VAR_0, GArray *VAR_1, GArray *VAR_2,\nconst char *VAR_3, const char *VAR_4)\n{", "AcpiRsdtDescriptorRev1 *rsdt;", "size_t rsdt_len;", "int VAR_5;", "const int VAR_6 = (sizeof(uint32_t) * VAR_2->len);", "rsdt_len = sizeof(*rsdt) + VAR_6;", "rsdt = acpi_data_push(VAR_0, rsdt_len);", "memcpy(rsdt->table_offset_entry, VAR_2->data, VAR_6);", "for (VAR_5 = 0; VAR_5 < VAR_2->len; ++VAR_5) {", "bios_linker_loader_add_pointer(VAR_1,\nACPI_BUILD_TABLE_FILE,\nACPI_BUILD_TABLE_FILE,\nVAR_0, &rsdt->table_offset_entry[VAR_5],\nsizeof(uint32_t));", "}", "build_header(VAR_1, VAR_0,\n(void *)rsdt, \"RSDT\", rsdt_len, 1, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ] ]
10,988
static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset, int width, int be) { target_phys_addr_t boff; uint32_t ret; uint8_t *p; DPRINTF("%s: offset " TARGET_FMT_plx "\n", __func__, offset); ret = -1; if (pfl->rom_mode) { /* Lazy reset of to ROMD mode */ if (pfl->wcycle == 0) pflash_register_memory(pfl, 1); } offset &= pfl->chip_len - 1; boff = offset & 0xFF; if (pfl->width == 2) boff = boff >> 1; else if (pfl->width == 4) boff = boff >> 2; switch (pfl->cmd) { default: /* This should never happen : reset state & treat it as a read*/ DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd); pfl->wcycle = 0; pfl->cmd = 0; case 0x80: /* We accept reads during second unlock sequence... */ case 0x00: flash_read: /* Flash area read */ p = pfl->storage; switch (width) { case 1: ret = p[offset]; // DPRINTF("%s: data offset %08x %02x\n", __func__, offset, ret); break; case 2: if (be) { ret = p[offset] << 8; ret |= p[offset + 1]; } else { ret = p[offset]; ret |= p[offset + 1] << 8; } // DPRINTF("%s: data offset %08x %04x\n", __func__, offset, ret); break; case 4: if (be) { ret = p[offset] << 24; ret |= p[offset + 1] << 16; ret |= p[offset + 2] << 8; ret |= p[offset + 3]; } else { ret = p[offset]; ret |= p[offset + 1] << 8; ret |= p[offset + 2] << 16; ret |= p[offset + 3] << 24; } // DPRINTF("%s: data offset %08x %08x\n", __func__, offset, ret); break; } break; case 0x90: /* flash ID read */ switch (boff) { case 0x00: case 0x01: ret = pfl->ident[boff & 0x01]; break; case 0x02: ret = 0x00; /* Pretend all sectors are unprotected */ break; case 0x0E: case 0x0F: if (pfl->ident[2 + (boff & 0x01)] == (uint8_t)-1) goto flash_read; ret = pfl->ident[2 + (boff & 0x01)]; break; default: goto flash_read; } DPRINTF("%s: ID " TARGET_FMT_pld " %x\n", __func__, boff, ret); break; case 0xA0: case 0x10: case 0x30: /* Status register read */ ret = pfl->status; DPRINTF("%s: status %x\n", __func__, ret); /* Toggle bit 6 */ pfl->status ^= 0x40; break; case 0x98: /* CFI query mode */ if (boff > pfl->cfi_len) ret = 0; else ret = pfl->cfi_table[boff]; break; } return ret; }
false
qemu
5145b3d1cc4dc77d82086d99b0690a76e1073071
static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset, int width, int be) { target_phys_addr_t boff; uint32_t ret; uint8_t *p; DPRINTF("%s: offset " TARGET_FMT_plx "\n", __func__, offset); ret = -1; if (pfl->rom_mode) { if (pfl->wcycle == 0) pflash_register_memory(pfl, 1); } offset &= pfl->chip_len - 1; boff = offset & 0xFF; if (pfl->width == 2) boff = boff >> 1; else if (pfl->width == 4) boff = boff >> 2; switch (pfl->cmd) { default: DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd); pfl->wcycle = 0; pfl->cmd = 0; case 0x80: case 0x00: flash_read: p = pfl->storage; switch (width) { case 1: ret = p[offset]; break; case 2: if (be) { ret = p[offset] << 8; ret |= p[offset + 1]; } else { ret = p[offset]; ret |= p[offset + 1] << 8; } break; case 4: if (be) { ret = p[offset] << 24; ret |= p[offset + 1] << 16; ret |= p[offset + 2] << 8; ret |= p[offset + 3]; } else { ret = p[offset]; ret |= p[offset + 1] << 8; ret |= p[offset + 2] << 16; ret |= p[offset + 3] << 24; } break; } break; case 0x90: switch (boff) { case 0x00: case 0x01: ret = pfl->ident[boff & 0x01]; break; case 0x02: ret = 0x00; break; case 0x0E: case 0x0F: if (pfl->ident[2 + (boff & 0x01)] == (uint8_t)-1) goto flash_read; ret = pfl->ident[2 + (boff & 0x01)]; break; default: goto flash_read; } DPRINTF("%s: ID " TARGET_FMT_pld " %x\n", __func__, boff, ret); break; case 0xA0: case 0x10: case 0x30: ret = pfl->status; DPRINTF("%s: status %x\n", __func__, ret); pfl->status ^= 0x40; break; case 0x98: if (boff > pfl->cfi_len) ret = 0; else ret = pfl->cfi_table[boff]; break; } return ret; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0 (pflash_t *pfl, target_phys_addr_t offset, int width, int be) { target_phys_addr_t boff; uint32_t ret; uint8_t *p; DPRINTF("%s: offset " TARGET_FMT_plx "\n", __func__, offset); ret = -1; if (pfl->rom_mode) { if (pfl->wcycle == 0) pflash_register_memory(pfl, 1); } offset &= pfl->chip_len - 1; boff = offset & 0xFF; if (pfl->width == 2) boff = boff >> 1; else if (pfl->width == 4) boff = boff >> 2; switch (pfl->cmd) { default: DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd); pfl->wcycle = 0; pfl->cmd = 0; case 0x80: case 0x00: flash_read: p = pfl->storage; switch (width) { case 1: ret = p[offset]; break; case 2: if (be) { ret = p[offset] << 8; ret |= p[offset + 1]; } else { ret = p[offset]; ret |= p[offset + 1] << 8; } break; case 4: if (be) { ret = p[offset] << 24; ret |= p[offset + 1] << 16; ret |= p[offset + 2] << 8; ret |= p[offset + 3]; } else { ret = p[offset]; ret |= p[offset + 1] << 8; ret |= p[offset + 2] << 16; ret |= p[offset + 3] << 24; } break; } break; case 0x90: switch (boff) { case 0x00: case 0x01: ret = pfl->ident[boff & 0x01]; break; case 0x02: ret = 0x00; break; case 0x0E: case 0x0F: if (pfl->ident[2 + (boff & 0x01)] == (uint8_t)-1) goto flash_read; ret = pfl->ident[2 + (boff & 0x01)]; break; default: goto flash_read; } DPRINTF("%s: ID " TARGET_FMT_pld " %x\n", __func__, boff, ret); break; case 0xA0: case 0x10: case 0x30: ret = pfl->status; DPRINTF("%s: status %x\n", __func__, ret); pfl->status ^= 0x40; break; case 0x98: if (boff > pfl->cfi_len) ret = 0; else ret = pfl->cfi_table[boff]; break; } return ret; }
[ "static uint32_t FUNC_0 (pflash_t *pfl, target_phys_addr_t offset,\nint width, int be)\n{", "target_phys_addr_t boff;", "uint32_t ret;", "uint8_t *p;", "DPRINTF(\"%s: offset \" TARGET_FMT_plx \"\\n\", __func__, offset);", "ret = -1;", "if (pfl->rom_mode) {", "if (pfl->wcycle == 0)\npflash_register_memory(pfl, 1);", "}", "offset &= pfl->chip_len - 1;", "boff = offset & 0xFF;", "if (pfl->width == 2)\nboff = boff >> 1;", "else if (pfl->width == 4)\nboff = boff >> 2;", "switch (pfl->cmd) {", "default:\nDPRINTF(\"%s: unknown command state: %x\\n\", __func__, pfl->cmd);", "pfl->wcycle = 0;", "pfl->cmd = 0;", "case 0x80:\ncase 0x00:\nflash_read:\np = pfl->storage;", "switch (width) {", "case 1:\nret = p[offset];", "break;", "case 2:\nif (be) {", "ret = p[offset] << 8;", "ret |= p[offset + 1];", "} else {", "ret = p[offset];", "ret |= p[offset + 1] << 8;", "}", "break;", "case 4:\nif (be) {", "ret = p[offset] << 24;", "ret |= p[offset + 1] << 16;", "ret |= p[offset + 2] << 8;", "ret |= p[offset + 3];", "} else {", "ret = p[offset];", "ret |= p[offset + 1] << 8;", "ret |= p[offset + 2] << 16;", "ret |= p[offset + 3] << 24;", "}", "break;", "}", "break;", "case 0x90:\nswitch (boff) {", "case 0x00:\ncase 0x01:\nret = pfl->ident[boff & 0x01];", "break;", "case 0x02:\nret = 0x00;", "break;", "case 0x0E:\ncase 0x0F:\nif (pfl->ident[2 + (boff & 0x01)] == (uint8_t)-1)\ngoto flash_read;", "ret = pfl->ident[2 + (boff & 0x01)];", "break;", "default:\ngoto flash_read;", "}", "DPRINTF(\"%s: ID \" TARGET_FMT_pld \" %x\\n\", __func__, boff, ret);", "break;", "case 0xA0:\ncase 0x10:\ncase 0x30:\nret = pfl->status;", "DPRINTF(\"%s: status %x\\n\", __func__, ret);", "pfl->status ^= 0x40;", "break;", "case 0x98:\nif (boff > pfl->cfi_len)\nret = 0;", "else\nret = pfl->cfi_table[boff];", "break;", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43, 47 ], [ 49 ], [ 51 ], [ 53, 57, 59, 63 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 131 ], [ 133, 135, 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147, 149, 151, 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171, 173, 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187, 191, 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ] ]
10,989
static void disable_logging(void) { ga_disable_logging(ga_state); }
false
qemu
f22d85e9e67262db34504f4079745f9843da6a92
static void disable_logging(void) { ga_disable_logging(ga_state); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { ga_disable_logging(ga_state); }
[ "static void FUNC_0(void)\n{", "ga_disable_logging(ga_state);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
10,990
int r4k_map_address (CPUMIPSState *env, hwaddr *physical, int *prot, target_ulong address, int rw, int access_type) { uint8_t ASID = env->CP0_EntryHi & 0xFF; int i; for (i = 0; i < env->tlb->tlb_in_use; i++) { r4k_tlb_t *tlb = &env->tlb->mmu.r4k.tlb[i]; /* 1k pages are not supported. */ target_ulong mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1); target_ulong tag = address & ~mask; target_ulong VPN = tlb->VPN & ~mask; #if defined(TARGET_MIPS64) tag &= env->SEGMask; #endif /* Check ASID, virtual page number & size */ if ((tlb->G == 1 || tlb->ASID == ASID) && VPN == tag) { /* TLB match */ int n = !!(address & mask & ~(mask >> 1)); /* Check access rights */ if (!(n ? tlb->V1 : tlb->V0)) { return TLBRET_INVALID; } if (rw == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) { return TLBRET_XI; } if (rw == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) { return TLBRET_RI; } if (rw != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) { *physical = tlb->PFN[n] | (address & (mask >> 1)); *prot = PAGE_READ; if (n ? tlb->D1 : tlb->D0) *prot |= PAGE_WRITE; return TLBRET_MATCH; } return TLBRET_DIRTY; } } return TLBRET_NOMATCH; }
false
qemu
9456c2fbcd82dd82328ac6e7602a815582b1043e
int r4k_map_address (CPUMIPSState *env, hwaddr *physical, int *prot, target_ulong address, int rw, int access_type) { uint8_t ASID = env->CP0_EntryHi & 0xFF; int i; for (i = 0; i < env->tlb->tlb_in_use; i++) { r4k_tlb_t *tlb = &env->tlb->mmu.r4k.tlb[i]; target_ulong mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1); target_ulong tag = address & ~mask; target_ulong VPN = tlb->VPN & ~mask; #if defined(TARGET_MIPS64) tag &= env->SEGMask; #endif if ((tlb->G == 1 || tlb->ASID == ASID) && VPN == tag) { int n = !!(address & mask & ~(mask >> 1)); if (!(n ? tlb->V1 : tlb->V0)) { return TLBRET_INVALID; } if (rw == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) { return TLBRET_XI; } if (rw == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) { return TLBRET_RI; } if (rw != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) { *physical = tlb->PFN[n] | (address & (mask >> 1)); *prot = PAGE_READ; if (n ? tlb->D1 : tlb->D0) *prot |= PAGE_WRITE; return TLBRET_MATCH; } return TLBRET_DIRTY; } } return TLBRET_NOMATCH; }
{ "code": [], "line_no": [] }
int FUNC_0 (CPUMIPSState *VAR_0, hwaddr *VAR_1, int *VAR_2, target_ulong VAR_3, int VAR_4, int VAR_5) { uint8_t ASID = VAR_0->CP0_EntryHi & 0xFF; int VAR_6; for (VAR_6 = 0; VAR_6 < VAR_0->tlb->tlb_in_use; VAR_6++) { r4k_tlb_t *tlb = &VAR_0->tlb->mmu.r4k.tlb[VAR_6]; target_ulong mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1); target_ulong tag = VAR_3 & ~mask; target_ulong VPN = tlb->VPN & ~mask; #if defined(TARGET_MIPS64) tag &= VAR_0->SEGMask; #endif if ((tlb->G == 1 || tlb->ASID == ASID) && VPN == tag) { int n = !!(VAR_3 & mask & ~(mask >> 1)); if (!(n ? tlb->V1 : tlb->V0)) { return TLBRET_INVALID; } if (VAR_4 == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) { return TLBRET_XI; } if (VAR_4 == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) { return TLBRET_RI; } if (VAR_4 != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) { *VAR_1 = tlb->PFN[n] | (VAR_3 & (mask >> 1)); *VAR_2 = PAGE_READ; if (n ? tlb->D1 : tlb->D0) *VAR_2 |= PAGE_WRITE; return TLBRET_MATCH; } return TLBRET_DIRTY; } } return TLBRET_NOMATCH; }
[ "int FUNC_0 (CPUMIPSState *VAR_0, hwaddr *VAR_1, int *VAR_2,\ntarget_ulong VAR_3, int VAR_4, int VAR_5)\n{", "uint8_t ASID = VAR_0->CP0_EntryHi & 0xFF;", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < VAR_0->tlb->tlb_in_use; VAR_6++) {", "r4k_tlb_t *tlb = &VAR_0->tlb->mmu.r4k.tlb[VAR_6];", "target_ulong mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1);", "target_ulong tag = VAR_3 & ~mask;", "target_ulong VPN = tlb->VPN & ~mask;", "#if defined(TARGET_MIPS64)\ntag &= VAR_0->SEGMask;", "#endif\nif ((tlb->G == 1 || tlb->ASID == ASID) && VPN == tag) {", "int n = !!(VAR_3 & mask & ~(mask >> 1));", "if (!(n ? tlb->V1 : tlb->V0)) {", "return TLBRET_INVALID;", "}", "if (VAR_4 == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) {", "return TLBRET_XI;", "}", "if (VAR_4 == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) {", "return TLBRET_RI;", "}", "if (VAR_4 != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) {", "*VAR_1 = tlb->PFN[n] | (VAR_3 & (mask >> 1));", "*VAR_2 = PAGE_READ;", "if (n ? tlb->D1 : tlb->D0)\n*VAR_2 |= PAGE_WRITE;", "return TLBRET_MATCH;", "}", "return TLBRET_DIRTY;", "}", "}", "return TLBRET_NOMATCH;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
10,991
GArray *bios_linker_loader_init(void) { return g_array_new(false, true /* clear */, 1); }
false
qemu
0e9b9edae7bebfd31fdbead4ccbbce03876a7edd
GArray *bios_linker_loader_init(void) { return g_array_new(false, true , 1); }
{ "code": [], "line_no": [] }
GArray *FUNC_0(void) { return g_array_new(false, true , 1); }
[ "GArray *FUNC_0(void)\n{", "return g_array_new(false, true , 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
10,993
static void exynos4210_fimd_update(void *opaque) { Exynos4210fimdState *s = (Exynos4210fimdState *)opaque; Exynos4210fimdWindow *w; int i, line; target_phys_addr_t fb_line_addr, inc_size; int scrn_height; int first_line = -1, last_line = -1, scrn_width; bool blend = false; uint8_t *host_fb_addr; bool is_dirty = false; const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1; const int global_height = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) & FIMD_VIDTCON2_SIZE_MASK) + 1; if (!s || !s->console || !ds_get_bits_per_pixel(s->console) || !s->enabled) { return; } exynos4210_update_resolution(s); for (i = 0; i < NUM_OF_WINDOWS; i++) { w = &s->window[i]; if ((w->wincon & FIMD_WINCON_ENWIN) && w->host_fb_addr) { scrn_height = w->rightbot_y - w->lefttop_y + 1; scrn_width = w->virtpage_width; /* Total width of virtual screen page in bytes */ inc_size = scrn_width + w->virtpage_offsize; memory_region_sync_dirty_bitmap(w->mem_section.mr); host_fb_addr = w->host_fb_addr; fb_line_addr = w->mem_section.offset_within_region; for (line = 0; line < scrn_height; line++) { is_dirty = memory_region_get_dirty(w->mem_section.mr, fb_line_addr, scrn_width, DIRTY_MEMORY_VGA); if (s->invalidate || is_dirty) { if (first_line == -1) { first_line = line; } last_line = line; w->draw_line(w, host_fb_addr, s->ifb + w->lefttop_x * RGBA_SIZE + (w->lefttop_y + line) * global_width * RGBA_SIZE, blend); } host_fb_addr += inc_size; fb_line_addr += inc_size; is_dirty = false; } memory_region_reset_dirty(w->mem_section.mr, w->mem_section.offset_within_region, w->fb_len, DIRTY_MEMORY_VGA); blend = true; } } /* Copy resulting image to QEMU_CONSOLE. */ if (first_line >= 0) { uint8_t *d; int bpp; bpp = ds_get_bits_per_pixel(s->console); fimd_update_putpix_qemu(bpp); bpp = (bpp + 1) >> 3; d = ds_get_data(s->console); for (line = first_line; line <= last_line; line++) { fimd_copy_line_toqemu(global_width, s->ifb + global_width * line * RGBA_SIZE, d + global_width * line * bpp); } dpy_update(s->console, 0, 0, global_width, global_height); } s->invalidate = false; s->vidintcon[1] |= FIMD_VIDINT_INTFRMPEND; if ((s->vidcon[0] & FIMD_VIDCON0_ENVID_F) == 0) { exynos4210_fimd_enable(s, false); } exynos4210_fimd_update_irq(s); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void exynos4210_fimd_update(void *opaque) { Exynos4210fimdState *s = (Exynos4210fimdState *)opaque; Exynos4210fimdWindow *w; int i, line; target_phys_addr_t fb_line_addr, inc_size; int scrn_height; int first_line = -1, last_line = -1, scrn_width; bool blend = false; uint8_t *host_fb_addr; bool is_dirty = false; const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1; const int global_height = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) & FIMD_VIDTCON2_SIZE_MASK) + 1; if (!s || !s->console || !ds_get_bits_per_pixel(s->console) || !s->enabled) { return; } exynos4210_update_resolution(s); for (i = 0; i < NUM_OF_WINDOWS; i++) { w = &s->window[i]; if ((w->wincon & FIMD_WINCON_ENWIN) && w->host_fb_addr) { scrn_height = w->rightbot_y - w->lefttop_y + 1; scrn_width = w->virtpage_width; inc_size = scrn_width + w->virtpage_offsize; memory_region_sync_dirty_bitmap(w->mem_section.mr); host_fb_addr = w->host_fb_addr; fb_line_addr = w->mem_section.offset_within_region; for (line = 0; line < scrn_height; line++) { is_dirty = memory_region_get_dirty(w->mem_section.mr, fb_line_addr, scrn_width, DIRTY_MEMORY_VGA); if (s->invalidate || is_dirty) { if (first_line == -1) { first_line = line; } last_line = line; w->draw_line(w, host_fb_addr, s->ifb + w->lefttop_x * RGBA_SIZE + (w->lefttop_y + line) * global_width * RGBA_SIZE, blend); } host_fb_addr += inc_size; fb_line_addr += inc_size; is_dirty = false; } memory_region_reset_dirty(w->mem_section.mr, w->mem_section.offset_within_region, w->fb_len, DIRTY_MEMORY_VGA); blend = true; } } if (first_line >= 0) { uint8_t *d; int bpp; bpp = ds_get_bits_per_pixel(s->console); fimd_update_putpix_qemu(bpp); bpp = (bpp + 1) >> 3; d = ds_get_data(s->console); for (line = first_line; line <= last_line; line++) { fimd_copy_line_toqemu(global_width, s->ifb + global_width * line * RGBA_SIZE, d + global_width * line * bpp); } dpy_update(s->console, 0, 0, global_width, global_height); } s->invalidate = false; s->vidintcon[1] |= FIMD_VIDINT_INTFRMPEND; if ((s->vidcon[0] & FIMD_VIDCON0_ENVID_F) == 0) { exynos4210_fimd_enable(s, false); } exynos4210_fimd_update_irq(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { Exynos4210fimdState *s = (Exynos4210fimdState *)VAR_0; Exynos4210fimdWindow *w; int VAR_1, VAR_2; target_phys_addr_t fb_line_addr, inc_size; int VAR_3; int VAR_4 = -1, VAR_5 = -1, VAR_6; bool blend = false; uint8_t *host_fb_addr; bool is_dirty = false; const int VAR_7 = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1; const int VAR_8 = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) & FIMD_VIDTCON2_SIZE_MASK) + 1; if (!s || !s->console || !ds_get_bits_per_pixel(s->console) || !s->enabled) { return; } exynos4210_update_resolution(s); for (VAR_1 = 0; VAR_1 < NUM_OF_WINDOWS; VAR_1++) { w = &s->window[VAR_1]; if ((w->wincon & FIMD_WINCON_ENWIN) && w->host_fb_addr) { VAR_3 = w->rightbot_y - w->lefttop_y + 1; VAR_6 = w->virtpage_width; inc_size = VAR_6 + w->virtpage_offsize; memory_region_sync_dirty_bitmap(w->mem_section.mr); host_fb_addr = w->host_fb_addr; fb_line_addr = w->mem_section.offset_within_region; for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { is_dirty = memory_region_get_dirty(w->mem_section.mr, fb_line_addr, VAR_6, DIRTY_MEMORY_VGA); if (s->invalidate || is_dirty) { if (VAR_4 == -1) { VAR_4 = VAR_2; } VAR_5 = VAR_2; w->draw_line(w, host_fb_addr, s->ifb + w->lefttop_x * RGBA_SIZE + (w->lefttop_y + VAR_2) * VAR_7 * RGBA_SIZE, blend); } host_fb_addr += inc_size; fb_line_addr += inc_size; is_dirty = false; } memory_region_reset_dirty(w->mem_section.mr, w->mem_section.offset_within_region, w->fb_len, DIRTY_MEMORY_VGA); blend = true; } } if (VAR_4 >= 0) { uint8_t *d; int VAR_9; VAR_9 = ds_get_bits_per_pixel(s->console); fimd_update_putpix_qemu(VAR_9); VAR_9 = (VAR_9 + 1) >> 3; d = ds_get_data(s->console); for (VAR_2 = VAR_4; VAR_2 <= VAR_5; VAR_2++) { fimd_copy_line_toqemu(VAR_7, s->ifb + VAR_7 * VAR_2 * RGBA_SIZE, d + VAR_7 * VAR_2 * VAR_9); } dpy_update(s->console, 0, 0, VAR_7, VAR_8); } s->invalidate = false; s->vidintcon[1] |= FIMD_VIDINT_INTFRMPEND; if ((s->vidcon[0] & FIMD_VIDCON0_ENVID_F) == 0) { exynos4210_fimd_enable(s, false); } exynos4210_fimd_update_irq(s); }
[ "static void FUNC_0(void *VAR_0)\n{", "Exynos4210fimdState *s = (Exynos4210fimdState *)VAR_0;", "Exynos4210fimdWindow *w;", "int VAR_1, VAR_2;", "target_phys_addr_t fb_line_addr, inc_size;", "int VAR_3;", "int VAR_4 = -1, VAR_5 = -1, VAR_6;", "bool blend = false;", "uint8_t *host_fb_addr;", "bool is_dirty = false;", "const int VAR_7 = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;", "const int VAR_8 = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) &\nFIMD_VIDTCON2_SIZE_MASK) + 1;", "if (!s || !s->console || !ds_get_bits_per_pixel(s->console) ||\n!s->enabled) {", "return;", "}", "exynos4210_update_resolution(s);", "for (VAR_1 = 0; VAR_1 < NUM_OF_WINDOWS; VAR_1++) {", "w = &s->window[VAR_1];", "if ((w->wincon & FIMD_WINCON_ENWIN) && w->host_fb_addr) {", "VAR_3 = w->rightbot_y - w->lefttop_y + 1;", "VAR_6 = w->virtpage_width;", "inc_size = VAR_6 + w->virtpage_offsize;", "memory_region_sync_dirty_bitmap(w->mem_section.mr);", "host_fb_addr = w->host_fb_addr;", "fb_line_addr = w->mem_section.offset_within_region;", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "is_dirty = memory_region_get_dirty(w->mem_section.mr,\nfb_line_addr, VAR_6, DIRTY_MEMORY_VGA);", "if (s->invalidate || is_dirty) {", "if (VAR_4 == -1) {", "VAR_4 = VAR_2;", "}", "VAR_5 = VAR_2;", "w->draw_line(w, host_fb_addr, s->ifb +\nw->lefttop_x * RGBA_SIZE + (w->lefttop_y + VAR_2) *\nVAR_7 * RGBA_SIZE, blend);", "}", "host_fb_addr += inc_size;", "fb_line_addr += inc_size;", "is_dirty = false;", "}", "memory_region_reset_dirty(w->mem_section.mr,\nw->mem_section.offset_within_region,\nw->fb_len, DIRTY_MEMORY_VGA);", "blend = true;", "}", "}", "if (VAR_4 >= 0) {", "uint8_t *d;", "int VAR_9;", "VAR_9 = ds_get_bits_per_pixel(s->console);", "fimd_update_putpix_qemu(VAR_9);", "VAR_9 = (VAR_9 + 1) >> 3;", "d = ds_get_data(s->console);", "for (VAR_2 = VAR_4; VAR_2 <= VAR_5; VAR_2++) {", "fimd_copy_line_toqemu(VAR_7, s->ifb + VAR_7 * VAR_2 *\nRGBA_SIZE, d + VAR_7 * VAR_2 * VAR_9);", "}", "dpy_update(s->console, 0, 0, VAR_7, VAR_8);", "}", "s->invalidate = false;", "s->vidintcon[1] |= FIMD_VIDINT_INTFRMPEND;", "if ((s->vidcon[0] & FIMD_VIDCON0_ENVID_F) == 0) {", "exynos4210_fimd_enable(s, false);", "}", "exynos4210_fimd_update_irq(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ] ]
10,994
static int find_large_solid_color_rect(VncState *vs, int x, int y, int w, int h, int max_rows) { int dx, dy, dw, dh; int n = 0; /* Try to find large solid-color areas and send them separately. */ for (dy = y; dy < y + h; dy += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { /* If a rectangle becomes too large, send its upper part now. */ if (dy - y >= max_rows) { n += send_rect_simple(vs, x, y, w, max_rows); y += max_rows; h -= max_rows; } dh = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (y + h - dy)); for (dx = x; dx < x + w; dx += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { uint32_t color_value; int x_best, y_best, w_best, h_best; dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (x + w - dx)); if (!check_solid_tile(vs, dx, dy, dw, dh, &color_value, false)) { continue ; } /* Get dimensions of solid-color area. */ find_best_solid_area(vs, dx, dy, w - (dx - x), h - (dy - y), color_value, &w_best, &h_best); /* Make sure a solid rectangle is large enough (or the whole rectangle is of the same color). */ if (w_best * h_best != w * h && w_best * h_best < VNC_TIGHT_MIN_SOLID_SUBRECT_SIZE) { continue; } /* Try to extend solid rectangle to maximum size. */ x_best = dx; y_best = dy; extend_solid_area(vs, x, y, w, h, color_value, &x_best, &y_best, &w_best, &h_best); /* Send rectangles at top and left to solid-color area. */ if (y_best != y) { n += send_rect_simple(vs, x, y, w, y_best-y); } if (x_best != x) { n += vnc_tight_send_framebuffer_update(vs, x, y_best, x_best-x, h_best); } /* Send solid-color rectangle. */ n += send_sub_rect_solid(vs, x_best, y_best, w_best, h_best); /* Send remaining rectangles (at right and bottom). */ if (x_best + w_best != x + w) { n += vnc_tight_send_framebuffer_update(vs, x_best+w_best, y_best, w-(x_best-x)-w_best, h_best); } if (y_best + h_best != y + h) { n += vnc_tight_send_framebuffer_update(vs, x, y_best+h_best, w, h-(y_best-y)-h_best); } /* Return after all recursive calls are done. */ return n; } } return n + send_rect_simple(vs, x, y, w, h); }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
static int find_large_solid_color_rect(VncState *vs, int x, int y, int w, int h, int max_rows) { int dx, dy, dw, dh; int n = 0; for (dy = y; dy < y + h; dy += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { if (dy - y >= max_rows) { n += send_rect_simple(vs, x, y, w, max_rows); y += max_rows; h -= max_rows; } dh = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (y + h - dy)); for (dx = x; dx < x + w; dx += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { uint32_t color_value; int x_best, y_best, w_best, h_best; dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (x + w - dx)); if (!check_solid_tile(vs, dx, dy, dw, dh, &color_value, false)) { continue ; } find_best_solid_area(vs, dx, dy, w - (dx - x), h - (dy - y), color_value, &w_best, &h_best); if (w_best * h_best != w * h && w_best * h_best < VNC_TIGHT_MIN_SOLID_SUBRECT_SIZE) { continue; } x_best = dx; y_best = dy; extend_solid_area(vs, x, y, w, h, color_value, &x_best, &y_best, &w_best, &h_best); if (y_best != y) { n += send_rect_simple(vs, x, y, w, y_best-y); } if (x_best != x) { n += vnc_tight_send_framebuffer_update(vs, x, y_best, x_best-x, h_best); } n += send_sub_rect_solid(vs, x_best, y_best, w_best, h_best); if (x_best + w_best != x + w) { n += vnc_tight_send_framebuffer_update(vs, x_best+w_best, y_best, w-(x_best-x)-w_best, h_best); } if (y_best + h_best != y + h) { n += vnc_tight_send_framebuffer_update(vs, x, y_best+h_best, w, h-(y_best-y)-h_best); } return n; } } return n + send_rect_simple(vs, x, y, w, h); }
{ "code": [], "line_no": [] }
static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10 = 0; for (VAR_7 = VAR_2; VAR_7 < VAR_2 + VAR_4; VAR_7 += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { if (VAR_7 - VAR_2 >= VAR_5) { VAR_10 += send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5); VAR_2 += VAR_5; VAR_4 -= VAR_5; } VAR_9 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (VAR_2 + VAR_4 - VAR_7)); for (VAR_6 = VAR_1; VAR_6 < VAR_1 + VAR_3; VAR_6 += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { uint32_t color_value; int VAR_11, VAR_12, VAR_13, VAR_14; VAR_8 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (VAR_1 + VAR_3 - VAR_6)); if (!check_solid_tile(VAR_0, VAR_6, VAR_7, VAR_8, VAR_9, &color_value, false)) { continue ; } find_best_solid_area(VAR_0, VAR_6, VAR_7, VAR_3 - (VAR_6 - VAR_1), VAR_4 - (VAR_7 - VAR_2), color_value, &VAR_13, &VAR_14); if (VAR_13 * VAR_14 != VAR_3 * VAR_4 && VAR_13 * VAR_14 < VNC_TIGHT_MIN_SOLID_SUBRECT_SIZE) { continue; } VAR_11 = VAR_6; VAR_12 = VAR_7; extend_solid_area(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, color_value, &VAR_11, &VAR_12, &VAR_13, &VAR_14); if (VAR_12 != VAR_2) { VAR_10 += send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_12-VAR_2); } if (VAR_11 != VAR_1) { VAR_10 += vnc_tight_send_framebuffer_update(VAR_0, VAR_1, VAR_12, VAR_11-VAR_1, VAR_14); } VAR_10 += send_sub_rect_solid(VAR_0, VAR_11, VAR_12, VAR_13, VAR_14); if (VAR_11 + VAR_13 != VAR_1 + VAR_3) { VAR_10 += vnc_tight_send_framebuffer_update(VAR_0, VAR_11+VAR_13, VAR_12, VAR_3-(VAR_11-VAR_1)-VAR_13, VAR_14); } if (VAR_12 + VAR_14 != VAR_2 + VAR_4) { VAR_10 += vnc_tight_send_framebuffer_update(VAR_0, VAR_1, VAR_12+VAR_14, VAR_3, VAR_4-(VAR_12-VAR_2)-VAR_14); } return VAR_10; } } return VAR_10 + send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); }
[ "static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10 = 0;", "for (VAR_7 = VAR_2; VAR_7 < VAR_2 + VAR_4; VAR_7 += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) {", "if (VAR_7 - VAR_2 >= VAR_5) {", "VAR_10 += send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5);", "VAR_2 += VAR_5;", "VAR_4 -= VAR_5;", "}", "VAR_9 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (VAR_2 + VAR_4 - VAR_7));", "for (VAR_6 = VAR_1; VAR_6 < VAR_1 + VAR_3; VAR_6 += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) {", "uint32_t color_value;", "int VAR_11, VAR_12, VAR_13, VAR_14;", "VAR_8 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (VAR_1 + VAR_3 - VAR_6));", "if (!check_solid_tile(VAR_0, VAR_6, VAR_7, VAR_8, VAR_9, &color_value, false)) {", "continue ;", "}", "find_best_solid_area(VAR_0, VAR_6, VAR_7, VAR_3 - (VAR_6 - VAR_1), VAR_4 - (VAR_7 - VAR_2),\ncolor_value, &VAR_13, &VAR_14);", "if (VAR_13 * VAR_14 != VAR_3 * VAR_4 &&\nVAR_13 * VAR_14 < VNC_TIGHT_MIN_SOLID_SUBRECT_SIZE) {", "continue;", "}", "VAR_11 = VAR_6; VAR_12 = VAR_7;", "extend_solid_area(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, color_value,\n&VAR_11, &VAR_12, &VAR_13, &VAR_14);", "if (VAR_12 != VAR_2) {", "VAR_10 += send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_12-VAR_2);", "}", "if (VAR_11 != VAR_1) {", "VAR_10 += vnc_tight_send_framebuffer_update(VAR_0, VAR_1, VAR_12,\nVAR_11-VAR_1, VAR_14);", "}", "VAR_10 += send_sub_rect_solid(VAR_0, VAR_11, VAR_12, VAR_13, VAR_14);", "if (VAR_11 + VAR_13 != VAR_1 + VAR_3) {", "VAR_10 += vnc_tight_send_framebuffer_update(VAR_0, VAR_11+VAR_13,\nVAR_12,\nVAR_3-(VAR_11-VAR_1)-VAR_13,\nVAR_14);", "}", "if (VAR_12 + VAR_14 != VAR_2 + VAR_4) {", "VAR_10 += vnc_tight_send_framebuffer_update(VAR_0, VAR_1, VAR_12+VAR_14,\nVAR_3, VAR_4-(VAR_12-VAR_2)-VAR_14);", "}", "return VAR_10;", "}", "}", "return VAR_10 + send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 17 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 65, 67 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 91 ], [ 93, 95 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 121 ], [ 129 ], [ 131, 133, 135, 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
10,995
static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { int64_t cluster_num, nb_clusters; if (iscsilun->allocationmap == NULL) { return; } cluster_num = DIV_ROUND_UP(sector_num, iscsilun->cluster_sectors); nb_clusters = (sector_num + nb_sectors) / iscsilun->cluster_sectors - cluster_num; if (nb_clusters > 0) { bitmap_clear(iscsilun->allocationmap, cluster_num, nb_clusters); } }
false
qemu
e1123a3b40a1a9a625a29c8ed4debb7e206ea690
static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { int64_t cluster_num, nb_clusters; if (iscsilun->allocationmap == NULL) { return; } cluster_num = DIV_ROUND_UP(sector_num, iscsilun->cluster_sectors); nb_clusters = (sector_num + nb_sectors) / iscsilun->cluster_sectors - cluster_num; if (nb_clusters > 0) { bitmap_clear(iscsilun->allocationmap, cluster_num, nb_clusters); } }
{ "code": [], "line_no": [] }
static void FUNC_0(IscsiLun *VAR_0, int64_t VAR_1, int VAR_2) { int64_t cluster_num, nb_clusters; if (VAR_0->allocationmap == NULL) { return; } cluster_num = DIV_ROUND_UP(VAR_1, VAR_0->cluster_sectors); nb_clusters = (VAR_1 + VAR_2) / VAR_0->cluster_sectors - cluster_num; if (nb_clusters > 0) { bitmap_clear(VAR_0->allocationmap, cluster_num, nb_clusters); } }
[ "static void FUNC_0(IscsiLun *VAR_0, int64_t VAR_1,\nint VAR_2)\n{", "int64_t cluster_num, nb_clusters;", "if (VAR_0->allocationmap == NULL) {", "return;", "}", "cluster_num = DIV_ROUND_UP(VAR_1, VAR_0->cluster_sectors);", "nb_clusters = (VAR_1 + VAR_2) / VAR_0->cluster_sectors\n- cluster_num;", "if (nb_clusters > 0) {", "bitmap_clear(VAR_0->allocationmap, cluster_num, nb_clusters);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
10,996
static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) { h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0); }
false
FFmpeg
dd561441b1e849df7d8681c6f32af82d4088dafd
static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) { h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int8_t *VAR_4) { h264_loop_filter_luma_c(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4); }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int8_t *VAR_4)\n{", "h264_loop_filter_luma_c(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
10,997
static int avi_read_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; unsigned int tag, tag1, handler; int codec_type, stream_index, frame_period; unsigned int size; int i; AVStream *st; AVIStream *ast = NULL; int avih_width = 0, avih_height = 0; int amv_file_format = 0; uint64_t list_end = 0; int ret; avi->stream_index = -1; ret = get_riff(s, pb); if (ret < 0) return ret; avi->fsize = avio_size(pb); if (avi->fsize <= 0) avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end; /* first list tag */ stream_index = -1; codec_type = -1; frame_period = 0; for (;;) { if (pb->eof_reached) goto fail; tag = avio_rl32(pb); size = avio_rl32(pb); print_tag("tag", tag, size); switch (tag) { case MKTAG('L', 'I', 'S', 'T'): list_end = avio_tell(pb) + size; /* Ignored, except at start of video packets. */ tag1 = avio_rl32(pb); print_tag("list", tag1, 0); if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; if (size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = avio_size(pb); av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) ff_read_riff_info(s, size - 4); else if (tag1 == MKTAG('n', 'c', 'd', 't')) avi_read_nikon(s, list_end); break; case MKTAG('I', 'D', 'I', 'T'): { unsigned char date[64] = { 0 }; size += (size & 1); size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1)); avio_skip(pb, size); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; avio_skip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format = 1; case MKTAG('a', 'v', 'i', 'h'): /* AVI header */ /* using frame_period is bad idea */ frame_period = avio_rl32(pb); avio_skip(pb, 4); avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; avio_skip(pb, 2 * 4); avio_rl32(pb); avio_rl32(pb); avih_width = avio_rl32(pb); avih_height = avio_rl32(pb); avio_skip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): /* stream header */ tag1 = avio_rl32(pb); handler = avio_rl32(pb); /* codec tag */ if (tag1 == MKTAG('p', 'a', 'd', 's')) { avio_skip(pb, size - 8); break; } else { stream_index++; st = avformat_new_stream(s, NULL); if (!st) goto fail; st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if (amv_file_format) tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') : MKTAG('v', 'i', 'd', 's'); print_tag("strh", tag1, -1); if (tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')) { int64_t dv_dur; /* After some consideration -- I don't think we * have to support anything but DV in type1 AVIs. */ if (s->nb_streams != 1) goto fail; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && handler != MKTAG('d', 'v', 's', 'l')) goto fail; ast = s->streams[0]->priv_data; av_freep(&s->streams[0]->codec->extradata); av_freep(&s->streams[0]->codec); av_freep(&s->streams[0]->info); av_freep(&s->streams[0]); s->nb_streams = 0; if (CONFIG_DV_DEMUXER) { avi->dv_demux = avpriv_dv_init_demux(s); if (!avi->dv_demux) goto fail; } else goto fail; s->streams[0]->priv_data = ast; avio_skip(pb, 3 * 4); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); avio_skip(pb, 4); /* start time */ dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); } /* else, leave duration alone; timing estimation in utils.c * will make a guess based on bitrate. */ stream_index = s->nb_streams - 1; avio_skip(pb, size - 9 * 4); break; } assert(stream_index < s->nb_streams); st->codec->stream_codec_tag = handler; avio_rl32(pb); /* flags */ avio_rl16(pb); /* priority */ avio_rl16(pb); /* language */ avio_rl32(pb); /* initial frame */ ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); if (!(ast->scale && ast->rate)) { av_log(s, AV_LOG_WARNING, "scale/rate is %"PRIu32"/%"PRIu32" which is invalid. " "(This file has been generated by broken software.)\n", ast->scale, ast->rate); if (frame_period) { ast->rate = 1000000; ast->scale = frame_period; } else { ast->rate = 25; ast->scale = 1; } } avpriv_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len = avio_rl32(pb); /* start */ st->nb_frames = avio_rl32(pb); st->start_time = 0; avio_rl32(pb); /* buffer size */ avio_rl32(pb); /* quality */ ast->sample_size = avio_rl32(pb); /* sample ssize */ ast->cum_len *= FFMAX(1, ast->sample_size); av_dlog(s, "%"PRIu32" %"PRIu32" %d\n", ast->rate, ast->scale, ast->sample_size); switch (tag1) { case MKTAG('v', 'i', 'd', 's'): codec_type = AVMEDIA_TYPE_VIDEO; ast->sample_size = 0; break; case MKTAG('a', 'u', 'd', 's'): codec_type = AVMEDIA_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 's'): codec_type = AVMEDIA_TYPE_SUBTITLE; break; case MKTAG('d', 'a', 't', 's'): codec_type = AVMEDIA_TYPE_DATA; break; default: av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1); goto fail; } if (ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset = ast->cum_len; avio_skip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): /* stream header */ if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; switch (codec_type) { case AVMEDIA_TYPE_VIDEO: if (amv_file_format) { st->codec->width = avih_width; st->codec->height = avih_height; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_AMV; avio_skip(pb, size); break; } tag1 = ff_get_bmp_header(pb, st); if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D', 'X', 'S', 'A')) { st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_tag = tag1; st->codec->codec_id = AV_CODEC_ID_XSUB; break; } if (size > 10 * 4 && size < (1 << 30)) { st->codec->extradata_size = size - 10 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); } avio_read(pb, st->codec->extradata, st->codec->extradata_size); } // FIXME: check if the encoder really did this correctly if (st->codec->extradata_size & 1) avio_r8(pb); /* Extract palette from extradata if bpp <= 8. * This code assumes that extradata contains only palette. * This is true for all paletted codecs implemented in * Libav. */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { int pal_size = (1 << st->codec->bits_per_coded_sample) << 2; const uint8_t *pal_src; pal_size = FFMIN(pal_size, st->codec->extradata_size); pal_src = st->codec->extradata + st->codec->extradata_size - pal_size; #if HAVE_BIGENDIAN for (i = 0; i < pal_size / 4; i++) ast->pal[i] = av_bswap32(((uint32_t *)pal_src)[i]); #else memcpy(ast->pal, pal_src, pal_size); #endif ast->has_pal = 1; } print_tag("video", tag1, 0); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_tag = tag1; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); /* This is needed to get the pict type which is necessary * for generating correct pts. */ st->need_parsing = AVSTREAM_PARSE_HEADERS; // Support "Resolution 1:1" for Avid AVI Codec if (tag1 == MKTAG('A', 'V', 'R', 'n') && st->codec->extradata_size >= 31 && !memcmp(&st->codec->extradata[28], "1:1", 3)) st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; if (st->codec->codec_tag == 0 && st->codec->height > 0 && st->codec->extradata_size < 1U << 30) { st->codec->extradata_size += 9; if ((ret = av_reallocp(&st->codec->extradata, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return ret; } else memcpy(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9); } st->codec->height = FFABS(st->codec->height); // avio_skip(pb, size - 5 * 4); break; case AVMEDIA_TYPE_AUDIO: ret = ff_get_wav_header(pb, st->codec, size); if (ret < 0) return ret; ast->dshow_block_align = st->codec->block_align; if (ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align) { av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size = st->codec->block_align; } /* 2-aligned * (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ if (size & 1) avio_skip(pb, 1); /* Force parsing as several audio frames can be in * one packet and timestamps refer to packet start. */ st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; /* ADTS header is in extradata, AAC without header must be * stored as exact frames. Parser not needed and it will * fail. */ if (st->codec->codec_id == AV_CODEC_ID_AAC && st->codec->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; /* AVI files with Xan DPCM audio (wrongly) declare PCM * audio in the header but have Axan as stream_code_tag. */ if (st->codec->stream_codec_tag == AV_RL32("Axan")) { st->codec->codec_id = AV_CODEC_ID_XAN_DPCM; st->codec->codec_tag = 0; } if (amv_file_format) { st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV; ast->dshow_block_align = 0; } break; case AVMEDIA_TYPE_SUBTITLE: st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_PROBE; break; default: st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = AV_CODEC_ID_NONE; st->codec->codec_tag = 0; avio_skip(pb, size); break; } } break; case MKTAG('i', 'n', 'd', 'x'): i = avio_tell(pb); if (pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && read_braindead_odml_indx(s, 0) < 0 && (s->error_recognition & AV_EF_EXPLODE)) goto fail; avio_seek(pb, i + size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if (stream_index < (unsigned)s->nb_streams && size > 9 * 4) { AVRational active, active_aspect; st = s->streams[stream_index]; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); active_aspect.den = avio_rl16(pb); active_aspect.num = avio_rl16(pb); active.num = avio_rl32(pb); active.den = avio_rl32(pb); avio_rl32(pb); // nbFieldsPerFrame if (active_aspect.num && active_aspect.den && active.num && active.den) { st->sample_aspect_ratio = av_div_q(active_aspect, active); av_dlog(s, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den); } size -= 9 * 4; } avio_skip(pb, size); break; case MKTAG('s', 't', 'r', 'n'): if (s->nb_streams) { ret = avi_read_tag(s, s->streams[s->nb_streams - 1], tag, size); if (ret < 0) return ret; break; } default: if (size > 1000000) { av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); if (s->error_recognition & AV_EF_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avio_size(pb); goto end_of_header; } /* skip tag */ size += (size & 1); avio_skip(pb, size); break; } } end_of_header: /* check stream number */ if (stream_index != s->nb_streams - 1) { fail: return AVERROR_INVALIDDATA; } if (!avi->index_loaded && pb->seekable) avi_load_index(s); avi->index_loaded = 1; avi->non_interleaved |= guess_ni_flag(s); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->nb_index_entries) break; } if (i == s->nb_streams && avi->non_interleaved) { av_log(s, AV_LOG_WARNING, "Non-interleaved AVI without index, switching to interleaved\n"); avi->non_interleaved = 0; } if (avi->non_interleaved) { av_log(s, AV_LOG_INFO, "non-interleaved AVI\n"); clean_index(s); } ff_metadata_conv_ctx(s, NULL, avi_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; }
false
FFmpeg
9d599e3f6e61438772d8cddd6c9b7c495251f51e
static int avi_read_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; unsigned int tag, tag1, handler; int codec_type, stream_index, frame_period; unsigned int size; int i; AVStream *st; AVIStream *ast = NULL; int avih_width = 0, avih_height = 0; int amv_file_format = 0; uint64_t list_end = 0; int ret; avi->stream_index = -1; ret = get_riff(s, pb); if (ret < 0) return ret; avi->fsize = avio_size(pb); if (avi->fsize <= 0) avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end; stream_index = -1; codec_type = -1; frame_period = 0; for (;;) { if (pb->eof_reached) goto fail; tag = avio_rl32(pb); size = avio_rl32(pb); print_tag("tag", tag, size); switch (tag) { case MKTAG('L', 'I', 'S', 'T'): list_end = avio_tell(pb) + size; tag1 = avio_rl32(pb); print_tag("list", tag1, 0); if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; if (size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = avio_size(pb); av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) ff_read_riff_info(s, size - 4); else if (tag1 == MKTAG('n', 'c', 'd', 't')) avi_read_nikon(s, list_end); break; case MKTAG('I', 'D', 'I', 'T'): { unsigned char date[64] = { 0 }; size += (size & 1); size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1)); avio_skip(pb, size); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; avio_skip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format = 1; case MKTAG('a', 'v', 'i', 'h'): frame_period = avio_rl32(pb); avio_skip(pb, 4); avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; avio_skip(pb, 2 * 4); avio_rl32(pb); avio_rl32(pb); avih_width = avio_rl32(pb); avih_height = avio_rl32(pb); avio_skip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): tag1 = avio_rl32(pb); handler = avio_rl32(pb); if (tag1 == MKTAG('p', 'a', 'd', 's')) { avio_skip(pb, size - 8); break; } else { stream_index++; st = avformat_new_stream(s, NULL); if (!st) goto fail; st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if (amv_file_format) tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') : MKTAG('v', 'i', 'd', 's'); print_tag("strh", tag1, -1); if (tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')) { int64_t dv_dur; if (s->nb_streams != 1) goto fail; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && handler != MKTAG('d', 'v', 's', 'l')) goto fail; ast = s->streams[0]->priv_data; av_freep(&s->streams[0]->codec->extradata); av_freep(&s->streams[0]->codec); av_freep(&s->streams[0]->info); av_freep(&s->streams[0]); s->nb_streams = 0; if (CONFIG_DV_DEMUXER) { avi->dv_demux = avpriv_dv_init_demux(s); if (!avi->dv_demux) goto fail; } else goto fail; s->streams[0]->priv_data = ast; avio_skip(pb, 3 * 4); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); avio_skip(pb, 4); dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); } stream_index = s->nb_streams - 1; avio_skip(pb, size - 9 * 4); break; } assert(stream_index < s->nb_streams); st->codec->stream_codec_tag = handler; avio_rl32(pb); avio_rl16(pb); avio_rl16(pb); avio_rl32(pb); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); if (!(ast->scale && ast->rate)) { av_log(s, AV_LOG_WARNING, "scale/rate is %"PRIu32"/%"PRIu32" which is invalid. " "(This file has been generated by broken software.)\n", ast->scale, ast->rate); if (frame_period) { ast->rate = 1000000; ast->scale = frame_period; } else { ast->rate = 25; ast->scale = 1; } } avpriv_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len = avio_rl32(pb); st->nb_frames = avio_rl32(pb); st->start_time = 0; avio_rl32(pb); avio_rl32(pb); ast->sample_size = avio_rl32(pb); ast->cum_len *= FFMAX(1, ast->sample_size); av_dlog(s, "%"PRIu32" %"PRIu32" %d\n", ast->rate, ast->scale, ast->sample_size); switch (tag1) { case MKTAG('v', 'i', 'd', 's'): codec_type = AVMEDIA_TYPE_VIDEO; ast->sample_size = 0; break; case MKTAG('a', 'u', 'd', 's'): codec_type = AVMEDIA_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 's'): codec_type = AVMEDIA_TYPE_SUBTITLE; break; case MKTAG('d', 'a', 't', 's'): codec_type = AVMEDIA_TYPE_DATA; break; default: av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1); goto fail; } if (ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset = ast->cum_len; avio_skip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; switch (codec_type) { case AVMEDIA_TYPE_VIDEO: if (amv_file_format) { st->codec->width = avih_width; st->codec->height = avih_height; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_AMV; avio_skip(pb, size); break; } tag1 = ff_get_bmp_header(pb, st); if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D', 'X', 'S', 'A')) { st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_tag = tag1; st->codec->codec_id = AV_CODEC_ID_XSUB; break; } if (size > 10 * 4 && size < (1 << 30)) { st->codec->extradata_size = size - 10 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); } avio_read(pb, st->codec->extradata, st->codec->extradata_size); } if (st->codec->extradata_size & 1) avio_r8(pb); if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { int pal_size = (1 << st->codec->bits_per_coded_sample) << 2; const uint8_t *pal_src; pal_size = FFMIN(pal_size, st->codec->extradata_size); pal_src = st->codec->extradata + st->codec->extradata_size - pal_size; #if HAVE_BIGENDIAN for (i = 0; i < pal_size / 4; i++) ast->pal[i] = av_bswap32(((uint32_t *)pal_src)[i]); #else memcpy(ast->pal, pal_src, pal_size); #endif ast->has_pal = 1; } print_tag("video", tag1, 0); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_tag = tag1; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); st->need_parsing = AVSTREAM_PARSE_HEADERS; if (tag1 == MKTAG('A', 'V', 'R', 'n') && st->codec->extradata_size >= 31 && !memcmp(&st->codec->extradata[28], "1:1", 3)) st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; if (st->codec->codec_tag == 0 && st->codec->height > 0 && st->codec->extradata_size < 1U << 30) { st->codec->extradata_size += 9; if ((ret = av_reallocp(&st->codec->extradata, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return ret; } else memcpy(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9); } st->codec->height = FFABS(st->codec->height); break; case AVMEDIA_TYPE_AUDIO: ret = ff_get_wav_header(pb, st->codec, size); if (ret < 0) return ret; ast->dshow_block_align = st->codec->block_align; if (ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align) { av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size = st->codec->block_align; } if (size & 1) avio_skip(pb, 1); st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; if (st->codec->codec_id == AV_CODEC_ID_AAC && st->codec->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->stream_codec_tag == AV_RL32("Axan")) { st->codec->codec_id = AV_CODEC_ID_XAN_DPCM; st->codec->codec_tag = 0; } if (amv_file_format) { st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV; ast->dshow_block_align = 0; } break; case AVMEDIA_TYPE_SUBTITLE: st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_PROBE; break; default: st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = AV_CODEC_ID_NONE; st->codec->codec_tag = 0; avio_skip(pb, size); break; } } break; case MKTAG('i', 'n', 'd', 'x'): i = avio_tell(pb); if (pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && read_braindead_odml_indx(s, 0) < 0 && (s->error_recognition & AV_EF_EXPLODE)) goto fail; avio_seek(pb, i + size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if (stream_index < (unsigned)s->nb_streams && size > 9 * 4) { AVRational active, active_aspect; st = s->streams[stream_index]; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); active_aspect.den = avio_rl16(pb); active_aspect.num = avio_rl16(pb); active.num = avio_rl32(pb); active.den = avio_rl32(pb); avio_rl32(pb); if (active_aspect.num && active_aspect.den && active.num && active.den) { st->sample_aspect_ratio = av_div_q(active_aspect, active); av_dlog(s, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den); } size -= 9 * 4; } avio_skip(pb, size); break; case MKTAG('s', 't', 'r', 'n'): if (s->nb_streams) { ret = avi_read_tag(s, s->streams[s->nb_streams - 1], tag, size); if (ret < 0) return ret; break; } default: if (size > 1000000) { av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); if (s->error_recognition & AV_EF_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avio_size(pb); goto end_of_header; } size += (size & 1); avio_skip(pb, size); break; } } end_of_header: if (stream_index != s->nb_streams - 1) { fail: return AVERROR_INVALIDDATA; } if (!avi->index_loaded && pb->seekable) avi_load_index(s); avi->index_loaded = 1; avi->non_interleaved |= guess_ni_flag(s); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->nb_index_entries) break; } if (i == s->nb_streams && avi->non_interleaved) { av_log(s, AV_LOG_WARNING, "Non-interleaved AVI without index, switching to interleaved\n"); avi->non_interleaved = 0; } if (avi->non_interleaved) { av_log(s, AV_LOG_INFO, "non-interleaved AVI\n"); clean_index(s); } ff_metadata_conv_ctx(s, NULL, avi_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { AVIContext *avi = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; unsigned int VAR_1, VAR_2, VAR_3; int VAR_4, VAR_5, VAR_6; unsigned int VAR_7; int VAR_8; AVStream *st; AVIStream *ast = NULL; int VAR_9 = 0, VAR_10 = 0; int VAR_11 = 0; uint64_t list_end = 0; int VAR_12; avi->VAR_5 = -1; VAR_12 = get_riff(VAR_0, pb); if (VAR_12 < 0) return VAR_12; avi->fsize = avio_size(pb); if (avi->fsize <= 0) avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end; VAR_5 = -1; VAR_4 = -1; VAR_6 = 0; for (;;) { if (pb->eof_reached) goto fail; VAR_1 = avio_rl32(pb); VAR_7 = avio_rl32(pb); print_tag("VAR_1", VAR_1, VAR_7); switch (VAR_1) { case MKTAG('L', 'I', 'S', 'T'): list_end = avio_tell(pb) + VAR_7; VAR_2 = avio_rl32(pb); print_tag("list", VAR_2, 0); if (VAR_2 == MKTAG('m', 'o', 'v', 'VAR_8')) { avi->movi_list = avio_tell(pb) - 4; if (VAR_7) avi->movi_end = avi->movi_list + VAR_7 + (VAR_7 & 1); else avi->movi_end = avio_size(pb); av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } else if (VAR_2 == MKTAG('I', 'N', 'F', 'O')) ff_read_riff_info(VAR_0, VAR_7 - 4); else if (VAR_2 == MKTAG('n', 'c', 'd', 't')) avi_read_nikon(VAR_0, list_end); break; case MKTAG('I', 'D', 'I', 'T'): { unsigned char VAR_13[64] = { 0 }; VAR_7 += (VAR_7 & 1); VAR_7 -= avio_read(pb, VAR_13, FFMIN(VAR_7, sizeof(VAR_13) - 1)); avio_skip(pb, VAR_7); avi_metadata_creation_time(&VAR_0->metadata, VAR_13); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; avio_skip(pb, VAR_7 + (VAR_7 & 1)); break; case MKTAG('a', 'm', 'v', 'h'): VAR_11 = 1; case MKTAG('a', 'v', 'VAR_8', 'h'): VAR_6 = avio_rl32(pb); avio_skip(pb, 4); avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; avio_skip(pb, 2 * 4); avio_rl32(pb); avio_rl32(pb); VAR_9 = avio_rl32(pb); VAR_10 = avio_rl32(pb); avio_skip(pb, VAR_7 - 10 * 4); break; case MKTAG('VAR_0', 't', 'r', 'h'): VAR_2 = avio_rl32(pb); VAR_3 = avio_rl32(pb); if (VAR_2 == MKTAG('p', 'a', 'd', 'VAR_0')) { avio_skip(pb, VAR_7 - 8); break; } else { VAR_5++; st = avformat_new_stream(VAR_0, NULL); if (!st) goto fail; st->id = VAR_5; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if (VAR_11) VAR_2 = VAR_5 ? MKTAG('a', 'u', 'd', 'VAR_0') : MKTAG('v', 'VAR_8', 'd', 'VAR_0'); print_tag("strh", VAR_2, -1); if (VAR_2 == MKTAG('VAR_8', 'a', 'v', 'VAR_0') || VAR_2 == MKTAG('VAR_8', 'v', 'a', 'VAR_0')) { int64_t dv_dur; if (VAR_0->nb_streams != 1) goto fail; if (VAR_3 != MKTAG('d', 'v', 'VAR_0', 'd') && VAR_3 != MKTAG('d', 'v', 'h', 'd') && VAR_3 != MKTAG('d', 'v', 'VAR_0', 'l')) goto fail; ast = VAR_0->streams[0]->priv_data; av_freep(&VAR_0->streams[0]->codec->extradata); av_freep(&VAR_0->streams[0]->codec); av_freep(&VAR_0->streams[0]->info); av_freep(&VAR_0->streams[0]); VAR_0->nb_streams = 0; if (CONFIG_DV_DEMUXER) { avi->dv_demux = avpriv_dv_init_demux(VAR_0); if (!avi->dv_demux) goto fail; } else goto fail; VAR_0->streams[0]->priv_data = ast; avio_skip(pb, 3 * 4); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); avio_skip(pb, 4); dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; VAR_0->duration = av_rescale(dv_dur, ast->scale, ast->rate); } VAR_5 = VAR_0->nb_streams - 1; avio_skip(pb, VAR_7 - 9 * 4); break; } assert(VAR_5 < VAR_0->nb_streams); st->codec->stream_codec_tag = VAR_3; avio_rl32(pb); avio_rl16(pb); avio_rl16(pb); avio_rl32(pb); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); if (!(ast->scale && ast->rate)) { av_log(VAR_0, AV_LOG_WARNING, "scale/rate is %"PRIu32"/%"PRIu32" which is invalid. " "(This file has been generated by broken software.)\n", ast->scale, ast->rate); if (VAR_6) { ast->rate = 1000000; ast->scale = VAR_6; } else { ast->rate = 25; ast->scale = 1; } } avpriv_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len = avio_rl32(pb); st->nb_frames = avio_rl32(pb); st->start_time = 0; avio_rl32(pb); avio_rl32(pb); ast->sample_size = avio_rl32(pb); ast->cum_len *= FFMAX(1, ast->sample_size); av_dlog(VAR_0, "%"PRIu32" %"PRIu32" %d\n", ast->rate, ast->scale, ast->sample_size); switch (VAR_2) { case MKTAG('v', 'VAR_8', 'd', 'VAR_0'): VAR_4 = AVMEDIA_TYPE_VIDEO; ast->sample_size = 0; break; case MKTAG('a', 'u', 'd', 'VAR_0'): VAR_4 = AVMEDIA_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 'VAR_0'): VAR_4 = AVMEDIA_TYPE_SUBTITLE; break; case MKTAG('d', 'a', 't', 'VAR_0'): VAR_4 = AVMEDIA_TYPE_DATA; break; default: av_log(VAR_0, AV_LOG_ERROR, "unknown stream type %X\n", VAR_2); goto fail; } if (ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset = ast->cum_len; avio_skip(pb, VAR_7 - 12 * 4); break; case MKTAG('VAR_0', 't', 'r', 'f'): if (VAR_5 >= (unsigned)VAR_0->nb_streams || avi->dv_demux) { avio_skip(pb, VAR_7); } else { uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) VAR_7 = FFMIN(VAR_7, list_end - cur_pos); st = VAR_0->streams[VAR_5]; switch (VAR_4) { case AVMEDIA_TYPE_VIDEO: if (VAR_11) { st->codec->width = VAR_9; st->codec->height = VAR_10; st->codec->VAR_4 = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_AMV; avio_skip(pb, VAR_7); break; } VAR_2 = ff_get_bmp_header(pb, st); if (VAR_2 == MKTAG('D', 'X', 'S', 'B') || VAR_2 == MKTAG('D', 'X', 'S', 'A')) { st->codec->VAR_4 = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_tag = VAR_2; st->codec->codec_id = AV_CODEC_ID_XSUB; break; } if (VAR_7 > 10 * 4 && VAR_7 < (1 << 30)) { st->codec->extradata_size = VAR_7 - 10 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); } avio_read(pb, st->codec->extradata, st->codec->extradata_size); } if (st->codec->extradata_size & 1) avio_r8(pb); if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { int VAR_14 = (1 << st->codec->bits_per_coded_sample) << 2; const uint8_t *VAR_15; VAR_14 = FFMIN(VAR_14, st->codec->extradata_size); VAR_15 = st->codec->extradata + st->codec->extradata_size - VAR_14; #if HAVE_BIGENDIAN for (VAR_8 = 0; VAR_8 < VAR_14 / 4; VAR_8++) ast->pal[VAR_8] = av_bswap32(((uint32_t *)VAR_15)[VAR_8]); #else memcpy(ast->pal, VAR_15, VAR_14); #endif ast->has_pal = 1; } print_tag("video", VAR_2, 0); st->codec->VAR_4 = AVMEDIA_TYPE_VIDEO; st->codec->codec_tag = VAR_2; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, VAR_2); st->need_parsing = AVSTREAM_PARSE_HEADERS; if (VAR_2 == MKTAG('A', 'V', 'R', 'n') && st->codec->extradata_size >= 31 && !memcmp(&st->codec->extradata[28], "1:1", 3)) st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; if (st->codec->codec_tag == 0 && st->codec->height > 0 && st->codec->extradata_size < 1U << 30) { st->codec->extradata_size += 9; if ((VAR_12 = av_reallocp(&st->codec->extradata, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return VAR_12; } else memcpy(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9); } st->codec->height = FFABS(st->codec->height); break; case AVMEDIA_TYPE_AUDIO: VAR_12 = ff_get_wav_header(pb, st->codec, VAR_7); if (VAR_12 < 0) return VAR_12; ast->dshow_block_align = st->codec->block_align; if (ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align) { av_log(VAR_0, AV_LOG_WARNING, "sample VAR_7 (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size = st->codec->block_align; } if (VAR_7 & 1) avio_skip(pb, 1); st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; if (st->codec->codec_id == AV_CODEC_ID_AAC && st->codec->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->stream_codec_tag == AV_RL32("Axan")) { st->codec->codec_id = AV_CODEC_ID_XAN_DPCM; st->codec->codec_tag = 0; } if (VAR_11) { st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV; ast->dshow_block_align = 0; } break; case AVMEDIA_TYPE_SUBTITLE: st->codec->VAR_4 = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_PROBE; break; default: st->codec->VAR_4 = AVMEDIA_TYPE_DATA; st->codec->codec_id = AV_CODEC_ID_NONE; st->codec->codec_tag = 0; avio_skip(pb, VAR_7); break; } } break; case MKTAG('VAR_8', 'n', 'd', 'x'): VAR_8 = avio_tell(pb); if (pb->seekable && !(VAR_0->flags & AVFMT_FLAG_IGNIDX) && read_braindead_odml_indx(VAR_0, 0) < 0 && (VAR_0->error_recognition & AV_EF_EXPLODE)) goto fail; avio_seek(pb, VAR_8 + VAR_7, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if (VAR_5 < (unsigned)VAR_0->nb_streams && VAR_7 > 9 * 4) { AVRational active, active_aspect; st = VAR_0->streams[VAR_5]; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); active_aspect.den = avio_rl16(pb); active_aspect.num = avio_rl16(pb); active.num = avio_rl32(pb); active.den = avio_rl32(pb); avio_rl32(pb); if (active_aspect.num && active_aspect.den && active.num && active.den) { st->sample_aspect_ratio = av_div_q(active_aspect, active); av_dlog(VAR_0, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den); } VAR_7 -= 9 * 4; } avio_skip(pb, VAR_7); break; case MKTAG('VAR_0', 't', 'r', 'n'): if (VAR_0->nb_streams) { VAR_12 = avi_read_tag(VAR_0, VAR_0->streams[VAR_0->nb_streams - 1], VAR_1, VAR_7); if (VAR_12 < 0) return VAR_12; break; } default: if (VAR_7 > 1000000) { av_log(VAR_0, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); if (VAR_0->error_recognition & AV_EF_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avio_size(pb); goto end_of_header; } VAR_7 += (VAR_7 & 1); avio_skip(pb, VAR_7); break; } } end_of_header: if (VAR_5 != VAR_0->nb_streams - 1) { fail: return AVERROR_INVALIDDATA; } if (!avi->index_loaded && pb->seekable) avi_load_index(VAR_0); avi->index_loaded = 1; avi->non_interleaved |= guess_ni_flag(VAR_0); for (VAR_8 = 0; VAR_8 < VAR_0->nb_streams; VAR_8++) { AVStream *st = VAR_0->streams[VAR_8]; if (st->nb_index_entries) break; } if (VAR_8 == VAR_0->nb_streams && avi->non_interleaved) { av_log(VAR_0, AV_LOG_WARNING, "Non-interleaved AVI without index, switching to interleaved\n"); avi->non_interleaved = 0; } if (avi->non_interleaved) { av_log(VAR_0, AV_LOG_INFO, "non-interleaved AVI\n"); clean_index(VAR_0); } ff_metadata_conv_ctx(VAR_0, NULL, avi_metadata_conv); ff_metadata_conv_ctx(VAR_0, NULL, ff_riff_info_conv); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVIContext *avi = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "unsigned int VAR_1, VAR_2, VAR_3;", "int VAR_4, VAR_5, VAR_6;", "unsigned int VAR_7;", "int VAR_8;", "AVStream *st;", "AVIStream *ast = NULL;", "int VAR_9 = 0, VAR_10 = 0;", "int VAR_11 = 0;", "uint64_t list_end = 0;", "int VAR_12;", "avi->VAR_5 = -1;", "VAR_12 = get_riff(VAR_0, pb);", "if (VAR_12 < 0)\nreturn VAR_12;", "avi->fsize = avio_size(pb);", "if (avi->fsize <= 0)\navi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end;", "VAR_5 = -1;", "VAR_4 = -1;", "VAR_6 = 0;", "for (;;) {", "if (pb->eof_reached)\ngoto fail;", "VAR_1 = avio_rl32(pb);", "VAR_7 = avio_rl32(pb);", "print_tag(\"VAR_1\", VAR_1, VAR_7);", "switch (VAR_1) {", "case MKTAG('L', 'I', 'S', 'T'):\nlist_end = avio_tell(pb) + VAR_7;", "VAR_2 = avio_rl32(pb);", "print_tag(\"list\", VAR_2, 0);", "if (VAR_2 == MKTAG('m', 'o', 'v', 'VAR_8')) {", "avi->movi_list = avio_tell(pb) - 4;", "if (VAR_7)\navi->movi_end = avi->movi_list + VAR_7 + (VAR_7 & 1);", "else\navi->movi_end = avio_size(pb);", "av_dlog(NULL, \"movi end=%\"PRIx64\"\\n\", avi->movi_end);", "goto end_of_header;", "} else if (VAR_2 == MKTAG('I', 'N', 'F', 'O'))", "ff_read_riff_info(VAR_0, VAR_7 - 4);", "else if (VAR_2 == MKTAG('n', 'c', 'd', 't'))\navi_read_nikon(VAR_0, list_end);", "break;", "case MKTAG('I', 'D', 'I', 'T'):\n{", "unsigned char VAR_13[64] = { 0 };", "VAR_7 += (VAR_7 & 1);", "VAR_7 -= avio_read(pb, VAR_13, FFMIN(VAR_7, sizeof(VAR_13) - 1));", "avio_skip(pb, VAR_7);", "avi_metadata_creation_time(&VAR_0->metadata, VAR_13);", "break;", "}", "case MKTAG('d', 'm', 'l', 'h'):\navi->is_odml = 1;", "avio_skip(pb, VAR_7 + (VAR_7 & 1));", "break;", "case MKTAG('a', 'm', 'v', 'h'):\nVAR_11 = 1;", "case MKTAG('a', 'v', 'VAR_8', 'h'):\nVAR_6 = avio_rl32(pb);", "avio_skip(pb, 4);", "avio_rl32(pb);", "avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX;", "avio_skip(pb, 2 * 4);", "avio_rl32(pb);", "avio_rl32(pb);", "VAR_9 = avio_rl32(pb);", "VAR_10 = avio_rl32(pb);", "avio_skip(pb, VAR_7 - 10 * 4);", "break;", "case MKTAG('VAR_0', 't', 'r', 'h'):\nVAR_2 = avio_rl32(pb);", "VAR_3 = avio_rl32(pb);", "if (VAR_2 == MKTAG('p', 'a', 'd', 'VAR_0')) {", "avio_skip(pb, VAR_7 - 8);", "break;", "} else {", "VAR_5++;", "st = avformat_new_stream(VAR_0, NULL);", "if (!st)\ngoto fail;", "st->id = VAR_5;", "ast = av_mallocz(sizeof(AVIStream));", "if (!ast)\ngoto fail;", "st->priv_data = ast;", "}", "if (VAR_11)\nVAR_2 = VAR_5 ? MKTAG('a', 'u', 'd', 'VAR_0')\n: MKTAG('v', 'VAR_8', 'd', 'VAR_0');", "print_tag(\"strh\", VAR_2, -1);", "if (VAR_2 == MKTAG('VAR_8', 'a', 'v', 'VAR_0') ||\nVAR_2 == MKTAG('VAR_8', 'v', 'a', 'VAR_0')) {", "int64_t dv_dur;", "if (VAR_0->nb_streams != 1)\ngoto fail;", "if (VAR_3 != MKTAG('d', 'v', 'VAR_0', 'd') &&\nVAR_3 != MKTAG('d', 'v', 'h', 'd') &&\nVAR_3 != MKTAG('d', 'v', 'VAR_0', 'l'))\ngoto fail;", "ast = VAR_0->streams[0]->priv_data;", "av_freep(&VAR_0->streams[0]->codec->extradata);", "av_freep(&VAR_0->streams[0]->codec);", "av_freep(&VAR_0->streams[0]->info);", "av_freep(&VAR_0->streams[0]);", "VAR_0->nb_streams = 0;", "if (CONFIG_DV_DEMUXER) {", "avi->dv_demux = avpriv_dv_init_demux(VAR_0);", "if (!avi->dv_demux)\ngoto fail;", "} else", "goto fail;", "VAR_0->streams[0]->priv_data = ast;", "avio_skip(pb, 3 * 4);", "ast->scale = avio_rl32(pb);", "ast->rate = avio_rl32(pb);", "avio_skip(pb, 4);", "dv_dur = avio_rl32(pb);", "if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {", "dv_dur *= AV_TIME_BASE;", "VAR_0->duration = av_rescale(dv_dur, ast->scale, ast->rate);", "}", "VAR_5 = VAR_0->nb_streams - 1;", "avio_skip(pb, VAR_7 - 9 * 4);", "break;", "}", "assert(VAR_5 < VAR_0->nb_streams);", "st->codec->stream_codec_tag = VAR_3;", "avio_rl32(pb);", "avio_rl16(pb);", "avio_rl16(pb);", "avio_rl32(pb);", "ast->scale = avio_rl32(pb);", "ast->rate = avio_rl32(pb);", "if (!(ast->scale && ast->rate)) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"scale/rate is %\"PRIu32\"/%\"PRIu32\" which is invalid. \"\n\"(This file has been generated by broken software.)\\n\",\nast->scale,\nast->rate);", "if (VAR_6) {", "ast->rate = 1000000;", "ast->scale = VAR_6;", "} else {", "ast->rate = 25;", "ast->scale = 1;", "}", "}", "avpriv_set_pts_info(st, 64, ast->scale, ast->rate);", "ast->cum_len = avio_rl32(pb);", "st->nb_frames = avio_rl32(pb);", "st->start_time = 0;", "avio_rl32(pb);", "avio_rl32(pb);", "ast->sample_size = avio_rl32(pb);", "ast->cum_len *= FFMAX(1, ast->sample_size);", "av_dlog(VAR_0, \"%\"PRIu32\" %\"PRIu32\" %d\\n\",\nast->rate, ast->scale, ast->sample_size);", "switch (VAR_2) {", "case MKTAG('v', 'VAR_8', 'd', 'VAR_0'):\nVAR_4 = AVMEDIA_TYPE_VIDEO;", "ast->sample_size = 0;", "break;", "case MKTAG('a', 'u', 'd', 'VAR_0'):\nVAR_4 = AVMEDIA_TYPE_AUDIO;", "break;", "case MKTAG('t', 'x', 't', 'VAR_0'):\nVAR_4 = AVMEDIA_TYPE_SUBTITLE;", "break;", "case MKTAG('d', 'a', 't', 'VAR_0'):\nVAR_4 = AVMEDIA_TYPE_DATA;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"unknown stream type %X\\n\", VAR_2);", "goto fail;", "}", "if (ast->sample_size == 0)\nst->duration = st->nb_frames;", "ast->frame_offset = ast->cum_len;", "avio_skip(pb, VAR_7 - 12 * 4);", "break;", "case MKTAG('VAR_0', 't', 'r', 'f'):\nif (VAR_5 >= (unsigned)VAR_0->nb_streams || avi->dv_demux) {", "avio_skip(pb, VAR_7);", "} else {", "uint64_t cur_pos = avio_tell(pb);", "if (cur_pos < list_end)\nVAR_7 = FFMIN(VAR_7, list_end - cur_pos);", "st = VAR_0->streams[VAR_5];", "switch (VAR_4) {", "case AVMEDIA_TYPE_VIDEO:\nif (VAR_11) {", "st->codec->width = VAR_9;", "st->codec->height = VAR_10;", "st->codec->VAR_4 = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = AV_CODEC_ID_AMV;", "avio_skip(pb, VAR_7);", "break;", "}", "VAR_2 = ff_get_bmp_header(pb, st);", "if (VAR_2 == MKTAG('D', 'X', 'S', 'B') ||\nVAR_2 == MKTAG('D', 'X', 'S', 'A')) {", "st->codec->VAR_4 = AVMEDIA_TYPE_SUBTITLE;", "st->codec->codec_tag = VAR_2;", "st->codec->codec_id = AV_CODEC_ID_XSUB;", "break;", "}", "if (VAR_7 > 10 * 4 && VAR_7 < (1 << 30)) {", "st->codec->extradata_size = VAR_7 - 10 * 4;", "st->codec->extradata = av_malloc(st->codec->extradata_size +\nFF_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata) {", "st->codec->extradata_size = 0;", "return AVERROR(ENOMEM);", "}", "avio_read(pb,\nst->codec->extradata,\nst->codec->extradata_size);", "}", "if (st->codec->extradata_size & 1)\navio_r8(pb);", "if (st->codec->extradata_size &&\n(st->codec->bits_per_coded_sample <= 8)) {", "int VAR_14 = (1 << st->codec->bits_per_coded_sample) << 2;", "const uint8_t *VAR_15;", "VAR_14 = FFMIN(VAR_14, st->codec->extradata_size);", "VAR_15 = st->codec->extradata +\nst->codec->extradata_size - VAR_14;", "#if HAVE_BIGENDIAN\nfor (VAR_8 = 0; VAR_8 < VAR_14 / 4; VAR_8++)", "ast->pal[VAR_8] = av_bswap32(((uint32_t *)VAR_15)[VAR_8]);", "#else\nmemcpy(ast->pal, VAR_15, VAR_14);", "#endif\nast->has_pal = 1;", "}", "print_tag(\"video\", VAR_2, 0);", "st->codec->VAR_4 = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_tag = VAR_2;", "st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags,\nVAR_2);", "st->need_parsing = AVSTREAM_PARSE_HEADERS;", "if (VAR_2 == MKTAG('A', 'V', 'R', 'n') &&\nst->codec->extradata_size >= 31 &&\n!memcmp(&st->codec->extradata[28], \"1:1\", 3))\nst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;", "if (st->codec->codec_tag == 0 && st->codec->height > 0 &&\nst->codec->extradata_size < 1U << 30) {", "st->codec->extradata_size += 9;", "if ((VAR_12 = av_reallocp(&st->codec->extradata,\nst->codec->extradata_size +\nFF_INPUT_BUFFER_PADDING_SIZE)) < 0) {", "st->codec->extradata_size = 0;", "return VAR_12;", "} else", "memcpy(st->codec->extradata + st->codec->extradata_size - 9,\n\"BottomUp\", 9);", "}", "st->codec->height = FFABS(st->codec->height);", "break;", "case AVMEDIA_TYPE_AUDIO:\nVAR_12 = ff_get_wav_header(pb, st->codec, VAR_7);", "if (VAR_12 < 0)\nreturn VAR_12;", "ast->dshow_block_align = st->codec->block_align;", "if (ast->sample_size && st->codec->block_align &&\nast->sample_size != st->codec->block_align) {", "av_log(VAR_0,\nAV_LOG_WARNING,\n\"sample VAR_7 (%d) != block align (%d)\\n\",\nast->sample_size,\nst->codec->block_align);", "ast->sample_size = st->codec->block_align;", "}", "if (VAR_7 & 1)\navio_skip(pb, 1);", "st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;", "if (st->codec->codec_id == AV_CODEC_ID_AAC &&\nst->codec->extradata_size)\nst->need_parsing = AVSTREAM_PARSE_NONE;", "if (st->codec->stream_codec_tag == AV_RL32(\"Axan\")) {", "st->codec->codec_id = AV_CODEC_ID_XAN_DPCM;", "st->codec->codec_tag = 0;", "}", "if (VAR_11) {", "st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV;", "ast->dshow_block_align = 0;", "}", "break;", "case AVMEDIA_TYPE_SUBTITLE:\nst->codec->VAR_4 = AVMEDIA_TYPE_SUBTITLE;", "st->codec->codec_id = AV_CODEC_ID_PROBE;", "break;", "default:\nst->codec->VAR_4 = AVMEDIA_TYPE_DATA;", "st->codec->codec_id = AV_CODEC_ID_NONE;", "st->codec->codec_tag = 0;", "avio_skip(pb, VAR_7);", "break;", "}", "}", "break;", "case MKTAG('VAR_8', 'n', 'd', 'x'):\nVAR_8 = avio_tell(pb);", "if (pb->seekable && !(VAR_0->flags & AVFMT_FLAG_IGNIDX) &&\nread_braindead_odml_indx(VAR_0, 0) < 0 &&\n(VAR_0->error_recognition & AV_EF_EXPLODE))\ngoto fail;", "avio_seek(pb, VAR_8 + VAR_7, SEEK_SET);", "break;", "case MKTAG('v', 'p', 'r', 'p'):\nif (VAR_5 < (unsigned)VAR_0->nb_streams && VAR_7 > 9 * 4) {", "AVRational active, active_aspect;", "st = VAR_0->streams[VAR_5];", "avio_rl32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "active_aspect.den = avio_rl16(pb);", "active_aspect.num = avio_rl16(pb);", "active.num = avio_rl32(pb);", "active.den = avio_rl32(pb);", "avio_rl32(pb);", "if (active_aspect.num && active_aspect.den &&\nactive.num && active.den) {", "st->sample_aspect_ratio = av_div_q(active_aspect, active);", "av_dlog(VAR_0, \"vprp %d/%d %d/%d\\n\",\nactive_aspect.num, active_aspect.den,\nactive.num, active.den);", "}", "VAR_7 -= 9 * 4;", "}", "avio_skip(pb, VAR_7);", "break;", "case MKTAG('VAR_0', 't', 'r', 'n'):\nif (VAR_0->nb_streams) {", "VAR_12 = avi_read_tag(VAR_0, VAR_0->streams[VAR_0->nb_streams - 1], VAR_1, VAR_7);", "if (VAR_12 < 0)\nreturn VAR_12;", "break;", "}", "default:\nif (VAR_7 > 1000000) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Something went wrong during header parsing, \"\n\"I will ignore it and try to continue anyway.\\n\");", "if (VAR_0->error_recognition & AV_EF_EXPLODE)\ngoto fail;", "avi->movi_list = avio_tell(pb) - 4;", "avi->movi_end = avio_size(pb);", "goto end_of_header;", "}", "VAR_7 += (VAR_7 & 1);", "avio_skip(pb, VAR_7);", "break;", "}", "}", "end_of_header:\nif (VAR_5 != VAR_0->nb_streams - 1) {", "fail:\nreturn AVERROR_INVALIDDATA;", "}", "if (!avi->index_loaded && pb->seekable)\navi_load_index(VAR_0);", "avi->index_loaded = 1;", "avi->non_interleaved |= guess_ni_flag(VAR_0);", "for (VAR_8 = 0; VAR_8 < VAR_0->nb_streams; VAR_8++) {", "AVStream *st = VAR_0->streams[VAR_8];", "if (st->nb_index_entries)\nbreak;", "}", "if (VAR_8 == VAR_0->nb_streams && avi->non_interleaved) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Non-interleaved AVI without index, switching to interleaved\\n\");", "avi->non_interleaved = 0;", "}", "if (avi->non_interleaved) {", "av_log(VAR_0, AV_LOG_INFO, \"non-interleaved AVI\\n\");", "clean_index(VAR_0);", "}", "ff_metadata_conv_ctx(VAR_0, NULL, avi_metadata_conv);", "ff_metadata_conv_ctx(VAR_0, NULL, ff_riff_info_conv);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 45, 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181, 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223, 225, 227 ], [ 231 ], [ 235, 237 ], [ 239 ], [ 247, 249 ], [ 253, 255, 257, 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347, 349, 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 375 ], [ 377 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393 ], [ 397 ], [ 399, 401 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415, 417 ], [ 419 ], [ 421, 423 ], [ 425 ], [ 427, 429 ], [ 431 ], [ 433 ], [ 435, 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445, 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457, 459 ], [ 461 ], [ 463 ], [ 465, 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 487, 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 503 ], [ 505 ], [ 507, 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519, 521, 523 ], [ 525 ], [ 531, 533 ], [ 545, 547 ], [ 549 ], [ 551 ], [ 555 ], [ 557, 559 ], [ 561, 563 ], [ 565 ], [ 567, 569 ], [ 571, 573 ], [ 575 ], [ 579 ], [ 583 ], [ 585 ], [ 587, 589 ], [ 595 ], [ 599, 601, 603, 605 ], [ 609, 611 ], [ 613 ], [ 615, 617, 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627, 629 ], [ 631 ], [ 633 ], [ 639 ], [ 641, 643 ], [ 645, 647 ], [ 649 ], [ 651, 653 ], [ 655, 657, 659, 661, 663 ], [ 665 ], [ 667 ], [ 673, 675 ], [ 681 ], [ 689, 691, 693 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717, 719 ], [ 721 ], [ 723 ], [ 725, 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743, 745 ], [ 747, 749, 751, 753 ], [ 755 ], [ 757 ], [ 759, 761 ], [ 763 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 789 ], [ 793, 795 ], [ 797 ], [ 799, 801, 803 ], [ 805 ], [ 807 ], [ 809 ], [ 811 ], [ 813 ], [ 815, 817 ], [ 819 ], [ 821, 823 ], [ 825 ], [ 827 ], [ 829, 831 ], [ 833, 835, 837 ], [ 839, 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849 ], [ 853 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 865, 869 ], [ 873, 875 ], [ 877 ], [ 881, 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893, 895 ], [ 897 ], [ 899 ], [ 901, 903 ], [ 905 ], [ 907 ], [ 911 ], [ 913 ], [ 915 ], [ 917 ], [ 921 ], [ 923 ], [ 927 ], [ 929 ] ]
10,998
static void phys_page_set(AddressSpaceDispatch *d, hwaddr index, hwaddr nb, uint16_t leaf) { /* Wildly overreserve - it doesn't matter much. */ phys_map_node_reserve(3 * P_L2_LEVELS); phys_page_set_level(&d->phys_map, &index, &nb, leaf, P_L2_LEVELS - 1); }
false
qemu
53cb28cbfea038f8ad50132dc8a684e638c7d48b
static void phys_page_set(AddressSpaceDispatch *d, hwaddr index, hwaddr nb, uint16_t leaf) { phys_map_node_reserve(3 * P_L2_LEVELS); phys_page_set_level(&d->phys_map, &index, &nb, leaf, P_L2_LEVELS - 1); }
{ "code": [], "line_no": [] }
static void FUNC_0(AddressSpaceDispatch *VAR_0, hwaddr VAR_1, hwaddr VAR_2, uint16_t VAR_3) { phys_map_node_reserve(3 * P_L2_LEVELS); phys_page_set_level(&VAR_0->phys_map, &VAR_1, &VAR_2, VAR_3, P_L2_LEVELS - 1); }
[ "static void FUNC_0(AddressSpaceDispatch *VAR_0,\nhwaddr VAR_1, hwaddr VAR_2,\nuint16_t VAR_3)\n{", "phys_map_node_reserve(3 * P_L2_LEVELS);", "phys_page_set_level(&VAR_0->phys_map, &VAR_1, &VAR_2, VAR_3, P_L2_LEVELS - 1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 11 ], [ 15 ], [ 17 ] ]
11,000
static av_cold int g726_decode_init(AVCodecContext *avctx) { G726Context* c = avctx->priv_data; if (avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n"); return -1; } if(avctx->channels != 1){ av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); return -1; } c->code_size = avctx->bits_per_coded_sample; if (c->code_size < 2 || c->code_size > 5) { av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size); return AVERROR(EINVAL); } g726_reset(c, c->code_size - 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; }
false
FFmpeg
6e8d4a7afbf40c0eb4bd70a6e7724d22ce7a6239
static av_cold int g726_decode_init(AVCodecContext *avctx) { G726Context* c = avctx->priv_data; if (avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n"); return -1; } if(avctx->channels != 1){ av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); return -1; } c->code_size = avctx->bits_per_coded_sample; if (c->code_size < 2 || c->code_size > 5) { av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size); return AVERROR(EINVAL); } g726_reset(c, c->code_size - 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { G726Context* c = avctx->priv_data; if (avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n"); return -1; } if(avctx->channels != 1){ av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); return -1; } c->code_size = avctx->bits_per_coded_sample; if (c->code_size < 2 || c->code_size > 5) { av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size); return AVERROR(EINVAL); } g726_reset(c, c->code_size - 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "G726Context* c = avctx->priv_data;", "if (avctx->sample_rate <= 0) {", "av_log(avctx, AV_LOG_ERROR, \"Samplerate is invalid\\n\");", "return -1;", "}", "if(avctx->channels != 1){", "av_log(avctx, AV_LOG_ERROR, \"Only mono is supported\\n\");", "return -1;", "}", "c->code_size = avctx->bits_per_coded_sample;", "if (c->code_size < 2 || c->code_size > 5) {", "av_log(avctx, AV_LOG_ERROR, \"Invalid number of bits %d\\n\", c->code_size);", "return AVERROR(EINVAL);", "}", "g726_reset(c, c->code_size - 2);", "avctx->sample_fmt = AV_SAMPLE_FMT_S16;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ] ]
11,001
static uint32_t isa_mmio_readw(void *opaque, target_phys_addr_t addr) { return cpu_inw(addr & IOPORTS_MASK); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint32_t isa_mmio_readw(void *opaque, target_phys_addr_t addr) { return cpu_inw(addr & IOPORTS_MASK); }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr) { return cpu_inw(addr & IOPORTS_MASK); }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{", "return cpu_inw(addr & IOPORTS_MASK);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,002
static void unassign_storage(SCLPDevice *sclp, SCCB *sccb) { MemoryRegion *mr = NULL; AssignStorage *assign_info = (AssignStorage *) sccb; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); assert(mhd); ram_addr_t unassign_addr = (assign_info->rn - 1) * mhd->rzm; MemoryRegion *sysmem = get_system_memory(); /* if the addr is a multiple of 256 MB */ if ((unassign_addr % MEM_SECTION_SIZE == 0) && (unassign_addr >= mhd->padded_ram_size)) { mhd->standby_state_map[(unassign_addr - mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0; /* find the specified memory region and destroy it */ mr = memory_region_find(sysmem, unassign_addr, 1).mr; memory_region_unref(mr); if (mr) { int i; int is_removable = 1; ram_addr_t map_offset = (unassign_addr - mhd->padded_ram_size - (unassign_addr - mhd->padded_ram_size) % mhd->standby_subregion_size); /* Mark all affected subregions as 'standby' once again */ for (i = 0; i < (mhd->standby_subregion_size / MEM_SECTION_SIZE); i++) { if (mhd->standby_state_map[i + map_offset / MEM_SECTION_SIZE]) { is_removable = 0; break; } } if (is_removable) { memory_region_del_subregion(sysmem, mr); object_unref(OBJECT(mr)); } } } sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); }
false
qemu
b02ef3d92b19ad304a84433d3817f0903296ebc7
static void unassign_storage(SCLPDevice *sclp, SCCB *sccb) { MemoryRegion *mr = NULL; AssignStorage *assign_info = (AssignStorage *) sccb; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); assert(mhd); ram_addr_t unassign_addr = (assign_info->rn - 1) * mhd->rzm; MemoryRegion *sysmem = get_system_memory(); if ((unassign_addr % MEM_SECTION_SIZE == 0) && (unassign_addr >= mhd->padded_ram_size)) { mhd->standby_state_map[(unassign_addr - mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0; mr = memory_region_find(sysmem, unassign_addr, 1).mr; memory_region_unref(mr); if (mr) { int i; int is_removable = 1; ram_addr_t map_offset = (unassign_addr - mhd->padded_ram_size - (unassign_addr - mhd->padded_ram_size) % mhd->standby_subregion_size); for (i = 0; i < (mhd->standby_subregion_size / MEM_SECTION_SIZE); i++) { if (mhd->standby_state_map[i + map_offset / MEM_SECTION_SIZE]) { is_removable = 0; break; } } if (is_removable) { memory_region_del_subregion(sysmem, mr); object_unref(OBJECT(mr)); } } } sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCLPDevice *VAR_0, SCCB *VAR_1) { MemoryRegion *mr = NULL; AssignStorage *assign_info = (AssignStorage *) VAR_1; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); assert(mhd); ram_addr_t unassign_addr = (assign_info->rn - 1) * mhd->rzm; MemoryRegion *sysmem = get_system_memory(); if ((unassign_addr % MEM_SECTION_SIZE == 0) && (unassign_addr >= mhd->padded_ram_size)) { mhd->standby_state_map[(unassign_addr - mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0; mr = memory_region_find(sysmem, unassign_addr, 1).mr; memory_region_unref(mr); if (mr) { int VAR_2; int VAR_3 = 1; ram_addr_t map_offset = (unassign_addr - mhd->padded_ram_size - (unassign_addr - mhd->padded_ram_size) % mhd->standby_subregion_size); for (VAR_2 = 0; VAR_2 < (mhd->standby_subregion_size / MEM_SECTION_SIZE); VAR_2++) { if (mhd->standby_state_map[VAR_2 + map_offset / MEM_SECTION_SIZE]) { VAR_3 = 0; break; } } if (VAR_3) { memory_region_del_subregion(sysmem, mr); object_unref(OBJECT(mr)); } } } VAR_1->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION); }
[ "static void FUNC_0(SCLPDevice *VAR_0, SCCB *VAR_1)\n{", "MemoryRegion *mr = NULL;", "AssignStorage *assign_info = (AssignStorage *) VAR_1;", "sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();", "assert(mhd);", "ram_addr_t unassign_addr = (assign_info->rn - 1) * mhd->rzm;", "MemoryRegion *sysmem = get_system_memory();", "if ((unassign_addr % MEM_SECTION_SIZE == 0) &&\n(unassign_addr >= mhd->padded_ram_size)) {", "mhd->standby_state_map[(unassign_addr -\nmhd->padded_ram_size) / MEM_SECTION_SIZE] = 0;", "mr = memory_region_find(sysmem, unassign_addr, 1).mr;", "memory_region_unref(mr);", "if (mr) {", "int VAR_2;", "int VAR_3 = 1;", "ram_addr_t map_offset = (unassign_addr - mhd->padded_ram_size -\n(unassign_addr - mhd->padded_ram_size)\n% mhd->standby_subregion_size);", "for (VAR_2 = 0;", "VAR_2 < (mhd->standby_subregion_size / MEM_SECTION_SIZE);", "VAR_2++) {", "if (mhd->standby_state_map[VAR_2 + map_offset / MEM_SECTION_SIZE]) {", "VAR_3 = 0;", "break;", "}", "}", "if (VAR_3) {", "memory_region_del_subregion(sysmem, mr);", "object_unref(OBJECT(mr));", "}", "}", "}", "VAR_1->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 25, 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
11,003
static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { return bdrv_get_info(bs->file->bs, bdi); }
false
qemu
2e6fc7eb1a4af1b127df5f07b8bb28af891946fa
static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { return bdrv_get_info(bs->file->bs, bdi); }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BlockDriverInfo *VAR_1) { return bdrv_get_info(VAR_0->file->VAR_0, VAR_1); }
[ "static int FUNC_0(BlockDriverState *VAR_0, BlockDriverInfo *VAR_1)\n{", "return bdrv_get_info(VAR_0->file->VAR_0, VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,004
static int nbd_co_writev_1(NbdClientSession *client, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int offset) { struct nbd_request request = { .type = NBD_CMD_WRITE }; struct nbd_reply reply; ssize_t ret; if (!bdrv_enable_write_cache(client->bs) && (client->nbdflags & NBD_FLAG_SEND_FUA)) { request.type |= NBD_CMD_FLAG_FUA; } request.from = sector_num * 512; request.len = nb_sectors * 512; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(client, &request, qiov, offset); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL, 0); } nbd_coroutine_end(client, &request); return -reply.error; }
false
qemu
f53a829bb9ef14be800556cbc02d8b20fc1050a7
static int nbd_co_writev_1(NbdClientSession *client, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, int offset) { struct nbd_request request = { .type = NBD_CMD_WRITE }; struct nbd_reply reply; ssize_t ret; if (!bdrv_enable_write_cache(client->bs) && (client->nbdflags & NBD_FLAG_SEND_FUA)) { request.type |= NBD_CMD_FLAG_FUA; } request.from = sector_num * 512; request.len = nb_sectors * 512; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(client, &request, qiov, offset); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL, 0); } nbd_coroutine_end(client, &request); return -reply.error; }
{ "code": [], "line_no": [] }
static int FUNC_0(NbdClientSession *VAR_0, int64_t VAR_1, int VAR_2, QEMUIOVector *VAR_3, int VAR_4) { struct nbd_request VAR_5 = { .type = NBD_CMD_WRITE }; struct nbd_reply VAR_6; ssize_t ret; if (!bdrv_enable_write_cache(VAR_0->bs) && (VAR_0->nbdflags & NBD_FLAG_SEND_FUA)) { VAR_5.type |= NBD_CMD_FLAG_FUA; } VAR_5.from = VAR_1 * 512; VAR_5.len = VAR_2 * 512; nbd_coroutine_start(VAR_0, &VAR_5); ret = nbd_co_send_request(VAR_0, &VAR_5, VAR_3, VAR_4); if (ret < 0) { VAR_6.error = -ret; } else { nbd_co_receive_reply(VAR_0, &VAR_5, &VAR_6, NULL, 0); } nbd_coroutine_end(VAR_0, &VAR_5); return -VAR_6.error; }
[ "static int FUNC_0(NbdClientSession *VAR_0, int64_t VAR_1,\nint VAR_2, QEMUIOVector *VAR_3,\nint VAR_4)\n{", "struct nbd_request VAR_5 = { .type = NBD_CMD_WRITE };", "struct nbd_reply VAR_6;", "ssize_t ret;", "if (!bdrv_enable_write_cache(VAR_0->bs) &&\n(VAR_0->nbdflags & NBD_FLAG_SEND_FUA)) {", "VAR_5.type |= NBD_CMD_FLAG_FUA;", "}", "VAR_5.from = VAR_1 * 512;", "VAR_5.len = VAR_2 * 512;", "nbd_coroutine_start(VAR_0, &VAR_5);", "ret = nbd_co_send_request(VAR_0, &VAR_5, VAR_3, VAR_4);", "if (ret < 0) {", "VAR_6.error = -ret;", "} else {", "nbd_co_receive_reply(VAR_0, &VAR_5, &VAR_6, NULL, 0);", "}", "nbd_coroutine_end(VAR_0, &VAR_5);", "return -VAR_6.error;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
11,005
START_TEST(simple_whitespace) { int i; struct { const char *encoded; LiteralQObject decoded; } test_cases[] = { { .encoded = " [ 43 , 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QINT(42), { } })), }, { .encoded = " [ 43 , { 'h' : 'b' }, [ ], 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QDICT(((LiteralQDictEntry[]){ { "h", QLIT_QSTR("b") }, { }})), QLIT_QLIST(((LiteralQObject[]){ { }})), QLIT_QINT(42), { } })), }, { .encoded = " [ 43 , { 'h' : 'b' , 'a' : 32 }, [ ], 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QDICT(((LiteralQDictEntry[]){ { "h", QLIT_QSTR("b") }, { "a", QLIT_QINT(32) }, { }})), QLIT_QLIST(((LiteralQObject[]){ { }})), QLIT_QINT(42), { } })), }, { } }; for (i = 0; test_cases[i].encoded; i++) { QObject *obj; QString *str; obj = qobject_from_json(test_cases[i].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QLIST); fail_unless(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1); str = qobject_to_json(obj); qobject_decref(obj); obj = qobject_from_json(qstring_get_str(str)); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QLIST); fail_unless(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1); qobject_decref(obj); QDECREF(str); } }
false
qemu
ef76dc59fa5203d146a2acf85a0ad5a5971a4824
START_TEST(simple_whitespace) { int i; struct { const char *encoded; LiteralQObject decoded; } test_cases[] = { { .encoded = " [ 43 , 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QINT(42), { } })), }, { .encoded = " [ 43 , { 'h' : 'b' }, [ ], 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QDICT(((LiteralQDictEntry[]){ { "h", QLIT_QSTR("b") }, { }})), QLIT_QLIST(((LiteralQObject[]){ { }})), QLIT_QINT(42), { } })), }, { .encoded = " [ 43 , { 'h' : 'b' , 'a' : 32 }, [ ], 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QDICT(((LiteralQDictEntry[]){ { "h", QLIT_QSTR("b") }, { "a", QLIT_QINT(32) }, { }})), QLIT_QLIST(((LiteralQObject[]){ { }})), QLIT_QINT(42), { } })), }, { } }; for (i = 0; test_cases[i].encoded; i++) { QObject *obj; QString *str; obj = qobject_from_json(test_cases[i].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QLIST); fail_unless(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1); str = qobject_to_json(obj); qobject_decref(obj); obj = qobject_from_json(qstring_get_str(str)); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QLIST); fail_unless(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1); qobject_decref(obj); QDECREF(str); } }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { int VAR_1; struct { const char *encoded; LiteralQObject decoded; } VAR_2[] = { { .encoded = " [ 43 , 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QINT(42), { } })), }, { .encoded = " [ 43 , { 'h' : 'b' }, [ ], 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QDICT(((LiteralQDictEntry[]){ { "h", QLIT_QSTR("b") }, { }})), QLIT_QLIST(((LiteralQObject[]){ { }})), QLIT_QINT(42), { } })), }, { .encoded = " [ 43 , { 'h' : 'b' , 'a' : 32 }, [ ], 42 ]", .decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(43), QLIT_QDICT(((LiteralQDictEntry[]){ { "h", QLIT_QSTR("b") }, { "a", QLIT_QINT(32) }, { }})), QLIT_QLIST(((LiteralQObject[]){ { }})), QLIT_QINT(42), { } })), }, { } }; for (VAR_1 = 0; VAR_2[VAR_1].encoded; VAR_1++) { QObject *obj; QString *str; obj = qobject_from_json(VAR_2[VAR_1].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QLIST); fail_unless(compare_litqobj_to_qobj(&VAR_2[VAR_1].decoded, obj) == 1); str = qobject_to_json(obj); qobject_decref(obj); obj = qobject_from_json(qstring_get_str(str)); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QLIST); fail_unless(compare_litqobj_to_qobj(&VAR_2[VAR_1].decoded, obj) == 1); qobject_decref(obj); QDECREF(str); } }
[ "FUNC_0(VAR_0)\n{", "int VAR_1;", "struct {", "const char *encoded;", "LiteralQObject decoded;", "} VAR_2[] = {", "{", ".encoded = \" [ 43 , 42 ]\",\n.decoded = QLIT_QLIST(((LiteralQObject[]){", "QLIT_QINT(43),\nQLIT_QINT(42),\n{ }", "})),", "},", "{", ".encoded = \" [ 43 , { 'h' : 'b' }, [ ], 42 ]\",", ".decoded = QLIT_QLIST(((LiteralQObject[]){", "QLIT_QINT(43),\nQLIT_QDICT(((LiteralQDictEntry[]){", "{ \"h\", QLIT_QSTR(\"b\") },", "{ }})),", "QLIT_QLIST(((LiteralQObject[]){", "{ }})),", "QLIT_QINT(42),\n{ }", "})),", "},", "{", ".encoded = \" [ 43 , { 'h' : 'b' , 'a' : 32 }, [ ], 42 ]\",", ".decoded = QLIT_QLIST(((LiteralQObject[]){", "QLIT_QINT(43),\nQLIT_QDICT(((LiteralQDictEntry[]){", "{ \"h\", QLIT_QSTR(\"b\") },", "{ \"a\", QLIT_QINT(32) },", "{ }})),", "QLIT_QLIST(((LiteralQObject[]){", "{ }})),", "QLIT_QINT(42),\n{ }", "})),", "},", "{ }", "};", "for (VAR_1 = 0; VAR_2[VAR_1].encoded; VAR_1++) {", "QObject *obj;", "QString *str;", "obj = qobject_from_json(VAR_2[VAR_1].encoded);", "fail_unless(obj != NULL);", "fail_unless(qobject_type(obj) == QTYPE_QLIST);", "fail_unless(compare_litqobj_to_qobj(&VAR_2[VAR_1].decoded, obj) == 1);", "str = qobject_to_json(obj);", "qobject_decref(obj);", "obj = qobject_from_json(qstring_get_str(str));", "fail_unless(obj != NULL);", "fail_unless(qobject_type(obj) == QTYPE_QLIST);", "fail_unless(compare_litqobj_to_qobj(&VAR_2[VAR_1].decoded, obj) == 1);", "qobject_decref(obj);", "QDECREF(str);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ] ]
11,007
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg) { if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map)) { return true; } return false; }
false
qemu
0c16c056a4f9dec18fdd56feec82a5db9ff3c15e
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg) { if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map)) { return true; } return false; }
{ "code": [], "line_no": [] }
gboolean FUNC_0(QCryptoHashAlgorithm alg) { if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map)) { return true; } return false; }
[ "gboolean FUNC_0(QCryptoHashAlgorithm alg)\n{", "if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map)) {", "return true;", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
11,008
static int nvic_pending_prio(NVICState *s) { /* return the priority of the current pending interrupt, * or NVIC_NOEXC_PRIO if no interrupt is pending */ return s->vectpending ? s->vectors[s->vectpending].prio : NVIC_NOEXC_PRIO; }
false
qemu
5255fcf8e47acd059e2f0d414841c40231c1bd22
static int nvic_pending_prio(NVICState *s) { return s->vectpending ? s->vectors[s->vectpending].prio : NVIC_NOEXC_PRIO; }
{ "code": [], "line_no": [] }
static int FUNC_0(NVICState *VAR_0) { return VAR_0->vectpending ? VAR_0->vectors[VAR_0->vectpending].prio : NVIC_NOEXC_PRIO; }
[ "static int FUNC_0(NVICState *VAR_0)\n{", "return VAR_0->vectpending ? VAR_0->vectors[VAR_0->vectpending].prio : NVIC_NOEXC_PRIO;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 11 ], [ 13 ] ]
11,009
static uint64_t pci_config_get_pref_base(PCIDevice *d, uint32_t base, uint32_t upper) { uint64_t val; val = ((uint64_t)pci_get_word(d->config + base) & PCI_PREF_RANGE_MASK) << 16; val |= (uint64_t)pci_get_long(d->config + upper) << 32; return val; }
false
qemu
d46636b88339ecc2cb8d10113f45ada164817773
static uint64_t pci_config_get_pref_base(PCIDevice *d, uint32_t base, uint32_t upper) { uint64_t val; val = ((uint64_t)pci_get_word(d->config + base) & PCI_PREF_RANGE_MASK) << 16; val |= (uint64_t)pci_get_long(d->config + upper) << 32; return val; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(PCIDevice *d, uint32_t base, uint32_t upper) { uint64_t val; val = ((uint64_t)pci_get_word(d->config + base) & PCI_PREF_RANGE_MASK) << 16; val |= (uint64_t)pci_get_long(d->config + upper) << 32; return val; }
[ "static uint64_t FUNC_0(PCIDevice *d,\nuint32_t base, uint32_t upper)\n{", "uint64_t val;", "val = ((uint64_t)pci_get_word(d->config + base) &\nPCI_PREF_RANGE_MASK) << 16;", "val |= (uint64_t)pci_get_long(d->config + upper) << 32;", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,010
static void qmp_output_type_enum(Visitor *v, int *obj, const char *strings[], const char *kind, const char *name, Error **errp) { int i = 0; int value = *obj; char *enum_str; assert(strings); while (strings[i++] != NULL); if (value >= i - 1) { error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null"); return; } enum_str = (char *)strings[value]; qmp_output_type_str(v, &enum_str, name, errp); }
false
qemu
54d50be688aba80e0fd5ba53f23a074a0ce2e381
static void qmp_output_type_enum(Visitor *v, int *obj, const char *strings[], const char *kind, const char *name, Error **errp) { int i = 0; int value = *obj; char *enum_str; assert(strings); while (strings[i++] != NULL); if (value >= i - 1) { error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null"); return; } enum_str = (char *)strings[value]; qmp_output_type_str(v, &enum_str, name, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, int *VAR_1, const char *VAR_2[], const char *VAR_3, const char *VAR_4, Error **VAR_5) { int VAR_6 = 0; int VAR_7 = *VAR_1; char *VAR_8; assert(VAR_2); while (VAR_2[VAR_6++] != NULL); if (VAR_7 >= VAR_6 - 1) { error_set(VAR_5, QERR_INVALID_PARAMETER, VAR_4 ? VAR_4 : "null"); return; } VAR_8 = (char *)VAR_2[VAR_7]; qmp_output_type_str(VAR_0, &VAR_8, VAR_4, VAR_5); }
[ "static void FUNC_0(Visitor *VAR_0, int *VAR_1, const char *VAR_2[],\nconst char *VAR_3, const char *VAR_4,\nError **VAR_5)\n{", "int VAR_6 = 0;", "int VAR_7 = *VAR_1;", "char *VAR_8;", "assert(VAR_2);", "while (VAR_2[VAR_6++] != NULL);", "if (VAR_7 >= VAR_6 - 1) {", "error_set(VAR_5, QERR_INVALID_PARAMETER, VAR_4 ? VAR_4 : \"null\");", "return;", "}", "VAR_8 = (char *)VAR_2[VAR_7];", "qmp_output_type_str(VAR_0, &VAR_8, VAR_4, VAR_5);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
11,011
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; char color_parameter_type[5] = { 0 }; int color_primaries, color_trc, color_matrix; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; avio_read(pb, color_parameter_type, 4); if (strncmp(color_parameter_type, "nclx", 4) && strncmp(color_parameter_type, "nclc", 4)) { av_log(c->fc, AV_LOG_WARNING, "unsupported color_parameter_type %s\n", color_parameter_type); return 0; } color_primaries = avio_rb16(pb); color_trc = avio_rb16(pb); color_matrix = avio_rb16(pb); av_dlog(c->fc, "%s: pri %d trc %d matrix %d", color_parameter_type, color_primaries, color_trc, color_matrix); if (c->isom) { uint8_t color_range = avio_r8(pb) >> 7; av_dlog(c->fc, " full %"PRIu8"", color_range); if (color_range) st->codec->color_range = AVCOL_RANGE_JPEG; else st->codec->color_range = AVCOL_RANGE_MPEG; /* 14496-12 references JPEG XR specs (rather than the more complete * 23001-8) so some adjusting is required */ if (color_primaries >= AVCOL_PRI_FILM) color_primaries = AVCOL_PRI_UNSPECIFIED; if ((color_trc >= AVCOL_TRC_LINEAR && color_trc <= AVCOL_TRC_LOG_SQRT) || color_trc >= AVCOL_TRC_BT2020_10) color_trc = AVCOL_TRC_UNSPECIFIED; if (color_matrix >= AVCOL_SPC_BT2020_NCL) color_matrix = AVCOL_SPC_UNSPECIFIED; st->codec->color_primaries = color_primaries; st->codec->color_trc = color_trc; st->codec->colorspace = color_matrix; } else { /* color primaries, Table 4-4 */ switch (color_primaries) { case 1: st->codec->color_primaries = AVCOL_PRI_BT709; break; case 5: st->codec->color_primaries = AVCOL_PRI_SMPTE170M; break; case 6: st->codec->color_primaries = AVCOL_PRI_SMPTE240M; break; } /* color transfer, Table 4-5 */ switch (color_trc) { case 1: st->codec->color_trc = AVCOL_TRC_BT709; break; case 7: st->codec->color_trc = AVCOL_TRC_SMPTE240M; break; } /* color matrix, Table 4-6 */ switch (color_matrix) { case 1: st->codec->colorspace = AVCOL_SPC_BT709; break; case 6: st->codec->colorspace = AVCOL_SPC_BT470BG; break; case 7: st->codec->colorspace = AVCOL_SPC_SMPTE240M; break; } } av_dlog(c->fc, "\n"); return 0; }
false
FFmpeg
0276b9524294e518cdc7cbfa12b7cb301ed86fb6
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; char color_parameter_type[5] = { 0 }; int color_primaries, color_trc, color_matrix; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; avio_read(pb, color_parameter_type, 4); if (strncmp(color_parameter_type, "nclx", 4) && strncmp(color_parameter_type, "nclc", 4)) { av_log(c->fc, AV_LOG_WARNING, "unsupported color_parameter_type %s\n", color_parameter_type); return 0; } color_primaries = avio_rb16(pb); color_trc = avio_rb16(pb); color_matrix = avio_rb16(pb); av_dlog(c->fc, "%s: pri %d trc %d matrix %d", color_parameter_type, color_primaries, color_trc, color_matrix); if (c->isom) { uint8_t color_range = avio_r8(pb) >> 7; av_dlog(c->fc, " full %"PRIu8"", color_range); if (color_range) st->codec->color_range = AVCOL_RANGE_JPEG; else st->codec->color_range = AVCOL_RANGE_MPEG; if (color_primaries >= AVCOL_PRI_FILM) color_primaries = AVCOL_PRI_UNSPECIFIED; if ((color_trc >= AVCOL_TRC_LINEAR && color_trc <= AVCOL_TRC_LOG_SQRT) || color_trc >= AVCOL_TRC_BT2020_10) color_trc = AVCOL_TRC_UNSPECIFIED; if (color_matrix >= AVCOL_SPC_BT2020_NCL) color_matrix = AVCOL_SPC_UNSPECIFIED; st->codec->color_primaries = color_primaries; st->codec->color_trc = color_trc; st->codec->colorspace = color_matrix; } else { switch (color_primaries) { case 1: st->codec->color_primaries = AVCOL_PRI_BT709; break; case 5: st->codec->color_primaries = AVCOL_PRI_SMPTE170M; break; case 6: st->codec->color_primaries = AVCOL_PRI_SMPTE240M; break; } switch (color_trc) { case 1: st->codec->color_trc = AVCOL_TRC_BT709; break; case 7: st->codec->color_trc = AVCOL_TRC_SMPTE240M; break; } switch (color_matrix) { case 1: st->codec->colorspace = AVCOL_SPC_BT709; break; case 6: st->codec->colorspace = AVCOL_SPC_BT470BG; break; case 7: st->codec->colorspace = AVCOL_SPC_SMPTE240M; break; } } av_dlog(c->fc, "\n"); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; char VAR_3[5] = { 0 }; int VAR_4, VAR_5, VAR_6; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams - 1]; avio_read(VAR_1, VAR_3, 4); if (strncmp(VAR_3, "nclx", 4) && strncmp(VAR_3, "nclc", 4)) { av_log(VAR_0->fc, AV_LOG_WARNING, "unsupported VAR_3 %s\n", VAR_3); return 0; } VAR_4 = avio_rb16(VAR_1); VAR_5 = avio_rb16(VAR_1); VAR_6 = avio_rb16(VAR_1); av_dlog(VAR_0->fc, "%s: pri %d trc %d matrix %d", VAR_3, VAR_4, VAR_5, VAR_6); if (VAR_0->isom) { uint8_t color_range = avio_r8(VAR_1) >> 7; av_dlog(VAR_0->fc, " full %"PRIu8"", color_range); if (color_range) st->codec->color_range = AVCOL_RANGE_JPEG; else st->codec->color_range = AVCOL_RANGE_MPEG; if (VAR_4 >= AVCOL_PRI_FILM) VAR_4 = AVCOL_PRI_UNSPECIFIED; if ((VAR_5 >= AVCOL_TRC_LINEAR && VAR_5 <= AVCOL_TRC_LOG_SQRT) || VAR_5 >= AVCOL_TRC_BT2020_10) VAR_5 = AVCOL_TRC_UNSPECIFIED; if (VAR_6 >= AVCOL_SPC_BT2020_NCL) VAR_6 = AVCOL_SPC_UNSPECIFIED; st->codec->VAR_4 = VAR_4; st->codec->VAR_5 = VAR_5; st->codec->colorspace = VAR_6; } else { switch (VAR_4) { case 1: st->codec->VAR_4 = AVCOL_PRI_BT709; break; case 5: st->codec->VAR_4 = AVCOL_PRI_SMPTE170M; break; case 6: st->codec->VAR_4 = AVCOL_PRI_SMPTE240M; break; } switch (VAR_5) { case 1: st->codec->VAR_5 = AVCOL_TRC_BT709; break; case 7: st->codec->VAR_5 = AVCOL_TRC_SMPTE240M; break; } switch (VAR_6) { case 1: st->codec->colorspace = AVCOL_SPC_BT709; break; case 6: st->codec->colorspace = AVCOL_SPC_BT470BG; break; case 7: st->codec->colorspace = AVCOL_SPC_SMPTE240M; break; } } av_dlog(VAR_0->fc, "\n"); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "char VAR_3[5] = { 0 };", "int VAR_4, VAR_5, VAR_6;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams - 1];", "avio_read(VAR_1, VAR_3, 4);", "if (strncmp(VAR_3, \"nclx\", 4) &&\nstrncmp(VAR_3, \"nclc\", 4)) {", "av_log(VAR_0->fc, AV_LOG_WARNING, \"unsupported VAR_3 %s\\n\",\nVAR_3);", "return 0;", "}", "VAR_4 = avio_rb16(VAR_1);", "VAR_5 = avio_rb16(VAR_1);", "VAR_6 = avio_rb16(VAR_1);", "av_dlog(VAR_0->fc, \"%s: pri %d trc %d matrix %d\",\nVAR_3, VAR_4, VAR_5, VAR_6);", "if (VAR_0->isom) {", "uint8_t color_range = avio_r8(VAR_1) >> 7;", "av_dlog(VAR_0->fc, \" full %\"PRIu8\"\", color_range);", "if (color_range)\nst->codec->color_range = AVCOL_RANGE_JPEG;", "else\nst->codec->color_range = AVCOL_RANGE_MPEG;", "if (VAR_4 >= AVCOL_PRI_FILM)\nVAR_4 = AVCOL_PRI_UNSPECIFIED;", "if ((VAR_5 >= AVCOL_TRC_LINEAR &&\nVAR_5 <= AVCOL_TRC_LOG_SQRT) ||\nVAR_5 >= AVCOL_TRC_BT2020_10)\nVAR_5 = AVCOL_TRC_UNSPECIFIED;", "if (VAR_6 >= AVCOL_SPC_BT2020_NCL)\nVAR_6 = AVCOL_SPC_UNSPECIFIED;", "st->codec->VAR_4 = VAR_4;", "st->codec->VAR_5 = VAR_5;", "st->codec->colorspace = VAR_6;", "} else {", "switch (VAR_4) {", "case 1: st->codec->VAR_4 = AVCOL_PRI_BT709; break;", "case 5: st->codec->VAR_4 = AVCOL_PRI_SMPTE170M; break;", "case 6: st->codec->VAR_4 = AVCOL_PRI_SMPTE240M; break;", "}", "switch (VAR_5) {", "case 1: st->codec->VAR_5 = AVCOL_TRC_BT709; break;", "case 7: st->codec->VAR_5 = AVCOL_TRC_SMPTE240M; break;", "}", "switch (VAR_6) {", "case 1: st->codec->colorspace = AVCOL_SPC_BT709; break;", "case 6: st->codec->colorspace = AVCOL_SPC_BT470BG; break;", "case 7: st->codec->colorspace = AVCOL_SPC_SMPTE240M; break;", "}", "}", "av_dlog(VAR_0->fc, \"\\n\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 69, 71 ], [ 73, 75, 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
11,012
static int v9fs_complete_rename(V9fsState *s, V9fsRenameState *vs) { int err = 0; char *old_name, *new_name; char *end; if (vs->newdirfid != -1) { V9fsFidState *dirfidp; dirfidp = lookup_fid(s, vs->newdirfid); if (dirfidp == NULL) { err = -ENOENT; goto out; } BUG_ON(dirfidp->fid_type != P9_FID_NONE); new_name = qemu_mallocz(dirfidp->path.size + vs->name.size + 2); strcpy(new_name, dirfidp->path.data); strcat(new_name, "/"); strcat(new_name + dirfidp->path.size, vs->name.data); } else { old_name = vs->fidp->path.data; end = strrchr(old_name, '/'); if (end) { end++; } else { end = old_name; } new_name = qemu_mallocz(end - old_name + vs->name.size + 1); strncat(new_name, old_name, end - old_name); strncat(new_name + (end - old_name), vs->name.data, vs->name.size); } v9fs_string_free(&vs->name); vs->name.data = qemu_strdup(new_name); vs->name.size = strlen(new_name); if (strcmp(new_name, vs->fidp->path.data) != 0) { if (v9fs_do_rename(s, &vs->fidp->path, &vs->name)) { err = -errno; } else { V9fsFidState *fidp; /* * Fixup fid's pointing to the old name to * start pointing to the new name */ for (fidp = s->fid_list; fidp; fidp = fidp->next) { if (vs->fidp == fidp) { /* * we replace name of this fid towards the end * so that our below strcmp will work */ continue; } if (!strncmp(vs->fidp->path.data, fidp->path.data, strlen(vs->fidp->path.data))) { /* replace the name */ v9fs_fix_path(&fidp->path, &vs->name, strlen(vs->fidp->path.data)); } } v9fs_string_copy(&vs->fidp->path, &vs->name); } } out: v9fs_string_free(&vs->name); return err; }
false
qemu
936532a4928ce6c95de5718974f6c987aaad7b68
static int v9fs_complete_rename(V9fsState *s, V9fsRenameState *vs) { int err = 0; char *old_name, *new_name; char *end; if (vs->newdirfid != -1) { V9fsFidState *dirfidp; dirfidp = lookup_fid(s, vs->newdirfid); if (dirfidp == NULL) { err = -ENOENT; goto out; } BUG_ON(dirfidp->fid_type != P9_FID_NONE); new_name = qemu_mallocz(dirfidp->path.size + vs->name.size + 2); strcpy(new_name, dirfidp->path.data); strcat(new_name, "/"); strcat(new_name + dirfidp->path.size, vs->name.data); } else { old_name = vs->fidp->path.data; end = strrchr(old_name, '/'); if (end) { end++; } else { end = old_name; } new_name = qemu_mallocz(end - old_name + vs->name.size + 1); strncat(new_name, old_name, end - old_name); strncat(new_name + (end - old_name), vs->name.data, vs->name.size); } v9fs_string_free(&vs->name); vs->name.data = qemu_strdup(new_name); vs->name.size = strlen(new_name); if (strcmp(new_name, vs->fidp->path.data) != 0) { if (v9fs_do_rename(s, &vs->fidp->path, &vs->name)) { err = -errno; } else { V9fsFidState *fidp; for (fidp = s->fid_list; fidp; fidp = fidp->next) { if (vs->fidp == fidp) { continue; } if (!strncmp(vs->fidp->path.data, fidp->path.data, strlen(vs->fidp->path.data))) { v9fs_fix_path(&fidp->path, &vs->name, strlen(vs->fidp->path.data)); } } v9fs_string_copy(&vs->fidp->path, &vs->name); } } out: v9fs_string_free(&vs->name); return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(V9fsState *VAR_0, V9fsRenameState *VAR_1) { int VAR_2 = 0; char *VAR_3, *VAR_4; char *VAR_5; if (VAR_1->newdirfid != -1) { V9fsFidState *dirfidp; dirfidp = lookup_fid(VAR_0, VAR_1->newdirfid); if (dirfidp == NULL) { VAR_2 = -ENOENT; goto out; } BUG_ON(dirfidp->fid_type != P9_FID_NONE); VAR_4 = qemu_mallocz(dirfidp->path.size + VAR_1->name.size + 2); strcpy(VAR_4, dirfidp->path.data); strcat(VAR_4, "/"); strcat(VAR_4 + dirfidp->path.size, VAR_1->name.data); } else { VAR_3 = VAR_1->fidp->path.data; VAR_5 = strrchr(VAR_3, '/'); if (VAR_5) { VAR_5++; } else { VAR_5 = VAR_3; } VAR_4 = qemu_mallocz(VAR_5 - VAR_3 + VAR_1->name.size + 1); strncat(VAR_4, VAR_3, VAR_5 - VAR_3); strncat(VAR_4 + (VAR_5 - VAR_3), VAR_1->name.data, VAR_1->name.size); } v9fs_string_free(&VAR_1->name); VAR_1->name.data = qemu_strdup(VAR_4); VAR_1->name.size = strlen(VAR_4); if (strcmp(VAR_4, VAR_1->fidp->path.data) != 0) { if (v9fs_do_rename(VAR_0, &VAR_1->fidp->path, &VAR_1->name)) { VAR_2 = -errno; } else { V9fsFidState *fidp; for (fidp = VAR_0->fid_list; fidp; fidp = fidp->next) { if (VAR_1->fidp == fidp) { continue; } if (!strncmp(VAR_1->fidp->path.data, fidp->path.data, strlen(VAR_1->fidp->path.data))) { v9fs_fix_path(&fidp->path, &VAR_1->name, strlen(VAR_1->fidp->path.data)); } } v9fs_string_copy(&VAR_1->fidp->path, &VAR_1->name); } } out: v9fs_string_free(&VAR_1->name); return VAR_2; }
[ "static int FUNC_0(V9fsState *VAR_0, V9fsRenameState *VAR_1)\n{", "int VAR_2 = 0;", "char *VAR_3, *VAR_4;", "char *VAR_5;", "if (VAR_1->newdirfid != -1) {", "V9fsFidState *dirfidp;", "dirfidp = lookup_fid(VAR_0, VAR_1->newdirfid);", "if (dirfidp == NULL) {", "VAR_2 = -ENOENT;", "goto out;", "}", "BUG_ON(dirfidp->fid_type != P9_FID_NONE);", "VAR_4 = qemu_mallocz(dirfidp->path.size + VAR_1->name.size + 2);", "strcpy(VAR_4, dirfidp->path.data);", "strcat(VAR_4, \"/\");", "strcat(VAR_4 + dirfidp->path.size, VAR_1->name.data);", "} else {", "VAR_3 = VAR_1->fidp->path.data;", "VAR_5 = strrchr(VAR_3, '/');", "if (VAR_5) {", "VAR_5++;", "} else {", "VAR_5 = VAR_3;", "}", "VAR_4 = qemu_mallocz(VAR_5 - VAR_3 + VAR_1->name.size + 1);", "strncat(VAR_4, VAR_3, VAR_5 - VAR_3);", "strncat(VAR_4 + (VAR_5 - VAR_3), VAR_1->name.data, VAR_1->name.size);", "}", "v9fs_string_free(&VAR_1->name);", "VAR_1->name.data = qemu_strdup(VAR_4);", "VAR_1->name.size = strlen(VAR_4);", "if (strcmp(VAR_4, VAR_1->fidp->path.data) != 0) {", "if (v9fs_do_rename(VAR_0, &VAR_1->fidp->path, &VAR_1->name)) {", "VAR_2 = -errno;", "} else {", "V9fsFidState *fidp;", "for (fidp = VAR_0->fid_list; fidp; fidp = fidp->next) {", "if (VAR_1->fidp == fidp) {", "continue;", "}", "if (!strncmp(VAR_1->fidp->path.data, fidp->path.data,\nstrlen(VAR_1->fidp->path.data))) {", "v9fs_fix_path(&fidp->path, &VAR_1->name,\nstrlen(VAR_1->fidp->path.data));", "}", "}", "v9fs_string_copy(&VAR_1->fidp->path, &VAR_1->name);", "}", "}", "out:\nv9fs_string_free(&VAR_1->name);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 99 ], [ 101 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ] ]
11,013
build_srat(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) { AcpiSystemResourceAffinityTable *srat; AcpiSratProcessorGiccAffinity *core; AcpiSratMemoryAffinity *numamem; int i, j, srat_start; uint64_t mem_base; uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); for (i = 0; i < guest_info->smp_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { if (test_bit(i, numa_info[j].node_cpu)) { cpu_node[i] = j; break; } } } srat_start = table_data->len; srat = acpi_data_push(table_data, sizeof(*srat)); srat->reserved1 = cpu_to_le32(1); for (i = 0; i < guest_info->smp_cpus; ++i) { core = acpi_data_push(table_data, sizeof(*core)); core->type = ACPI_SRAT_PROCESSOR_GICC; core->length = sizeof(*core); core->proximity = cpu_to_le32(cpu_node[i]); core->acpi_processor_uid = cpu_to_le32(i); core->flags = cpu_to_le32(1); } g_free(cpu_node); mem_base = guest_info->memmap[VIRT_MEM].base; for (i = 0; i < nb_numa_nodes; ++i) { numamem = acpi_data_push(table_data, sizeof(*numamem)); build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i, MEM_AFFINITY_ENABLED); mem_base += numa_info[i].node_mem; } build_header(linker, table_data, (void *)(table_data->data + srat_start), "SRAT", table_data->len - srat_start, 3, NULL, NULL); }
false
qemu
0e9b9edae7bebfd31fdbead4ccbbce03876a7edd
build_srat(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) { AcpiSystemResourceAffinityTable *srat; AcpiSratProcessorGiccAffinity *core; AcpiSratMemoryAffinity *numamem; int i, j, srat_start; uint64_t mem_base; uint32_t *cpu_node = g_malloc0(guest_info->smp_cpus * sizeof(uint32_t)); for (i = 0; i < guest_info->smp_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { if (test_bit(i, numa_info[j].node_cpu)) { cpu_node[i] = j; break; } } } srat_start = table_data->len; srat = acpi_data_push(table_data, sizeof(*srat)); srat->reserved1 = cpu_to_le32(1); for (i = 0; i < guest_info->smp_cpus; ++i) { core = acpi_data_push(table_data, sizeof(*core)); core->type = ACPI_SRAT_PROCESSOR_GICC; core->length = sizeof(*core); core->proximity = cpu_to_le32(cpu_node[i]); core->acpi_processor_uid = cpu_to_le32(i); core->flags = cpu_to_le32(1); } g_free(cpu_node); mem_base = guest_info->memmap[VIRT_MEM].base; for (i = 0; i < nb_numa_nodes; ++i) { numamem = acpi_data_push(table_data, sizeof(*numamem)); build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i, MEM_AFFINITY_ENABLED); mem_base += numa_info[i].node_mem; } build_header(linker, table_data, (void *)(table_data->data + srat_start), "SRAT", table_data->len - srat_start, 3, NULL, NULL); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, GArray *VAR_1, VirtGuestInfo *VAR_2) { AcpiSystemResourceAffinityTable *srat; AcpiSratProcessorGiccAffinity *core; AcpiSratMemoryAffinity *numamem; int VAR_3, VAR_4, VAR_5; uint64_t mem_base; uint32_t *cpu_node = g_malloc0(VAR_2->smp_cpus * sizeof(uint32_t)); for (VAR_3 = 0; VAR_3 < VAR_2->smp_cpus; VAR_3++) { for (VAR_4 = 0; VAR_4 < nb_numa_nodes; VAR_4++) { if (test_bit(VAR_3, numa_info[VAR_4].node_cpu)) { cpu_node[VAR_3] = VAR_4; break; } } } VAR_5 = VAR_0->len; srat = acpi_data_push(VAR_0, sizeof(*srat)); srat->reserved1 = cpu_to_le32(1); for (VAR_3 = 0; VAR_3 < VAR_2->smp_cpus; ++VAR_3) { core = acpi_data_push(VAR_0, sizeof(*core)); core->type = ACPI_SRAT_PROCESSOR_GICC; core->length = sizeof(*core); core->proximity = cpu_to_le32(cpu_node[VAR_3]); core->acpi_processor_uid = cpu_to_le32(VAR_3); core->flags = cpu_to_le32(1); } g_free(cpu_node); mem_base = VAR_2->memmap[VIRT_MEM].base; for (VAR_3 = 0; VAR_3 < nb_numa_nodes; ++VAR_3) { numamem = acpi_data_push(VAR_0, sizeof(*numamem)); build_srat_memory(numamem, mem_base, numa_info[VAR_3].node_mem, VAR_3, MEM_AFFINITY_ENABLED); mem_base += numa_info[VAR_3].node_mem; } build_header(VAR_1, VAR_0, (void *)(VAR_0->data + VAR_5), "SRAT", VAR_0->len - VAR_5, 3, NULL, NULL); }
[ "FUNC_0(GArray *VAR_0, GArray *VAR_1, VirtGuestInfo *VAR_2)\n{", "AcpiSystemResourceAffinityTable *srat;", "AcpiSratProcessorGiccAffinity *core;", "AcpiSratMemoryAffinity *numamem;", "int VAR_3, VAR_4, VAR_5;", "uint64_t mem_base;", "uint32_t *cpu_node = g_malloc0(VAR_2->smp_cpus * sizeof(uint32_t));", "for (VAR_3 = 0; VAR_3 < VAR_2->smp_cpus; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < nb_numa_nodes; VAR_4++) {", "if (test_bit(VAR_3, numa_info[VAR_4].node_cpu)) {", "cpu_node[VAR_3] = VAR_4;", "break;", "}", "}", "}", "VAR_5 = VAR_0->len;", "srat = acpi_data_push(VAR_0, sizeof(*srat));", "srat->reserved1 = cpu_to_le32(1);", "for (VAR_3 = 0; VAR_3 < VAR_2->smp_cpus; ++VAR_3) {", "core = acpi_data_push(VAR_0, sizeof(*core));", "core->type = ACPI_SRAT_PROCESSOR_GICC;", "core->length = sizeof(*core);", "core->proximity = cpu_to_le32(cpu_node[VAR_3]);", "core->acpi_processor_uid = cpu_to_le32(VAR_3);", "core->flags = cpu_to_le32(1);", "}", "g_free(cpu_node);", "mem_base = VAR_2->memmap[VIRT_MEM].base;", "for (VAR_3 = 0; VAR_3 < nb_numa_nodes; ++VAR_3) {", "numamem = acpi_data_push(VAR_0, sizeof(*numamem));", "build_srat_memory(numamem, mem_base, numa_info[VAR_3].node_mem, VAR_3,\nMEM_AFFINITY_ENABLED);", "mem_base += numa_info[VAR_3].node_mem;", "}", "build_header(VAR_1, VAR_0,\n(void *)(VAR_0->data + VAR_5), \"SRAT\",\nVAR_0->len - VAR_5, 3, NULL, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81, 83, 85 ], [ 87 ] ]
11,014
static void tcg_out_ri64(TCGContext *s, int const_arg, TCGArg arg) { if (const_arg) { assert(const_arg == 1); tcg_out8(s, TCG_CONST); tcg_out64(s, arg); } else { tcg_out_r(s, arg); } }
false
qemu
eabb7b91b36b202b4dac2df2d59d698e3aff197a
static void tcg_out_ri64(TCGContext *s, int const_arg, TCGArg arg) { if (const_arg) { assert(const_arg == 1); tcg_out8(s, TCG_CONST); tcg_out64(s, arg); } else { tcg_out_r(s, arg); } }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, int VAR_1, TCGArg VAR_2) { if (VAR_1) { assert(VAR_1 == 1); tcg_out8(VAR_0, TCG_CONST); tcg_out64(VAR_0, VAR_2); } else { tcg_out_r(VAR_0, VAR_2); } }
[ "static void FUNC_0(TCGContext *VAR_0, int VAR_1, TCGArg VAR_2)\n{", "if (VAR_1) {", "assert(VAR_1 == 1);", "tcg_out8(VAR_0, TCG_CONST);", "tcg_out64(VAR_0, VAR_2);", "} else {", "tcg_out_r(VAR_0, VAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,015
static void tgen_compare_branch(TCGContext *s, S390Opcode opc, int cc, TCGReg r1, TCGReg r2, int labelno) { TCGLabel* l = &s->labels[labelno]; intptr_t off; if (l->has_value) { off = l->u.value_ptr - s->code_ptr; } else { /* We need to keep the offset unchanged for retranslation. */ off = s->code_ptr[1]; tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, labelno, -2); } tcg_out16(s, (opc & 0xff00) | (r1 << 4) | r2); tcg_out16(s, off); tcg_out16(s, cc << 12 | (opc & 0xff)); }
false
qemu
bec1631100323fac0900aea71043d5c4e22fc2fa
static void tgen_compare_branch(TCGContext *s, S390Opcode opc, int cc, TCGReg r1, TCGReg r2, int labelno) { TCGLabel* l = &s->labels[labelno]; intptr_t off; if (l->has_value) { off = l->u.value_ptr - s->code_ptr; } else { off = s->code_ptr[1]; tcg_out_reloc(s, s->code_ptr + 1, R_390_PC16DBL, labelno, -2); } tcg_out16(s, (opc & 0xff00) | (r1 << 4) | r2); tcg_out16(s, off); tcg_out16(s, cc << 12 | (opc & 0xff)); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, S390Opcode VAR_1, int VAR_2, TCGReg VAR_3, TCGReg VAR_4, int VAR_5) { TCGLabel* l = &VAR_0->labels[VAR_5]; intptr_t off; if (l->has_value) { off = l->u.value_ptr - VAR_0->code_ptr; } else { off = VAR_0->code_ptr[1]; tcg_out_reloc(VAR_0, VAR_0->code_ptr + 1, R_390_PC16DBL, VAR_5, -2); } tcg_out16(VAR_0, (VAR_1 & 0xff00) | (VAR_3 << 4) | VAR_4); tcg_out16(VAR_0, off); tcg_out16(VAR_0, VAR_2 << 12 | (VAR_1 & 0xff)); }
[ "static void FUNC_0(TCGContext *VAR_0, S390Opcode VAR_1, int VAR_2,\nTCGReg VAR_3, TCGReg VAR_4, int VAR_5)\n{", "TCGLabel* l = &VAR_0->labels[VAR_5];", "intptr_t off;", "if (l->has_value) {", "off = l->u.value_ptr - VAR_0->code_ptr;", "} else {", "off = VAR_0->code_ptr[1];", "tcg_out_reloc(VAR_0, VAR_0->code_ptr + 1, R_390_PC16DBL, VAR_5, -2);", "}", "tcg_out16(VAR_0, (VAR_1 & 0xff00) | (VAR_3 << 4) | VAR_4);", "tcg_out16(VAR_0, off);", "tcg_out16(VAR_0, VAR_2 << 12 | (VAR_1 & 0xff));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
11,017
void spapr_iommu_init(void) { QLIST_INIT(&spapr_tce_tables); /* hcall-tce */ spapr_register_hypercall(H_PUT_TCE, h_put_tce); }
false
qemu
a83000f5e3fac30a7f213af1ba6a8f827622854d
void spapr_iommu_init(void) { QLIST_INIT(&spapr_tce_tables); spapr_register_hypercall(H_PUT_TCE, h_put_tce); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { QLIST_INIT(&spapr_tce_tables); spapr_register_hypercall(H_PUT_TCE, h_put_tce); }
[ "void FUNC_0(void)\n{", "QLIST_INIT(&spapr_tce_tables);", "spapr_register_hypercall(H_PUT_TCE, h_put_tce);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ] ]
11,018
static void migration_state_notifier(Notifier *notifier, void *data) { MigrationState *s = data; if (migration_is_active(s)) { #ifdef SPICE_INTERFACE_MIGRATION spice_server_migrate_start(spice_server); #endif } else if (migration_has_finished(s)) { #if SPICE_SERVER_VERSION >= 0x000701 /* 0.7.1 */ #ifndef SPICE_INTERFACE_MIGRATION spice_server_migrate_switch(spice_server); #else spice_server_migrate_end(spice_server, true); } else if (migration_has_failed(s)) { spice_server_migrate_end(spice_server, false); #endif #endif } }
false
qemu
4295e15aa730a95003a3639d6dad2eb1e65a59e2
static void migration_state_notifier(Notifier *notifier, void *data) { MigrationState *s = data; if (migration_is_active(s)) { #ifdef SPICE_INTERFACE_MIGRATION spice_server_migrate_start(spice_server); #endif } else if (migration_has_finished(s)) { #if SPICE_SERVER_VERSION >= 0x000701 #ifndef SPICE_INTERFACE_MIGRATION spice_server_migrate_switch(spice_server); #else spice_server_migrate_end(spice_server, true); } else if (migration_has_failed(s)) { spice_server_migrate_end(spice_server, false); #endif #endif } }
{ "code": [], "line_no": [] }
static void FUNC_0(Notifier *VAR_0, void *VAR_1) { MigrationState *s = VAR_1; if (migration_is_active(s)) { #ifdef SPICE_INTERFACE_MIGRATION spice_server_migrate_start(spice_server); #endif } else if (migration_has_finished(s)) { #if SPICE_SERVER_VERSION >= 0x000701 #ifndef SPICE_INTERFACE_MIGRATION spice_server_migrate_switch(spice_server); #else spice_server_migrate_end(spice_server, true); } else if (migration_has_failed(s)) { spice_server_migrate_end(spice_server, false); #endif #endif } }
[ "static void FUNC_0(Notifier *VAR_0, void *VAR_1)\n{", "MigrationState *s = VAR_1;", "if (migration_is_active(s)) {", "#ifdef SPICE_INTERFACE_MIGRATION\nspice_server_migrate_start(spice_server);", "#endif\n} else if (migration_has_finished(s)) {", "#if SPICE_SERVER_VERSION >= 0x000701\n#ifndef SPICE_INTERFACE_MIGRATION\nspice_server_migrate_switch(spice_server);", "#else\nspice_server_migrate_end(spice_server, true);", "} else if (migration_has_failed(s)) {", "spice_server_migrate_end(spice_server, false);", "#endif\n#endif\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ] ]
11,020
static inline void downmix_3f_1r_to_stereo(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 768]); samples[i + 256] += (samples[i + 512] + samples[i + 768]); samples[i + 512] = samples[i + 768] = 0; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_3f_1r_to_stereo(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += (samples[i + 256] + samples[i + 768]); samples[i + 256] += (samples[i + 512] + samples[i + 768]); samples[i + 512] = samples[i + 768] = 0; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(float *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 768]); VAR_0[VAR_1 + 256] += (VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 768]); VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = 0; } }
[ "static inline void FUNC_0(float *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_0[VAR_1] += (VAR_0[VAR_1 + 256] + VAR_0[VAR_1 + 768]);", "VAR_0[VAR_1 + 256] += (VAR_0[VAR_1 + 512] + VAR_0[VAR_1 + 768]);", "VAR_0[VAR_1 + 512] = VAR_0[VAR_1 + 768] = 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,021
static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; int ret; unsigned int frame_type, packet_size, padding, frame_size; avio_rb16(pb); /* channel number */ frame_type = avio_rb16(pb); packet_size = avio_rb32(pb); padding = -packet_size & 511; frame_size = packet_size - 8; if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) { av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n"); return AVERROR(EIO); } if (packet_size > LMLM4_MAX_PACKET_SIZE) { av_log(s, AV_LOG_ERROR, "packet size exceeds maximum\n"); return AVERROR(EIO); } if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); avio_skip(pb, padding); switch (frame_type) { case LMLM4_I_FRAME: pkt->flags = AV_PKT_FLAG_KEY; case LMLM4_P_FRAME: case LMLM4_B_FRAME: pkt->stream_index = 0; break; case LMLM4_MPEG1L2: pkt->stream_index = 1; break; } return ret; }
false
FFmpeg
4ce03a95e27d618a2c65b1ed134a72b48bbbff00
static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; int ret; unsigned int frame_type, packet_size, padding, frame_size; avio_rb16(pb); frame_type = avio_rb16(pb); packet_size = avio_rb32(pb); padding = -packet_size & 511; frame_size = packet_size - 8; if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) { av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n"); return AVERROR(EIO); } if (packet_size > LMLM4_MAX_PACKET_SIZE) { av_log(s, AV_LOG_ERROR, "packet size exceeds maximum\n"); return AVERROR(EIO); } if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); avio_skip(pb, padding); switch (frame_type) { case LMLM4_I_FRAME: pkt->flags = AV_PKT_FLAG_KEY; case LMLM4_P_FRAME: case LMLM4_B_FRAME: pkt->stream_index = 0; break; case LMLM4_MPEG1L2: pkt->stream_index = 1; break; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { AVIOContext *pb = VAR_0->pb; int VAR_2; unsigned int VAR_3, VAR_4, VAR_5, VAR_6; avio_rb16(pb); VAR_3 = avio_rb16(pb); VAR_4 = avio_rb32(pb); VAR_5 = -VAR_4 & 511; VAR_6 = VAR_4 - 8; if (VAR_3 > LMLM4_MPEG1L2 || VAR_3 == LMLM4_INVALID) { av_log(VAR_0, AV_LOG_ERROR, "invalid or unsupported VAR_3\n"); return AVERROR(EIO); } if (VAR_4 > LMLM4_MAX_PACKET_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "packet size exceeds maximum\n"); return AVERROR(EIO); } if ((VAR_2 = av_get_packet(pb, VAR_1, VAR_6)) <= 0) return AVERROR(EIO); avio_skip(pb, VAR_5); switch (VAR_3) { case LMLM4_I_FRAME: VAR_1->flags = AV_PKT_FLAG_KEY; case LMLM4_P_FRAME: case LMLM4_B_FRAME: VAR_1->stream_index = 0; break; case LMLM4_MPEG1L2: VAR_1->stream_index = 1; break; } return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) {", "AVIOContext *pb = VAR_0->pb;", "int VAR_2;", "unsigned int VAR_3, VAR_4, VAR_5, VAR_6;", "avio_rb16(pb);", "VAR_3 = avio_rb16(pb);", "VAR_4 = avio_rb32(pb);", "VAR_5 = -VAR_4 & 511;", "VAR_6 = VAR_4 - 8;", "if (VAR_3 > LMLM4_MPEG1L2 || VAR_3 == LMLM4_INVALID) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid or unsupported VAR_3\\n\");", "return AVERROR(EIO);", "}", "if (VAR_4 > LMLM4_MAX_PACKET_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet size exceeds maximum\\n\");", "return AVERROR(EIO);", "}", "if ((VAR_2 = av_get_packet(pb, VAR_1, VAR_6)) <= 0)\nreturn AVERROR(EIO);", "avio_skip(pb, VAR_5);", "switch (VAR_3) {", "case LMLM4_I_FRAME:\nVAR_1->flags = AV_PKT_FLAG_KEY;", "case LMLM4_P_FRAME:\ncase LMLM4_B_FRAME:\nVAR_1->stream_index = 0;", "break;", "case LMLM4_MPEG1L2:\nVAR_1->stream_index = 1;", "break;", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57, 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
11,022
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { BinkContext * const c = avctx->priv_data; GetBitContext gb; int plane, plane_idx, ret; int bits_count = pkt->size << 3; if (c->version > 'b') { if(c->pic->data[0]) avctx->release_buffer(avctx, c->pic); if ((ret = ff_get_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } } else { if ((ret = avctx->reget_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } } init_get_bits(&gb, pkt->data, bits_count); if (c->has_alpha) { if (c->version >= 'i') skip_bits_long(&gb, 32); if ((ret = bink_decode_plane(c, &gb, 3, 0)) < 0) return ret; } if (c->version >= 'i') skip_bits_long(&gb, 32); for (plane = 0; plane < 3; plane++) { plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); if (c->version > 'b') { if ((ret = bink_decode_plane(c, &gb, plane_idx, !!plane)) < 0) return ret; } else { if ((ret = binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane)) < 0) return ret; } if (get_bits_count(&gb) >= bits_count) break; } emms_c(); *got_frame = 1; *(AVFrame*)data = *c->pic; if (c->version > 'b') FFSWAP(AVFrame*, c->pic, c->last); /* always report that the buffer was completely consumed */ return pkt->size; }
false
FFmpeg
f2960097e42ddf9a356bab6547f87906f6999e0a
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { BinkContext * const c = avctx->priv_data; GetBitContext gb; int plane, plane_idx, ret; int bits_count = pkt->size << 3; if (c->version > 'b') { if(c->pic->data[0]) avctx->release_buffer(avctx, c->pic); if ((ret = ff_get_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } } else { if ((ret = avctx->reget_buffer(avctx, c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } } init_get_bits(&gb, pkt->data, bits_count); if (c->has_alpha) { if (c->version >= 'i') skip_bits_long(&gb, 32); if ((ret = bink_decode_plane(c, &gb, 3, 0)) < 0) return ret; } if (c->version >= 'i') skip_bits_long(&gb, 32); for (plane = 0; plane < 3; plane++) { plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); if (c->version > 'b') { if ((ret = bink_decode_plane(c, &gb, plane_idx, !!plane)) < 0) return ret; } else { if ((ret = binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane)) < 0) return ret; } if (get_bits_count(&gb) >= bits_count) break; } emms_c(); *got_frame = 1; *(AVFrame*)data = *c->pic; if (c->version > 'b') FFSWAP(AVFrame*, c->pic, c->last); return pkt->size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { BinkContext * const c = VAR_0->priv_data; GetBitContext gb; int VAR_4, VAR_5, VAR_6; int VAR_7 = VAR_3->size << 3; if (c->version > 'b') { if(c->pic->VAR_1[0]) VAR_0->release_buffer(VAR_0, c->pic); if ((VAR_6 = ff_get_buffer(VAR_0, c->pic)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_6; } } else { if ((VAR_6 = VAR_0->reget_buffer(VAR_0, c->pic)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return VAR_6; } } init_get_bits(&gb, VAR_3->VAR_1, VAR_7); if (c->has_alpha) { if (c->version >= 'i') skip_bits_long(&gb, 32); if ((VAR_6 = bink_decode_plane(c, &gb, 3, 0)) < 0) return VAR_6; } if (c->version >= 'i') skip_bits_long(&gb, 32); for (VAR_4 = 0; VAR_4 < 3; VAR_4++) { VAR_5 = (!VAR_4 || !c->swap_planes) ? VAR_4 : (VAR_4 ^ 3); if (c->version > 'b') { if ((VAR_6 = bink_decode_plane(c, &gb, VAR_5, !!VAR_4)) < 0) return VAR_6; } else { if ((VAR_6 = binkb_decode_plane(c, &gb, VAR_5, !VAR_3->pts, !!VAR_4)) < 0) return VAR_6; } if (get_bits_count(&gb) >= VAR_7) break; } emms_c(); *VAR_2 = 1; *(AVFrame*)VAR_1 = *c->pic; if (c->version > 'b') FFSWAP(AVFrame*, c->pic, c->last); return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "BinkContext * const c = VAR_0->priv_data;", "GetBitContext gb;", "int VAR_4, VAR_5, VAR_6;", "int VAR_7 = VAR_3->size << 3;", "if (c->version > 'b') {", "if(c->pic->VAR_1[0])\nVAR_0->release_buffer(VAR_0, c->pic);", "if ((VAR_6 = ff_get_buffer(VAR_0, c->pic)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_6;", "}", "} else {", "if ((VAR_6 = VAR_0->reget_buffer(VAR_0, c->pic)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"reget_buffer() failed\\n\");", "return VAR_6;", "}", "}", "init_get_bits(&gb, VAR_3->VAR_1, VAR_7);", "if (c->has_alpha) {", "if (c->version >= 'i')\nskip_bits_long(&gb, 32);", "if ((VAR_6 = bink_decode_plane(c, &gb, 3, 0)) < 0)\nreturn VAR_6;", "}", "if (c->version >= 'i')\nskip_bits_long(&gb, 32);", "for (VAR_4 = 0; VAR_4 < 3; VAR_4++) {", "VAR_5 = (!VAR_4 || !c->swap_planes) ? VAR_4 : (VAR_4 ^ 3);", "if (c->version > 'b') {", "if ((VAR_6 = bink_decode_plane(c, &gb, VAR_5, !!VAR_4)) < 0)\nreturn VAR_6;", "} else {", "if ((VAR_6 = binkb_decode_plane(c, &gb, VAR_5, !VAR_3->pts, !!VAR_4)) < 0)\nreturn VAR_6;", "}", "if (get_bits_count(&gb) >= VAR_7)\nbreak;", "}", "emms_c();", "*VAR_2 = 1;", "*(AVFrame*)VAR_1 = *c->pic;", "if (c->version > 'b')\nFFSWAP(AVFrame*, c->pic, c->last);", "return VAR_3->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59, 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 109 ], [ 111 ] ]
11,024
static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { int i, j, p; for (p = 0; p < 4; p++) { int srcstr = srcStride[p] >> 1; int dststr = dstStride[p] >> 1; uint16_t *dstPtr = (uint16_t *) dst[p]; const uint16_t *srcPtr = (const uint16_t *) src[p]; int min_stride = FFMIN(srcstr, dststr); if(!dstPtr || !srcPtr) continue; for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { for (j = 0; j < min_stride; j++) { dstPtr[j] = av_bswap16(srcPtr[j]); } srcPtr += srcstr; dstPtr += dststr; } } return srcSliceH; }
false
FFmpeg
91f4a44ff4fa55e0a48f71c432a1dc3158d662b9
static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { int i, j, p; for (p = 0; p < 4; p++) { int srcstr = srcStride[p] >> 1; int dststr = dstStride[p] >> 1; uint16_t *dstPtr = (uint16_t *) dst[p]; const uint16_t *srcPtr = (const uint16_t *) src[p]; int min_stride = FFMIN(srcstr, dststr); if(!dstPtr || !srcPtr) continue; for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { for (j = 0; j < min_stride; j++) { dstPtr[j] = av_bswap16(srcPtr[j]); } srcPtr += srcstr; dstPtr += dststr; } } return srcSliceH; }
{ "code": [], "line_no": [] }
static int FUNC_0(SwsContext *VAR_0, const uint8_t *VAR_1[], int VAR_2[], int VAR_3, int VAR_4, uint8_t *VAR_5[], int VAR_6[]) { int VAR_7, VAR_8, VAR_9; for (VAR_9 = 0; VAR_9 < 4; VAR_9++) { int VAR_10 = VAR_2[VAR_9] >> 1; int VAR_11 = VAR_6[VAR_9] >> 1; uint16_t *dstPtr = (uint16_t *) VAR_5[VAR_9]; const uint16_t *VAR_12 = (const uint16_t *) VAR_1[VAR_9]; int VAR_13 = FFMIN(VAR_10, VAR_11); if(!dstPtr || !VAR_12) continue; for (VAR_7 = 0; VAR_7 < (VAR_4 >> VAR_0->chrDstVSubSample); VAR_7++) { for (VAR_8 = 0; VAR_8 < VAR_13; VAR_8++) { dstPtr[VAR_8] = av_bswap16(VAR_12[VAR_8]); } VAR_12 += VAR_10; dstPtr += VAR_11; } } return VAR_4; }
[ "static int FUNC_0(SwsContext *VAR_0, const uint8_t *VAR_1[],\nint VAR_2[], int VAR_3, int VAR_4,\nuint8_t *VAR_5[], int VAR_6[])\n{", "int VAR_7, VAR_8, VAR_9;", "for (VAR_9 = 0; VAR_9 < 4; VAR_9++) {", "int VAR_10 = VAR_2[VAR_9] >> 1;", "int VAR_11 = VAR_6[VAR_9] >> 1;", "uint16_t *dstPtr = (uint16_t *) VAR_5[VAR_9];", "const uint16_t *VAR_12 = (const uint16_t *) VAR_1[VAR_9];", "int VAR_13 = FFMIN(VAR_10, VAR_11);", "if(!dstPtr || !VAR_12)\ncontinue;", "for (VAR_7 = 0; VAR_7 < (VAR_4 >> VAR_0->chrDstVSubSample); VAR_7++) {", "for (VAR_8 = 0; VAR_8 < VAR_13; VAR_8++) {", "dstPtr[VAR_8] = av_bswap16(VAR_12[VAR_8]);", "}", "VAR_12 += VAR_10;", "dstPtr += VAR_11;", "}", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
11,025
static void video_refresh(void *opaque) { VideoState *is = opaque; VideoPicture *vp; double time; SubPicture *sp, *sp2; if (!is->paused && get_master_sync_type(is) == AV_SYNC_EXTERNAL_CLOCK && is->realtime) check_external_clock_speed(is); if (!display_disable && is->show_mode != SHOW_MODE_VIDEO && is->audio_st) video_display(is); if (is->video_st) { if (is->force_refresh) pictq_prev_picture(is); retry: if (is->pictq_size == 0) { SDL_LockMutex(is->pictq_mutex); if (is->frame_last_dropped_pts != AV_NOPTS_VALUE && is->frame_last_dropped_pts > is->frame_last_pts) { update_video_pts(is, is->frame_last_dropped_pts, is->frame_last_dropped_pos, 0); is->frame_last_dropped_pts = AV_NOPTS_VALUE; } SDL_UnlockMutex(is->pictq_mutex); // nothing to do, no picture to display in the queue } else { double last_duration, duration, delay; /* dequeue the picture */ vp = &is->pictq[is->pictq_rindex]; if (vp->serial != is->videoq.serial) { pictq_next_picture(is); goto retry; } if (is->paused) goto display; /* compute nominal last_duration */ last_duration = vp->pts - is->frame_last_pts; if (last_duration > 0 && last_duration < is->max_frame_duration) { /* if duration of the last frame was sane, update last_duration in video state */ is->frame_last_duration = last_duration; } delay = compute_target_delay(is->frame_last_duration, is); time= av_gettime()/1000000.0; if (time < is->frame_timer + delay) return; if (delay > 0) is->frame_timer += delay * FFMAX(1, floor((time-is->frame_timer) / delay)); SDL_LockMutex(is->pictq_mutex); update_video_pts(is, vp->pts, vp->pos, vp->serial); SDL_UnlockMutex(is->pictq_mutex); if (is->pictq_size > 1) { VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE]; duration = nextvp->pts - vp->pts; if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){ is->frame_drops_late++; pictq_next_picture(is); goto retry; } } if (is->subtitle_st) { if (is->subtitle_stream_changed) { SDL_LockMutex(is->subpq_mutex); while (is->subpq_size) { free_subpicture(&is->subpq[is->subpq_rindex]); /* update queue size and signal for next picture */ if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) is->subpq_rindex = 0; is->subpq_size--; } is->subtitle_stream_changed = 0; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); } else { if (is->subpq_size > 0) { sp = &is->subpq[is->subpq_rindex]; if (is->subpq_size > 1) sp2 = &is->subpq[(is->subpq_rindex + 1) % SUBPICTURE_QUEUE_SIZE]; else sp2 = NULL; if ((is->video_current_pts > (sp->pts + ((float) sp->sub.end_display_time / 1000))) || (sp2 && is->video_current_pts > (sp2->pts + ((float) sp2->sub.start_display_time / 1000)))) { free_subpicture(sp); /* update queue size and signal for next picture */ if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) is->subpq_rindex = 0; SDL_LockMutex(is->subpq_mutex); is->subpq_size--; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); } } } } display: /* display picture */ if (!display_disable && is->show_mode == SHOW_MODE_VIDEO) video_display(is); pictq_next_picture(is); if (is->step && !is->paused) stream_toggle_pause(is); } } is->force_refresh = 0; if (show_status) { static int64_t last_time; int64_t cur_time; int aqsize, vqsize, sqsize; double av_diff; cur_time = av_gettime(); if (!last_time || (cur_time - last_time) >= 30000) { aqsize = 0; vqsize = 0; sqsize = 0; if (is->audio_st) aqsize = is->audioq.size; if (is->video_st) vqsize = is->videoq.size; if (is->subtitle_st) sqsize = is->subtitleq.size; av_diff = 0; if (is->audio_st && is->video_st) av_diff = get_audio_clock(is) - get_video_clock(is); printf("%7.2f A-V:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", get_master_clock(is), av_diff, is->frame_drops_early + is->frame_drops_late, aqsize / 1024, vqsize / 1024, sqsize, is->video_st ? is->video_st->codec->pts_correction_num_faulty_dts : 0, is->video_st ? is->video_st->codec->pts_correction_num_faulty_pts : 0); fflush(stdout); last_time = cur_time; } } }
false
FFmpeg
b853cfe7eaf13b7d4ff3ceba7098544ccc049df8
static void video_refresh(void *opaque) { VideoState *is = opaque; VideoPicture *vp; double time; SubPicture *sp, *sp2; if (!is->paused && get_master_sync_type(is) == AV_SYNC_EXTERNAL_CLOCK && is->realtime) check_external_clock_speed(is); if (!display_disable && is->show_mode != SHOW_MODE_VIDEO && is->audio_st) video_display(is); if (is->video_st) { if (is->force_refresh) pictq_prev_picture(is); retry: if (is->pictq_size == 0) { SDL_LockMutex(is->pictq_mutex); if (is->frame_last_dropped_pts != AV_NOPTS_VALUE && is->frame_last_dropped_pts > is->frame_last_pts) { update_video_pts(is, is->frame_last_dropped_pts, is->frame_last_dropped_pos, 0); is->frame_last_dropped_pts = AV_NOPTS_VALUE; } SDL_UnlockMutex(is->pictq_mutex); } else { double last_duration, duration, delay; vp = &is->pictq[is->pictq_rindex]; if (vp->serial != is->videoq.serial) { pictq_next_picture(is); goto retry; } if (is->paused) goto display; last_duration = vp->pts - is->frame_last_pts; if (last_duration > 0 && last_duration < is->max_frame_duration) { is->frame_last_duration = last_duration; } delay = compute_target_delay(is->frame_last_duration, is); time= av_gettime()/1000000.0; if (time < is->frame_timer + delay) return; if (delay > 0) is->frame_timer += delay * FFMAX(1, floor((time-is->frame_timer) / delay)); SDL_LockMutex(is->pictq_mutex); update_video_pts(is, vp->pts, vp->pos, vp->serial); SDL_UnlockMutex(is->pictq_mutex); if (is->pictq_size > 1) { VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE]; duration = nextvp->pts - vp->pts; if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && time > is->frame_timer + duration){ is->frame_drops_late++; pictq_next_picture(is); goto retry; } } if (is->subtitle_st) { if (is->subtitle_stream_changed) { SDL_LockMutex(is->subpq_mutex); while (is->subpq_size) { free_subpicture(&is->subpq[is->subpq_rindex]); if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) is->subpq_rindex = 0; is->subpq_size--; } is->subtitle_stream_changed = 0; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); } else { if (is->subpq_size > 0) { sp = &is->subpq[is->subpq_rindex]; if (is->subpq_size > 1) sp2 = &is->subpq[(is->subpq_rindex + 1) % SUBPICTURE_QUEUE_SIZE]; else sp2 = NULL; if ((is->video_current_pts > (sp->pts + ((float) sp->sub.end_display_time / 1000))) || (sp2 && is->video_current_pts > (sp2->pts + ((float) sp2->sub.start_display_time / 1000)))) { free_subpicture(sp); if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) is->subpq_rindex = 0; SDL_LockMutex(is->subpq_mutex); is->subpq_size--; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); } } } } display: if (!display_disable && is->show_mode == SHOW_MODE_VIDEO) video_display(is); pictq_next_picture(is); if (is->step && !is->paused) stream_toggle_pause(is); } } is->force_refresh = 0; if (show_status) { static int64_t last_time; int64_t cur_time; int aqsize, vqsize, sqsize; double av_diff; cur_time = av_gettime(); if (!last_time || (cur_time - last_time) >= 30000) { aqsize = 0; vqsize = 0; sqsize = 0; if (is->audio_st) aqsize = is->audioq.size; if (is->video_st) vqsize = is->videoq.size; if (is->subtitle_st) sqsize = is->subtitleq.size; av_diff = 0; if (is->audio_st && is->video_st) av_diff = get_audio_clock(is) - get_video_clock(is); printf("%7.2f A-V:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", get_master_clock(is), av_diff, is->frame_drops_early + is->frame_drops_late, aqsize / 1024, vqsize / 1024, sqsize, is->video_st ? is->video_st->codec->pts_correction_num_faulty_dts : 0, is->video_st ? is->video_st->codec->pts_correction_num_faulty_pts : 0); fflush(stdout); last_time = cur_time; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { VideoState *is = VAR_0; VideoPicture *vp; double VAR_1; SubPicture *sp, *sp2; if (!is->paused && get_master_sync_type(is) == AV_SYNC_EXTERNAL_CLOCK && is->realtime) check_external_clock_speed(is); if (!display_disable && is->show_mode != SHOW_MODE_VIDEO && is->audio_st) video_display(is); if (is->video_st) { if (is->force_refresh) pictq_prev_picture(is); retry: if (is->pictq_size == 0) { SDL_LockMutex(is->pictq_mutex); if (is->frame_last_dropped_pts != AV_NOPTS_VALUE && is->frame_last_dropped_pts > is->frame_last_pts) { update_video_pts(is, is->frame_last_dropped_pts, is->frame_last_dropped_pos, 0); is->frame_last_dropped_pts = AV_NOPTS_VALUE; } SDL_UnlockMutex(is->pictq_mutex); } else { double VAR_2, VAR_3, VAR_4; vp = &is->pictq[is->pictq_rindex]; if (vp->serial != is->videoq.serial) { pictq_next_picture(is); goto retry; } if (is->paused) goto display; VAR_2 = vp->pts - is->frame_last_pts; if (VAR_2 > 0 && VAR_2 < is->max_frame_duration) { is->frame_last_duration = VAR_2; } VAR_4 = compute_target_delay(is->frame_last_duration, is); VAR_1= av_gettime()/1000000.0; if (VAR_1 < is->frame_timer + VAR_4) return; if (VAR_4 > 0) is->frame_timer += VAR_4 * FFMAX(1, floor((VAR_1-is->frame_timer) / VAR_4)); SDL_LockMutex(is->pictq_mutex); update_video_pts(is, vp->pts, vp->pos, vp->serial); SDL_UnlockMutex(is->pictq_mutex); if (is->pictq_size > 1) { VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE]; VAR_3 = nextvp->pts - vp->pts; if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && VAR_1 > is->frame_timer + VAR_3){ is->frame_drops_late++; pictq_next_picture(is); goto retry; } } if (is->subtitle_st) { if (is->subtitle_stream_changed) { SDL_LockMutex(is->subpq_mutex); while (is->subpq_size) { free_subpicture(&is->subpq[is->subpq_rindex]); if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) is->subpq_rindex = 0; is->subpq_size--; } is->subtitle_stream_changed = 0; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); } else { if (is->subpq_size > 0) { sp = &is->subpq[is->subpq_rindex]; if (is->subpq_size > 1) sp2 = &is->subpq[(is->subpq_rindex + 1) % SUBPICTURE_QUEUE_SIZE]; else sp2 = NULL; if ((is->video_current_pts > (sp->pts + ((float) sp->sub.end_display_time / 1000))) || (sp2 && is->video_current_pts > (sp2->pts + ((float) sp2->sub.start_display_time / 1000)))) { free_subpicture(sp); if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) is->subpq_rindex = 0; SDL_LockMutex(is->subpq_mutex); is->subpq_size--; SDL_CondSignal(is->subpq_cond); SDL_UnlockMutex(is->subpq_mutex); } } } } display: if (!display_disable && is->show_mode == SHOW_MODE_VIDEO) video_display(is); pictq_next_picture(is); if (is->step && !is->paused) stream_toggle_pause(is); } } is->force_refresh = 0; if (show_status) { static int64_t VAR_5; int64_t cur_time; int VAR_6, VAR_7, VAR_8; double VAR_9; cur_time = av_gettime(); if (!VAR_5 || (cur_time - VAR_5) >= 30000) { VAR_6 = 0; VAR_7 = 0; VAR_8 = 0; if (is->audio_st) VAR_6 = is->audioq.size; if (is->video_st) VAR_7 = is->videoq.size; if (is->subtitle_st) VAR_8 = is->subtitleq.size; VAR_9 = 0; if (is->audio_st && is->video_st) VAR_9 = get_audio_clock(is) - get_video_clock(is); printf("%7.2f A-V:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", get_master_clock(is), VAR_9, is->frame_drops_early + is->frame_drops_late, VAR_6 / 1024, VAR_7 / 1024, VAR_8, is->video_st ? is->video_st->codec->pts_correction_num_faulty_dts : 0, is->video_st ? is->video_st->codec->pts_correction_num_faulty_pts : 0); fflush(stdout); VAR_5 = cur_time; } } }
[ "static void FUNC_0(void *VAR_0)\n{", "VideoState *is = VAR_0;", "VideoPicture *vp;", "double VAR_1;", "SubPicture *sp, *sp2;", "if (!is->paused && get_master_sync_type(is) == AV_SYNC_EXTERNAL_CLOCK && is->realtime)\ncheck_external_clock_speed(is);", "if (!display_disable && is->show_mode != SHOW_MODE_VIDEO && is->audio_st)\nvideo_display(is);", "if (is->video_st) {", "if (is->force_refresh)\npictq_prev_picture(is);", "retry:\nif (is->pictq_size == 0) {", "SDL_LockMutex(is->pictq_mutex);", "if (is->frame_last_dropped_pts != AV_NOPTS_VALUE && is->frame_last_dropped_pts > is->frame_last_pts) {", "update_video_pts(is, is->frame_last_dropped_pts, is->frame_last_dropped_pos, 0);", "is->frame_last_dropped_pts = AV_NOPTS_VALUE;", "}", "SDL_UnlockMutex(is->pictq_mutex);", "} else {", "double VAR_2, VAR_3, VAR_4;", "vp = &is->pictq[is->pictq_rindex];", "if (vp->serial != is->videoq.serial) {", "pictq_next_picture(is);", "goto retry;", "}", "if (is->paused)\ngoto display;", "VAR_2 = vp->pts - is->frame_last_pts;", "if (VAR_2 > 0 && VAR_2 < is->max_frame_duration) {", "is->frame_last_duration = VAR_2;", "}", "VAR_4 = compute_target_delay(is->frame_last_duration, is);", "VAR_1= av_gettime()/1000000.0;", "if (VAR_1 < is->frame_timer + VAR_4)\nreturn;", "if (VAR_4 > 0)\nis->frame_timer += VAR_4 * FFMAX(1, floor((VAR_1-is->frame_timer) / VAR_4));", "SDL_LockMutex(is->pictq_mutex);", "update_video_pts(is, vp->pts, vp->pos, vp->serial);", "SDL_UnlockMutex(is->pictq_mutex);", "if (is->pictq_size > 1) {", "VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE];", "VAR_3 = nextvp->pts - vp->pts;", "if(!is->step && (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) && VAR_1 > is->frame_timer + VAR_3){", "is->frame_drops_late++;", "pictq_next_picture(is);", "goto retry;", "}", "}", "if (is->subtitle_st) {", "if (is->subtitle_stream_changed) {", "SDL_LockMutex(is->subpq_mutex);", "while (is->subpq_size) {", "free_subpicture(&is->subpq[is->subpq_rindex]);", "if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE)\nis->subpq_rindex = 0;", "is->subpq_size--;", "}", "is->subtitle_stream_changed = 0;", "SDL_CondSignal(is->subpq_cond);", "SDL_UnlockMutex(is->subpq_mutex);", "} else {", "if (is->subpq_size > 0) {", "sp = &is->subpq[is->subpq_rindex];", "if (is->subpq_size > 1)\nsp2 = &is->subpq[(is->subpq_rindex + 1) % SUBPICTURE_QUEUE_SIZE];", "else\nsp2 = NULL;", "if ((is->video_current_pts > (sp->pts + ((float) sp->sub.end_display_time / 1000)))\n|| (sp2 && is->video_current_pts > (sp2->pts + ((float) sp2->sub.start_display_time / 1000))))\n{", "free_subpicture(sp);", "if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE)\nis->subpq_rindex = 0;", "SDL_LockMutex(is->subpq_mutex);", "is->subpq_size--;", "SDL_CondSignal(is->subpq_cond);", "SDL_UnlockMutex(is->subpq_mutex);", "}", "}", "}", "}", "display:\nif (!display_disable && is->show_mode == SHOW_MODE_VIDEO)\nvideo_display(is);", "pictq_next_picture(is);", "if (is->step && !is->paused)\nstream_toggle_pause(is);", "}", "}", "is->force_refresh = 0;", "if (show_status) {", "static int64_t VAR_5;", "int64_t cur_time;", "int VAR_6, VAR_7, VAR_8;", "double VAR_9;", "cur_time = av_gettime();", "if (!VAR_5 || (cur_time - VAR_5) >= 30000) {", "VAR_6 = 0;", "VAR_7 = 0;", "VAR_8 = 0;", "if (is->audio_st)\nVAR_6 = is->audioq.size;", "if (is->video_st)\nVAR_7 = is->videoq.size;", "if (is->subtitle_st)\nVAR_8 = is->subtitleq.size;", "VAR_9 = 0;", "if (is->audio_st && is->video_st)\nVAR_9 = get_audio_clock(is) - get_video_clock(is);", "printf(\"%7.2f A-V:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%\"PRId64\"/%\"PRId64\" \\r\",\nget_master_clock(is),\nVAR_9,\nis->frame_drops_early + is->frame_drops_late,\nVAR_6 / 1024,\nVAR_7 / 1024,\nVAR_8,\nis->video_st ? is->video_st->codec->pts_correction_num_faulty_dts : 0,\nis->video_st ? is->video_st->codec->pts_correction_num_faulty_pts : 0);", "fflush(stdout);", "VAR_5 = cur_time;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 23, 25 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 153, 155 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179, 181 ], [ 183, 185 ], [ 189, 191, 193 ], [ 195 ], [ 201, 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225, 229, 231 ], [ 235 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275, 277 ], [ 279, 281 ], [ 283 ], [ 285, 287 ], [ 289, 291, 293, 295, 297, 299, 301, 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ] ]
11,028
static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt); FrameBuffer *buf; int i, ret; int pixel_size; int h_chroma_shift, v_chroma_shift; int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1 int w = s->width, h = s->height; if (!desc) return AVERROR(EINVAL); pixel_size = desc->comp[0].step_minus1 + 1; buf = av_mallocz(sizeof(*buf)); if (!buf) return AVERROR(ENOMEM); if (!(s->flags & CODEC_FLAG_EMU_EDGE)) { w += 2*edge; h += 2*edge; } avcodec_align_dimensions(s, &w, &h); if ((ret = av_image_alloc(buf->base, buf->linesize, w, h, s->pix_fmt, 32)) < 0) { av_freep(&buf); return ret; } /* XXX this shouldn't be needed, but some tests break without this line * those decoders are buggy and need to be fixed. * the following tests fail: */ memset(buf->base[0], 128, ret); av_pix_fmt_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) { const int h_shift = i==0 ? 0 : h_chroma_shift; const int v_shift = i==0 ? 0 : v_chroma_shift; if (s->flags & CODEC_FLAG_EMU_EDGE) buf->data[i] = buf->base[i]; else if (buf->base[i]) buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*edge >> v_shift) + (pixel_size*edge >> h_shift), 32); } buf->w = s->width; buf->h = s->height; buf->pix_fmt = s->pix_fmt; buf->pool = pool; *pbuf = buf; return 0; }
false
FFmpeg
d2a25c4032ce6ceabb0f51b5c1e6ca865395a793
static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt); FrameBuffer *buf; int i, ret; int pixel_size; int h_chroma_shift, v_chroma_shift; int edge = 32; int w = s->width, h = s->height; if (!desc) return AVERROR(EINVAL); pixel_size = desc->comp[0].step_minus1 + 1; buf = av_mallocz(sizeof(*buf)); if (!buf) return AVERROR(ENOMEM); if (!(s->flags & CODEC_FLAG_EMU_EDGE)) { w += 2*edge; h += 2*edge; } avcodec_align_dimensions(s, &w, &h); if ((ret = av_image_alloc(buf->base, buf->linesize, w, h, s->pix_fmt, 32)) < 0) { av_freep(&buf); return ret; } memset(buf->base[0], 128, ret); av_pix_fmt_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) { const int h_shift = i==0 ? 0 : h_chroma_shift; const int v_shift = i==0 ? 0 : v_chroma_shift; if (s->flags & CODEC_FLAG_EMU_EDGE) buf->data[i] = buf->base[i]; else if (buf->base[i]) buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*edge >> v_shift) + (pixel_size*edge >> h_shift), 32); } buf->w = s->width; buf->h = s->height; buf->pix_fmt = s->pix_fmt; buf->pool = pool; *pbuf = buf; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FrameBuffer **VAR_0, AVCodecContext *VAR_1, FrameBuffer **VAR_2) { const AVPixFmtDescriptor *VAR_3 = av_pix_fmt_desc_get(VAR_1->pix_fmt); FrameBuffer *buf; int VAR_4, VAR_5; int VAR_6; int VAR_7, VAR_8; int VAR_9 = 32; int VAR_10 = VAR_1->width, VAR_11 = VAR_1->height; if (!VAR_3) return AVERROR(EINVAL); VAR_6 = VAR_3->comp[0].step_minus1 + 1; buf = av_mallocz(sizeof(*buf)); if (!buf) return AVERROR(ENOMEM); if (!(VAR_1->flags & CODEC_FLAG_EMU_EDGE)) { VAR_10 += 2*VAR_9; VAR_11 += 2*VAR_9; } avcodec_align_dimensions(VAR_1, &VAR_10, &VAR_11); if ((VAR_5 = av_image_alloc(buf->base, buf->linesize, VAR_10, VAR_11, VAR_1->pix_fmt, 32)) < 0) { av_freep(&buf); return VAR_5; } memset(buf->base[0], 128, VAR_5); av_pix_fmt_get_chroma_sub_sample(VAR_1->pix_fmt, &VAR_7, &VAR_8); for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(buf->data); VAR_4++) { const int h_shift = VAR_4==0 ? 0 : VAR_7; const int v_shift = VAR_4==0 ? 0 : VAR_8; if (VAR_1->flags & CODEC_FLAG_EMU_EDGE) buf->data[VAR_4] = buf->base[VAR_4]; else if (buf->base[VAR_4]) buf->data[VAR_4] = buf->base[VAR_4] + FFALIGN((buf->linesize[VAR_4]*VAR_9 >> v_shift) + (VAR_6*VAR_9 >> h_shift), 32); } buf->VAR_10 = VAR_1->width; buf->VAR_11 = VAR_1->height; buf->pix_fmt = VAR_1->pix_fmt; buf->VAR_0 = VAR_0; *VAR_2 = buf; return 0; }
[ "static int FUNC_0(FrameBuffer **VAR_0, AVCodecContext *VAR_1, FrameBuffer **VAR_2)\n{", "const AVPixFmtDescriptor *VAR_3 = av_pix_fmt_desc_get(VAR_1->pix_fmt);", "FrameBuffer *buf;", "int VAR_4, VAR_5;", "int VAR_6;", "int VAR_7, VAR_8;", "int VAR_9 = 32;", "int VAR_10 = VAR_1->width, VAR_11 = VAR_1->height;", "if (!VAR_3)\nreturn AVERROR(EINVAL);", "VAR_6 = VAR_3->comp[0].step_minus1 + 1;", "buf = av_mallocz(sizeof(*buf));", "if (!buf)\nreturn AVERROR(ENOMEM);", "if (!(VAR_1->flags & CODEC_FLAG_EMU_EDGE)) {", "VAR_10 += 2*VAR_9;", "VAR_11 += 2*VAR_9;", "}", "avcodec_align_dimensions(VAR_1, &VAR_10, &VAR_11);", "if ((VAR_5 = av_image_alloc(buf->base, buf->linesize, VAR_10, VAR_11,\nVAR_1->pix_fmt, 32)) < 0) {", "av_freep(&buf);", "return VAR_5;", "}", "memset(buf->base[0], 128, VAR_5);", "av_pix_fmt_get_chroma_sub_sample(VAR_1->pix_fmt,\n&VAR_7, &VAR_8);", "for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(buf->data); VAR_4++) {", "const int h_shift = VAR_4==0 ? 0 : VAR_7;", "const int v_shift = VAR_4==0 ? 0 : VAR_8;", "if (VAR_1->flags & CODEC_FLAG_EMU_EDGE)\nbuf->data[VAR_4] = buf->base[VAR_4];", "else if (buf->base[VAR_4])\nbuf->data[VAR_4] = buf->base[VAR_4] +\nFFALIGN((buf->linesize[VAR_4]*VAR_9 >> v_shift) +\n(VAR_6*VAR_9 >> h_shift), 32);", "}", "buf->VAR_10 = VAR_1->width;", "buf->VAR_11 = VAR_1->height;", "buf->pix_fmt = VAR_1->pix_fmt;", "buf->VAR_0 = VAR_0;", "*VAR_2 = buf;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 67 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ] ]
11,029
URLProtocol *ffurl_protocol_next(const URLProtocol *prev) { return prev ? prev->next : first_protocol; }
false
FFmpeg
2758cdedfb7ac61f8b5e4861f99218b6fd43491d
URLProtocol *ffurl_protocol_next(const URLProtocol *prev) { return prev ? prev->next : first_protocol; }
{ "code": [], "line_no": [] }
URLProtocol *FUNC_0(const URLProtocol *prev) { return prev ? prev->next : first_protocol; }
[ "URLProtocol *FUNC_0(const URLProtocol *prev)\n{", "return prev ? prev->next : first_protocol;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,030
static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (tag == MKTAG('d','v','c','p') || track->enc->codec_id == CODEC_ID_RAWVIDEO || track->enc->codec_id == CODEC_ID_H263 || av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio if (track->enc->codec_id == CODEC_ID_DVVIDEO) tag = mov_get_dv_codec_tag(s, track); else if (track->enc->codec_id == CODEC_ID_RAWVIDEO) tag = mov_get_rawvideo_codec_tag(s, track); else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id); if (!tag) { // if no mac fcc found, try with Microsoft tags tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id); if (tag) av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, " "the file may be unplayable!\n"); } } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id); if (!tag) { // if no mac fcc found, try with Microsoft tags int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id); if (ms_tag) { tag = MKTAG('m', 's', ((ms_tag >> 8) & 0xff), (ms_tag & 0xff)); av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, " "the file may be unplayable!\n"); } } } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id); } return tag; }
false
FFmpeg
a2b7ed3274b2b575f6d2e8fd3bf0a6a1818b2c1e
static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (tag == MKTAG('d','v','c','p') || track->enc->codec_id == CODEC_ID_RAWVIDEO || track->enc->codec_id == CODEC_ID_H263 || av_get_bits_per_sample(track->enc->codec_id)))) { if (track->enc->codec_id == CODEC_ID_DVVIDEO) tag = mov_get_dv_codec_tag(s, track); else if (track->enc->codec_id == CODEC_ID_RAWVIDEO) tag = mov_get_rawvideo_codec_tag(s, track); else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id); if (!tag) { tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id); if (tag) av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, " "the file may be unplayable!\n"); } } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id); if (!tag) { int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id); if (ms_tag) { tag = MKTAG('m', 's', ((ms_tag >> 8) & 0xff), (ms_tag & 0xff)); av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, " "the file may be unplayable!\n"); } } } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id); } return tag; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, MOVTrack *VAR_1) { int VAR_2 = VAR_1->enc->codec_tag; if (!VAR_2 || (VAR_1->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (VAR_2 == MKTAG('d','v','c','p') || VAR_1->enc->codec_id == CODEC_ID_RAWVIDEO || VAR_1->enc->codec_id == CODEC_ID_H263 || av_get_bits_per_sample(VAR_1->enc->codec_id)))) { if (VAR_1->enc->codec_id == CODEC_ID_DVVIDEO) VAR_2 = mov_get_dv_codec_tag(VAR_0, VAR_1); else if (VAR_1->enc->codec_id == CODEC_ID_RAWVIDEO) VAR_2 = mov_get_rawvideo_codec_tag(VAR_0, VAR_1); else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_2 = ff_codec_get_tag(codec_movvideo_tags, VAR_1->enc->codec_id); if (!VAR_2) { VAR_2 = ff_codec_get_tag(ff_codec_bmp_tags, VAR_1->enc->codec_id); if (VAR_2) av_log(VAR_0, AV_LOG_INFO, "Warning, using MS style video codec VAR_2, " "the file may be unplayable!\n"); } } else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_AUDIO) { VAR_2 = ff_codec_get_tag(codec_movaudio_tags, VAR_1->enc->codec_id); if (!VAR_2) { int VAR_3 = ff_codec_get_tag(ff_codec_wav_tags, VAR_1->enc->codec_id); if (VAR_3) { VAR_2 = MKTAG('m', 'VAR_0', ((VAR_3 >> 8) & 0xff), (VAR_3 & 0xff)); av_log(VAR_0, AV_LOG_INFO, "Warning, using MS style audio codec VAR_2, " "the file may be unplayable!\n"); } } } else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) VAR_2 = ff_codec_get_tag(ff_codec_movsubtitle_tags, VAR_1->enc->codec_id); } return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, MOVTrack *VAR_1)\n{", "int VAR_2 = VAR_1->enc->codec_tag;", "if (!VAR_2 || (VAR_1->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&\n(VAR_2 == MKTAG('d','v','c','p') ||\nVAR_1->enc->codec_id == CODEC_ID_RAWVIDEO ||\nVAR_1->enc->codec_id == CODEC_ID_H263 ||\nav_get_bits_per_sample(VAR_1->enc->codec_id)))) {", "if (VAR_1->enc->codec_id == CODEC_ID_DVVIDEO)\nVAR_2 = mov_get_dv_codec_tag(VAR_0, VAR_1);", "else if (VAR_1->enc->codec_id == CODEC_ID_RAWVIDEO)\nVAR_2 = mov_get_rawvideo_codec_tag(VAR_0, VAR_1);", "else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_2 = ff_codec_get_tag(codec_movvideo_tags, VAR_1->enc->codec_id);", "if (!VAR_2) {", "VAR_2 = ff_codec_get_tag(ff_codec_bmp_tags, VAR_1->enc->codec_id);", "if (VAR_2)\nav_log(VAR_0, AV_LOG_INFO, \"Warning, using MS style video codec VAR_2, \"\n\"the file may be unplayable!\\n\");", "}", "} else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_AUDIO) {", "VAR_2 = ff_codec_get_tag(codec_movaudio_tags, VAR_1->enc->codec_id);", "if (!VAR_2) {", "int VAR_3 = ff_codec_get_tag(ff_codec_wav_tags, VAR_1->enc->codec_id);", "if (VAR_3) {", "VAR_2 = MKTAG('m', 'VAR_0', ((VAR_3 >> 8) & 0xff), (VAR_3 & 0xff));", "av_log(VAR_0, AV_LOG_INFO, \"Warning, using MS style audio codec VAR_2, \"\n\"the file may be unplayable!\\n\");", "}", "}", "} else if (VAR_1->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)", "VAR_2 = ff_codec_get_tag(ff_codec_movsubtitle_tags, VAR_1->enc->codec_id);", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
11,031
static av_cold int nvenc_recalc_surfaces(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; int nb_surfaces = 0; if (ctx->rc_lookahead > 0) { nb_surfaces = ctx->rc_lookahead + ((ctx->encode_config.frameIntervalP > 0) ? ctx->encode_config.frameIntervalP : 0) + 1 + 4; if (ctx->nb_surfaces < nb_surfaces) { av_log(avctx, AV_LOG_WARNING, "Defined rc_lookahead requires more surfaces, " "increasing used surfaces %d -> %d\n", ctx->nb_surfaces, nb_surfaces); ctx->nb_surfaces = nb_surfaces; } } ctx->nb_surfaces = FFMAX(1, FFMIN(MAX_REGISTERED_FRAMES, ctx->nb_surfaces)); ctx->async_depth = FFMIN(ctx->async_depth, ctx->nb_surfaces - 1); return 0; }
false
FFmpeg
8de3458a07376b0a96772e586b6dba5e93432f52
static av_cold int nvenc_recalc_surfaces(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; int nb_surfaces = 0; if (ctx->rc_lookahead > 0) { nb_surfaces = ctx->rc_lookahead + ((ctx->encode_config.frameIntervalP > 0) ? ctx->encode_config.frameIntervalP : 0) + 1 + 4; if (ctx->nb_surfaces < nb_surfaces) { av_log(avctx, AV_LOG_WARNING, "Defined rc_lookahead requires more surfaces, " "increasing used surfaces %d -> %d\n", ctx->nb_surfaces, nb_surfaces); ctx->nb_surfaces = nb_surfaces; } } ctx->nb_surfaces = FFMAX(1, FFMIN(MAX_REGISTERED_FRAMES, ctx->nb_surfaces)); ctx->async_depth = FFMIN(ctx->async_depth, ctx->nb_surfaces - 1); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; int VAR_0 = 0; if (ctx->rc_lookahead > 0) { VAR_0 = ctx->rc_lookahead + ((ctx->encode_config.frameIntervalP > 0) ? ctx->encode_config.frameIntervalP : 0) + 1 + 4; if (ctx->VAR_0 < VAR_0) { av_log(avctx, AV_LOG_WARNING, "Defined rc_lookahead requires more surfaces, " "increasing used surfaces %d -> %d\n", ctx->VAR_0, VAR_0); ctx->VAR_0 = VAR_0; } } ctx->VAR_0 = FFMAX(1, FFMIN(MAX_REGISTERED_FRAMES, ctx->VAR_0)); ctx->async_depth = FFMIN(ctx->async_depth, ctx->VAR_0 - 1); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "NvencContext *ctx = avctx->priv_data;", "int VAR_0 = 0;", "if (ctx->rc_lookahead > 0) {", "VAR_0 = ctx->rc_lookahead + ((ctx->encode_config.frameIntervalP > 0) ? ctx->encode_config.frameIntervalP : 0) + 1 + 4;", "if (ctx->VAR_0 < VAR_0) {", "av_log(avctx, AV_LOG_WARNING,\n\"Defined rc_lookahead requires more surfaces, \"\n\"increasing used surfaces %d -> %d\\n\", ctx->VAR_0, VAR_0);", "ctx->VAR_0 = VAR_0;", "}", "}", "ctx->VAR_0 = FFMAX(1, FFMIN(MAX_REGISTERED_FRAMES, ctx->VAR_0));", "ctx->async_depth = FFMIN(ctx->async_depth, ctx->VAR_0 - 1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
11,032
yuv2rgba64_full_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, int hasAlpha, int eightbytes) { const int32_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], *abuf0 = hasAlpha ? abuf[0] : NULL, *abuf1 = hasAlpha ? abuf[1] : NULL; int yalpha1 = 4096 - yalpha; int uvalpha1 = 4096 - uvalpha; int i; int A = 0xffff<<14; for (i = 0; i < dstW; i++) { int Y = (buf0[i] * yalpha1 + buf1[i] * 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; Y -= c->yuv2rgb_y_offset; Y *= c->yuv2rgb_y_coeff; Y += 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; if (hasAlpha) { A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 1; A += 1 << 13; } output_pixel(&dest[0], av_clip_uintp2(R_B + Y, 30) >> 14); output_pixel(&dest[1], av_clip_uintp2( G + Y, 30) >> 14); output_pixel(&dest[2], av_clip_uintp2(B_R + Y, 30) >> 14); if (eightbytes) { output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); dest += 4; } else { dest += 3; } } }
false
FFmpeg
7cf22c79706d23d40d16cee37eb32d5797adcc2c
yuv2rgba64_full_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, int hasAlpha, int eightbytes) { const int32_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], *abuf0 = hasAlpha ? abuf[0] : NULL, *abuf1 = hasAlpha ? abuf[1] : NULL; int yalpha1 = 4096 - yalpha; int uvalpha1 = 4096 - uvalpha; int i; int A = 0xffff<<14; for (i = 0; i < dstW; i++) { int Y = (buf0[i] * yalpha1 + buf1[i] * 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; Y -= c->yuv2rgb_y_offset; Y *= c->yuv2rgb_y_coeff; Y += 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; if (hasAlpha) { A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 1; A += 1 << 13; } output_pixel(&dest[0], av_clip_uintp2(R_B + Y, 30) >> 14); output_pixel(&dest[1], av_clip_uintp2( G + Y, 30) >> 14); output_pixel(&dest[2], av_clip_uintp2(B_R + Y, 30) >> 14); if (eightbytes) { output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); dest += 4; } else { dest += 3; } } }
{ "code": [], "line_no": [] }
FUNC_0(SwsContext *VAR_0, const int32_t *VAR_1[2], const int32_t *VAR_2[2], const int32_t *VAR_3[2], const int32_t *VAR_4[2], uint16_t *VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, enum AVPixelFormat VAR_10, int VAR_11, int VAR_12) { const int32_t *VAR_13 = VAR_1[0], *buf1 = VAR_1[1], *ubuf0 = VAR_2[0], *ubuf1 = VAR_2[1], *vbuf0 = VAR_3[0], *vbuf1 = VAR_3[1], *abuf0 = VAR_11 ? VAR_4[0] : NULL, *abuf1 = VAR_11 ? VAR_4[1] : NULL; int VAR_14 = 4096 - VAR_7; int VAR_15 = 4096 - VAR_8; int VAR_16; int VAR_17 = 0xffff<<14; for (VAR_16 = 0; VAR_16 < VAR_6; VAR_16++) { int VAR_18 = (VAR_13[VAR_16] * VAR_14 + buf1[VAR_16] * VAR_7) >> 14; int VAR_19 = (ubuf0[VAR_16] * VAR_15 + ubuf1[VAR_16] * VAR_8 + (-128 << 23)) >> 14; int VAR_20 = (vbuf0[VAR_16] * VAR_15 + vbuf1[VAR_16] * VAR_8 + (-128 << 23)) >> 14; int VAR_21, VAR_22, VAR_23; VAR_18 -= VAR_0->yuv2rgb_y_offset; VAR_18 *= VAR_0->yuv2rgb_y_coeff; VAR_18 += 1 << 13; VAR_21 = VAR_20 * VAR_0->yuv2rgb_v2r_coeff; VAR_22 = VAR_20 * VAR_0->yuv2rgb_v2g_coeff + VAR_19 * VAR_0->yuv2rgb_u2g_coeff; VAR_23 = VAR_19 * VAR_0->yuv2rgb_u2b_coeff; if (VAR_11) { VAR_17 = (abuf0[VAR_16] * VAR_14 + abuf1[VAR_16] * VAR_7) >> 1; VAR_17 += 1 << 13; } output_pixel(&VAR_5[0], av_clip_uintp2(R_B + VAR_18, 30) >> 14); output_pixel(&VAR_5[1], av_clip_uintp2( VAR_22 + VAR_18, 30) >> 14); output_pixel(&VAR_5[2], av_clip_uintp2(B_R + VAR_18, 30) >> 14); if (VAR_12) { output_pixel(&VAR_5[3], av_clip_uintp2(VAR_17, 30) >> 14); VAR_5 += 4; } else { VAR_5 += 3; } } }
[ "FUNC_0(SwsContext *VAR_0, const int32_t *VAR_1[2],\nconst int32_t *VAR_2[2], const int32_t *VAR_3[2],\nconst int32_t *VAR_4[2], uint16_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8, int VAR_9,\nenum AVPixelFormat VAR_10, int VAR_11, int VAR_12)\n{", "const int32_t *VAR_13 = VAR_1[0], *buf1 = VAR_1[1],\n*ubuf0 = VAR_2[0], *ubuf1 = VAR_2[1],\n*vbuf0 = VAR_3[0], *vbuf1 = VAR_3[1],\n*abuf0 = VAR_11 ? VAR_4[0] : NULL,\n*abuf1 = VAR_11 ? VAR_4[1] : NULL;", "int VAR_14 = 4096 - VAR_7;", "int VAR_15 = 4096 - VAR_8;", "int VAR_16;", "int VAR_17 = 0xffff<<14;", "for (VAR_16 = 0; VAR_16 < VAR_6; VAR_16++) {", "int VAR_18 = (VAR_13[VAR_16] * VAR_14 + buf1[VAR_16] * VAR_7) >> 14;", "int VAR_19 = (ubuf0[VAR_16] * VAR_15 + ubuf1[VAR_16] * VAR_8 + (-128 << 23)) >> 14;", "int VAR_20 = (vbuf0[VAR_16] * VAR_15 + vbuf1[VAR_16] * VAR_8 + (-128 << 23)) >> 14;", "int VAR_21, VAR_22, VAR_23;", "VAR_18 -= VAR_0->yuv2rgb_y_offset;", "VAR_18 *= VAR_0->yuv2rgb_y_coeff;", "VAR_18 += 1 << 13;", "VAR_21 = VAR_20 * VAR_0->yuv2rgb_v2r_coeff;", "VAR_22 = VAR_20 * VAR_0->yuv2rgb_v2g_coeff + VAR_19 * VAR_0->yuv2rgb_u2g_coeff;", "VAR_23 = VAR_19 * VAR_0->yuv2rgb_u2b_coeff;", "if (VAR_11) {", "VAR_17 = (abuf0[VAR_16] * VAR_14 + abuf1[VAR_16] * VAR_7) >> 1;", "VAR_17 += 1 << 13;", "}", "output_pixel(&VAR_5[0], av_clip_uintp2(R_B + VAR_18, 30) >> 14);", "output_pixel(&VAR_5[1], av_clip_uintp2( VAR_22 + VAR_18, 30) >> 14);", "output_pixel(&VAR_5[2], av_clip_uintp2(B_R + VAR_18, 30) >> 14);", "if (VAR_12) {", "output_pixel(&VAR_5[3], av_clip_uintp2(VAR_17, 30) >> 14);", "VAR_5 += 4;", "} else {", "VAR_5 += 3;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13, 15, 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
11,033
static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt) { if(st->codec->codec_id == CODEC_ID_PROBE){ AVProbeData *pd = &st->probe_data; av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index); --st->probe_packets; pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE); memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size); pd->buf_size += pkt->size; memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); if(av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){ //FIXME we do not reduce score to 0 for the case of running out of buffer space in bytes set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0); if(st->codec->codec_id != CODEC_ID_PROBE){ pd->buf_size=0; av_freep(&pd->buf); av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index); } } } }
false
FFmpeg
f0ff9eb49394d4ba06eff30e0dac2f3ce590e311
static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt) { if(st->codec->codec_id == CODEC_ID_PROBE){ AVProbeData *pd = &st->probe_data; av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index); --st->probe_packets; pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE); memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size); pd->buf_size += pkt->size; memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); if(av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){ set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0); if(st->codec->codec_id != CODEC_ID_PROBE){ pd->buf_size=0; av_freep(&pd->buf); av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const AVPacket *VAR_2) { if(VAR_1->codec->codec_id == CODEC_ID_PROBE){ AVProbeData *pd = &VAR_1->probe_data; av_log(VAR_0, AV_LOG_DEBUG, "probing stream %d\n", VAR_1->index); --VAR_1->probe_packets; pd->buf = av_realloc(pd->buf, pd->buf_size+VAR_2->size+AVPROBE_PADDING_SIZE); memcpy(pd->buf+pd->buf_size, VAR_2->data, VAR_2->size); pd->buf_size += VAR_2->size; memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); if(av_log2(pd->buf_size) != av_log2(pd->buf_size - VAR_2->size)){ set_codec_from_probe_data(VAR_0, VAR_1, pd, VAR_1->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0); if(VAR_1->codec->codec_id != CODEC_ID_PROBE){ pd->buf_size=0; av_freep(&pd->buf); av_log(VAR_0, AV_LOG_DEBUG, "probed stream %d\n", VAR_1->index); } } } }
[ "static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const AVPacket *VAR_2)\n{", "if(VAR_1->codec->codec_id == CODEC_ID_PROBE){", "AVProbeData *pd = &VAR_1->probe_data;", "av_log(VAR_0, AV_LOG_DEBUG, \"probing stream %d\\n\", VAR_1->index);", "--VAR_1->probe_packets;", "pd->buf = av_realloc(pd->buf, pd->buf_size+VAR_2->size+AVPROBE_PADDING_SIZE);", "memcpy(pd->buf+pd->buf_size, VAR_2->data, VAR_2->size);", "pd->buf_size += VAR_2->size;", "memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);", "if(av_log2(pd->buf_size) != av_log2(pd->buf_size - VAR_2->size)){", "set_codec_from_probe_data(VAR_0, VAR_1, pd, VAR_1->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);", "if(VAR_1->codec->codec_id != CODEC_ID_PROBE){", "pd->buf_size=0;", "av_freep(&pd->buf);", "av_log(VAR_0, AV_LOG_DEBUG, \"probed stream %d\\n\", VAR_1->index);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
11,034
static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) { int vo_ver_id; if(s->max_b_frames || s->quarter_sample){ vo_ver_id= 5; s->vo_type= ADV_SIMPLE_VO_TYPE; }else{ vo_ver_id= 1; s->vo_type= SIMPLE_VO_TYPE; } put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x100 + vo_number); /* video obj */ put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x120 + vol_number); /* video obj layer */ put_bits(&s->pb, 1, 0); /* random access vol */ put_bits(&s->pb, 8, s->vo_type); /* video obj type indication */ put_bits(&s->pb, 1, 1); /* is obj layer id= yes */ put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */ put_bits(&s->pb, 3, 1); /* is obj layer priority */ aspect_to_info(s, s->avctx->sample_aspect_ratio); put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */ if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){ put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num); put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den); } if(s->low_delay){ put_bits(&s->pb, 1, 1); /* vol control parameters= yes */ put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */ put_bits(&s->pb, 1, s->low_delay); put_bits(&s->pb, 1, 0); /* vbv parameters= no */ }else{ put_bits(&s->pb, 1, 0); /* vol control parameters= no */ } put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */ put_bits(&s->pb, 1, 1); /* marker bit */ put_bits(&s->pb, 16, s->time_increment_resolution); if (s->time_increment_bits < 1) s->time_increment_bits = 1; put_bits(&s->pb, 1, 1); /* marker bit */ put_bits(&s->pb, 1, 0); /* fixed vop rate=no */ put_bits(&s->pb, 1, 1); /* marker bit */ put_bits(&s->pb, 13, s->width); /* vol width */ put_bits(&s->pb, 1, 1); /* marker bit */ put_bits(&s->pb, 13, s->height); /* vol height */ put_bits(&s->pb, 1, 1); /* marker bit */ put_bits(&s->pb, 1, s->progressive_sequence ? 0 : 1); put_bits(&s->pb, 1, 1); /* obmc disable */ if (vo_ver_id == 1) { put_bits(&s->pb, 1, s->vol_sprite_usage=0); /* sprite enable */ }else{ put_bits(&s->pb, 2, s->vol_sprite_usage=0); /* sprite enable */ } s->quant_precision=5; put_bits(&s->pb, 1, 0); /* not 8 bit == false */ put_bits(&s->pb, 1, s->mpeg_quant); /* quant type= (0=h263 style)*/ if(s->mpeg_quant){ ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix); ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix); } if (vo_ver_id != 1) put_bits(&s->pb, 1, s->quarter_sample); put_bits(&s->pb, 1, 1); /* complexity estimation disable */ s->resync_marker= s->rtp_mode; put_bits(&s->pb, 1, s->resync_marker ? 0 : 1);/* resync marker disable */ put_bits(&s->pb, 1, s->data_partitioning ? 1 : 0); if(s->data_partitioning){ put_bits(&s->pb, 1, 0); /* no rvlc */ } if (vo_ver_id != 1){ put_bits(&s->pb, 1, 0); /* newpred */ put_bits(&s->pb, 1, 0); /* reduced res vop */ } put_bits(&s->pb, 1, 0); /* scalability */ ff_mpeg4_stuffing(&s->pb); /* user data */ if(!(s->flags & CODEC_FLAG_BITEXACT)){ put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1B2); /* user_data */ put_string(&s->pb, LIBAVCODEC_IDENT); ff_mpeg4_stuffing(&s->pb); } }
true
FFmpeg
99683a307776a7638ccce236a4ce5aa3e914e77d
static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) { int vo_ver_id; if(s->max_b_frames || s->quarter_sample){ vo_ver_id= 5; s->vo_type= ADV_SIMPLE_VO_TYPE; }else{ vo_ver_id= 1; s->vo_type= SIMPLE_VO_TYPE; } put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x100 + vo_number); put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x120 + vol_number); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 8, s->vo_type); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 4, vo_ver_id); put_bits(&s->pb, 3, 1); aspect_to_info(s, s->avctx->sample_aspect_ratio); put_bits(&s->pb, 4, s->aspect_ratio_info); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){ put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num); put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den); } if(s->low_delay){ put_bits(&s->pb, 1, 1); put_bits(&s->pb, 2, 1); put_bits(&s->pb, 1, s->low_delay); put_bits(&s->pb, 1, 0); }else{ put_bits(&s->pb, 1, 0); } put_bits(&s->pb, 2, RECT_SHAPE); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 16, s->time_increment_resolution); if (s->time_increment_bits < 1) s->time_increment_bits = 1; put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 13, s->width); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 13, s->height); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, s->progressive_sequence ? 0 : 1); put_bits(&s->pb, 1, 1); if (vo_ver_id == 1) { put_bits(&s->pb, 1, s->vol_sprite_usage=0); }else{ put_bits(&s->pb, 2, s->vol_sprite_usage=0); } s->quant_precision=5; put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, s->mpeg_quant); if(s->mpeg_quant){ ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix); ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix); } if (vo_ver_id != 1) put_bits(&s->pb, 1, s->quarter_sample); put_bits(&s->pb, 1, 1); s->resync_marker= s->rtp_mode; put_bits(&s->pb, 1, s->resync_marker ? 0 : 1); put_bits(&s->pb, 1, s->data_partitioning ? 1 : 0); if(s->data_partitioning){ put_bits(&s->pb, 1, 0); } if (vo_ver_id != 1){ put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); } put_bits(&s->pb, 1, 0); ff_mpeg4_stuffing(&s->pb); if(!(s->flags & CODEC_FLAG_BITEXACT)){ put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1B2); put_string(&s->pb, LIBAVCODEC_IDENT); ff_mpeg4_stuffing(&s->pb); } }
{ "code": [ "\tput_string(&s->pb, LIBAVCODEC_IDENT);", " ff_mpeg4_stuffing(&s->pb);" ], "line_no": [ 185, 187 ] }
static void FUNC_0(MpegEncContext * VAR_0, int VAR_1, int VAR_2) { int VAR_3; if(VAR_0->max_b_frames || VAR_0->quarter_sample){ VAR_3= 5; VAR_0->vo_type= ADV_SIMPLE_VO_TYPE; }else{ VAR_3= 1; VAR_0->vo_type= SIMPLE_VO_TYPE; } put_bits(&VAR_0->pb, 16, 0); put_bits(&VAR_0->pb, 16, 0x100 + VAR_1); put_bits(&VAR_0->pb, 16, 0); put_bits(&VAR_0->pb, 16, 0x120 + VAR_2); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 8, VAR_0->vo_type); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 4, VAR_3); put_bits(&VAR_0->pb, 3, 1); aspect_to_info(VAR_0, VAR_0->avctx->sample_aspect_ratio); put_bits(&VAR_0->pb, 4, VAR_0->aspect_ratio_info); if (VAR_0->aspect_ratio_info == FF_ASPECT_EXTENDED){ put_bits(&VAR_0->pb, 8, VAR_0->avctx->sample_aspect_ratio.num); put_bits(&VAR_0->pb, 8, VAR_0->avctx->sample_aspect_ratio.den); } if(VAR_0->low_delay){ put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 2, 1); put_bits(&VAR_0->pb, 1, VAR_0->low_delay); put_bits(&VAR_0->pb, 1, 0); }else{ put_bits(&VAR_0->pb, 1, 0); } put_bits(&VAR_0->pb, 2, RECT_SHAPE); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 16, VAR_0->time_increment_resolution); if (VAR_0->time_increment_bits < 1) VAR_0->time_increment_bits = 1; put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 13, VAR_0->width); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 13, VAR_0->height); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, VAR_0->progressive_sequence ? 0 : 1); put_bits(&VAR_0->pb, 1, 1); if (VAR_3 == 1) { put_bits(&VAR_0->pb, 1, VAR_0->vol_sprite_usage=0); }else{ put_bits(&VAR_0->pb, 2, VAR_0->vol_sprite_usage=0); } VAR_0->quant_precision=5; put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, VAR_0->mpeg_quant); if(VAR_0->mpeg_quant){ ff_write_quant_matrix(&VAR_0->pb, VAR_0->avctx->intra_matrix); ff_write_quant_matrix(&VAR_0->pb, VAR_0->avctx->inter_matrix); } if (VAR_3 != 1) put_bits(&VAR_0->pb, 1, VAR_0->quarter_sample); put_bits(&VAR_0->pb, 1, 1); VAR_0->resync_marker= VAR_0->rtp_mode; put_bits(&VAR_0->pb, 1, VAR_0->resync_marker ? 0 : 1); put_bits(&VAR_0->pb, 1, VAR_0->data_partitioning ? 1 : 0); if(VAR_0->data_partitioning){ put_bits(&VAR_0->pb, 1, 0); } if (VAR_3 != 1){ put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); } put_bits(&VAR_0->pb, 1, 0); ff_mpeg4_stuffing(&VAR_0->pb); if(!(VAR_0->flags & CODEC_FLAG_BITEXACT)){ put_bits(&VAR_0->pb, 16, 0); put_bits(&VAR_0->pb, 16, 0x1B2); put_string(&VAR_0->pb, LIBAVCODEC_IDENT); ff_mpeg4_stuffing(&VAR_0->pb); } }
[ "static void FUNC_0(MpegEncContext * VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3;", "if(VAR_0->max_b_frames || VAR_0->quarter_sample){", "VAR_3= 5;", "VAR_0->vo_type= ADV_SIMPLE_VO_TYPE;", "}else{", "VAR_3= 1;", "VAR_0->vo_type= SIMPLE_VO_TYPE;", "}", "put_bits(&VAR_0->pb, 16, 0);", "put_bits(&VAR_0->pb, 16, 0x100 + VAR_1);", "put_bits(&VAR_0->pb, 16, 0);", "put_bits(&VAR_0->pb, 16, 0x120 + VAR_2);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 8, VAR_0->vo_type);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 4, VAR_3);", "put_bits(&VAR_0->pb, 3, 1);", "aspect_to_info(VAR_0, VAR_0->avctx->sample_aspect_ratio);", "put_bits(&VAR_0->pb, 4, VAR_0->aspect_ratio_info);", "if (VAR_0->aspect_ratio_info == FF_ASPECT_EXTENDED){", "put_bits(&VAR_0->pb, 8, VAR_0->avctx->sample_aspect_ratio.num);", "put_bits(&VAR_0->pb, 8, VAR_0->avctx->sample_aspect_ratio.den);", "}", "if(VAR_0->low_delay){", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 2, 1);", "put_bits(&VAR_0->pb, 1, VAR_0->low_delay);", "put_bits(&VAR_0->pb, 1, 0);", "}else{", "put_bits(&VAR_0->pb, 1, 0);", "}", "put_bits(&VAR_0->pb, 2, RECT_SHAPE);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 16, VAR_0->time_increment_resolution);", "if (VAR_0->time_increment_bits < 1)\nVAR_0->time_increment_bits = 1;", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 13, VAR_0->width);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 13, VAR_0->height);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, VAR_0->progressive_sequence ? 0 : 1);", "put_bits(&VAR_0->pb, 1, 1);", "if (VAR_3 == 1) {", "put_bits(&VAR_0->pb, 1, VAR_0->vol_sprite_usage=0);", "}else{", "put_bits(&VAR_0->pb, 2, VAR_0->vol_sprite_usage=0);", "}", "VAR_0->quant_precision=5;", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, VAR_0->mpeg_quant);", "if(VAR_0->mpeg_quant){", "ff_write_quant_matrix(&VAR_0->pb, VAR_0->avctx->intra_matrix);", "ff_write_quant_matrix(&VAR_0->pb, VAR_0->avctx->inter_matrix);", "}", "if (VAR_3 != 1)\nput_bits(&VAR_0->pb, 1, VAR_0->quarter_sample);", "put_bits(&VAR_0->pb, 1, 1);", "VAR_0->resync_marker= VAR_0->rtp_mode;", "put_bits(&VAR_0->pb, 1, VAR_0->resync_marker ? 0 : 1);", "put_bits(&VAR_0->pb, 1, VAR_0->data_partitioning ? 1 : 0);", "if(VAR_0->data_partitioning){", "put_bits(&VAR_0->pb, 1, 0);", "}", "if (VAR_3 != 1){", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "}", "put_bits(&VAR_0->pb, 1, 0);", "ff_mpeg4_stuffing(&VAR_0->pb);", "if(!(VAR_0->flags & CODEC_FLAG_BITEXACT)){", "put_bits(&VAR_0->pb, 16, 0);", "put_bits(&VAR_0->pb, 16, 0x1B2);", "put_string(&VAR_0->pb, LIBAVCODEC_IDENT);", "ff_mpeg4_stuffing(&VAR_0->pb);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ] ]
11,035
static void ide_atapi_cmd_read_pio(IDEState *s, int lba, int nb_sectors, int sector_size) { s->lba = lba; s->packet_transfer_size = nb_sectors * sector_size; s->elementary_transfer_size = 0; s->io_buffer_index = sector_size; s->cd_sector_size = sector_size; s->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(s); }
true
qemu
5f81724d80a1492c73d329242663962139db739b
static void ide_atapi_cmd_read_pio(IDEState *s, int lba, int nb_sectors, int sector_size) { s->lba = lba; s->packet_transfer_size = nb_sectors * sector_size; s->elementary_transfer_size = 0; s->io_buffer_index = sector_size; s->cd_sector_size = sector_size; s->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(s); }
{ "code": [ " s->status = READY_STAT | SEEK_STAT;" ], "line_no": [ 19 ] }
static void FUNC_0(IDEState *VAR_0, int VAR_1, int VAR_2, int VAR_3) { VAR_0->VAR_1 = VAR_1; VAR_0->packet_transfer_size = VAR_2 * VAR_3; VAR_0->elementary_transfer_size = 0; VAR_0->io_buffer_index = VAR_3; VAR_0->cd_sector_size = VAR_3; VAR_0->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(VAR_0); }
[ "static void FUNC_0(IDEState *VAR_0, int VAR_1, int VAR_2,\nint VAR_3)\n{", "VAR_0->VAR_1 = VAR_1;", "VAR_0->packet_transfer_size = VAR_2 * VAR_3;", "VAR_0->elementary_transfer_size = 0;", "VAR_0->io_buffer_index = VAR_3;", "VAR_0->cd_sector_size = VAR_3;", "VAR_0->status = READY_STAT | SEEK_STAT;", "ide_atapi_cmd_reply_end(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
11,036
static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign) { dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE)); dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) << 1)); return dst + 2; }
true
FFmpeg
26227d91865ddfbfe35c9ff84853cc469e1c7daf
static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign) { dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE)); dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) << 1)); return dst + 2; }
{ "code": [ " dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) << 1));" ], "line_no": [ 7 ] }
static inline int *FUNC_0(int *VAR_0, unsigned VAR_1, unsigned VAR_2) { VAR_0[0] = (VAR_1 & 15) * (1 - (VAR_2 & 0xFFFFFFFE)); VAR_0[1] = (VAR_1 >> 4 & 15) * (1 - ((VAR_2 & 1) << 1)); return VAR_0 + 2; }
[ "static inline int *FUNC_0(int *VAR_0, unsigned VAR_1, unsigned VAR_2)\n{", "VAR_0[0] = (VAR_1 & 15) * (1 - (VAR_2 & 0xFFFFFFFE));", "VAR_0[1] = (VAR_1 >> 4 & 15) * (1 - ((VAR_2 & 1) << 1));", "return VAR_0 + 2;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ] ]
11,037
static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]+1; tc[1] = tc0_table[index_a][bS[1]]+1; tc[2] = tc0_table[index_a][bS[2]]+1; tc[3] = tc0_table[index_a][bS[3]]+1; h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); } }
false
FFmpeg
a625e13208ad0ebf1554aa73c9bf41452520f176
static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]+1; tc[1] = tc0_table[index_a][bS[1]]+1; tc[2] = tc0_table[index_a][bS[2]]+1; tc[3] = tc0_table[index_a][bS[3]]+1; h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); } }
{ "code": [], "line_no": [] }
static void VAR_0 filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; const int alpha = alpha_table[index_a]; const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0]]+1; tc[1] = tc0_table[index_a][bS[1]]+1; tc[2] = tc0_table[index_a][bS[2]]+1; tc[3] = tc0_table[index_a][bS[3]]+1; h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); } }
[ "static void VAR_0 filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {", "const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);", "const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;", "const int alpha = alpha_table[index_a];", "const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset];", "if (alpha ==0 || beta == 0) return;", "if( bS[0] < 4 ) {", "int8_t tc[4];", "tc[0] = tc0_table[index_a][bS[0]]+1;", "tc[1] = tc0_table[index_a][bS[1]]+1;", "tc[2] = tc0_table[index_a][bS[2]]+1;", "tc[3] = tc0_table[index_a][bS[3]]+1;", "h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc);", "} else {", "h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
11,038
static void usbredir_configuration_status(void *priv, uint32_t id, struct usb_redir_configuration_status_header *config_status) { USBRedirDevice *dev = priv; AsyncURB *aurb; int len = 0; DPRINTF("set config status %d config %d id %u\n", config_status->status, config_status->configuration, id); aurb = async_find(dev, id); if (!aurb) { return; } if (aurb->packet) { if (aurb->get) { dev->dev.data_buf[0] = config_status->configuration; len = 1; } aurb->packet->len = usbredir_handle_status(dev, config_status->status, len); usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static void usbredir_configuration_status(void *priv, uint32_t id, struct usb_redir_configuration_status_header *config_status) { USBRedirDevice *dev = priv; AsyncURB *aurb; int len = 0; DPRINTF("set config status %d config %d id %u\n", config_status->status, config_status->configuration, id); aurb = async_find(dev, id); if (!aurb) { return; } if (aurb->packet) { if (aurb->get) { dev->dev.data_buf[0] = config_status->configuration; len = 1; } aurb->packet->len = usbredir_handle_status(dev, config_status->status, len); usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); }
{ "code": [ " aurb->packet->len =", " aurb->packet->len =" ], "line_no": [ 39, 39 ] }
static void FUNC_0(void *VAR_0, uint32_t VAR_1, struct usb_redir_configuration_status_header *VAR_2) { USBRedirDevice *dev = VAR_0; AsyncURB *aurb; int VAR_3 = 0; DPRINTF("set config status %d config %d VAR_1 %u\n", VAR_2->status, VAR_2->configuration, VAR_1); aurb = async_find(dev, VAR_1); if (!aurb) { return; } if (aurb->packet) { if (aurb->get) { dev->dev.data_buf[0] = VAR_2->configuration; VAR_3 = 1; } aurb->packet->VAR_3 = usbredir_handle_status(dev, VAR_2->status, VAR_3); usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); }
[ "static void FUNC_0(void *VAR_0, uint32_t VAR_1,\nstruct usb_redir_configuration_status_header *VAR_2)\n{", "USBRedirDevice *dev = VAR_0;", "AsyncURB *aurb;", "int VAR_3 = 0;", "DPRINTF(\"set config status %d config %d VAR_1 %u\\n\", VAR_2->status,\nVAR_2->configuration, VAR_1);", "aurb = async_find(dev, VAR_1);", "if (!aurb) {", "return;", "}", "if (aurb->packet) {", "if (aurb->get) {", "dev->dev.data_buf[0] = VAR_2->configuration;", "VAR_3 = 1;", "}", "aurb->packet->VAR_3 =\nusbredir_handle_status(dev, VAR_2->status, VAR_3);", "usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);", "}", "async_free(dev, aurb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
11,039
static void gen_smul_dual(TCGv a, TCGv b) { TCGv tmp1 = new_tmp(); TCGv tmp2 = new_tmp(); tcg_gen_ext16s_i32(tmp1, a); tcg_gen_ext16s_i32(tmp2, b); tcg_gen_mul_i32(tmp1, tmp1, tmp2); dead_tmp(tmp2); tcg_gen_sari_i32(a, a, 16); tcg_gen_sari_i32(b, b, 16); tcg_gen_mul_i32(b, b, a); tcg_gen_mov_i32(a, tmp1); dead_tmp(tmp1); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static void gen_smul_dual(TCGv a, TCGv b) { TCGv tmp1 = new_tmp(); TCGv tmp2 = new_tmp(); tcg_gen_ext16s_i32(tmp1, a); tcg_gen_ext16s_i32(tmp2, b); tcg_gen_mul_i32(tmp1, tmp1, tmp2); dead_tmp(tmp2); tcg_gen_sari_i32(a, a, 16); tcg_gen_sari_i32(b, b, 16); tcg_gen_mul_i32(b, b, a); tcg_gen_mov_i32(a, tmp1); dead_tmp(tmp1); }
{ "code": [ " TCGv tmp1 = new_tmp();", " TCGv tmp2 = new_tmp();", " dead_tmp(tmp2);", " dead_tmp(tmp1);", " dead_tmp(tmp2);" ], "line_no": [ 5, 7, 15, 25, 15 ] }
static void FUNC_0(TCGv VAR_0, TCGv VAR_1) { TCGv tmp1 = new_tmp(); TCGv tmp2 = new_tmp(); tcg_gen_ext16s_i32(tmp1, VAR_0); tcg_gen_ext16s_i32(tmp2, VAR_1); tcg_gen_mul_i32(tmp1, tmp1, tmp2); dead_tmp(tmp2); tcg_gen_sari_i32(VAR_0, VAR_0, 16); tcg_gen_sari_i32(VAR_1, VAR_1, 16); tcg_gen_mul_i32(VAR_1, VAR_1, VAR_0); tcg_gen_mov_i32(VAR_0, tmp1); dead_tmp(tmp1); }
[ "static void FUNC_0(TCGv VAR_0, TCGv VAR_1)\n{", "TCGv tmp1 = new_tmp();", "TCGv tmp2 = new_tmp();", "tcg_gen_ext16s_i32(tmp1, VAR_0);", "tcg_gen_ext16s_i32(tmp2, VAR_1);", "tcg_gen_mul_i32(tmp1, tmp1, tmp2);", "dead_tmp(tmp2);", "tcg_gen_sari_i32(VAR_0, VAR_0, 16);", "tcg_gen_sari_i32(VAR_1, VAR_1, 16);", "tcg_gen_mul_i32(VAR_1, VAR_1, VAR_0);", "tcg_gen_mov_i32(VAR_0, tmp1);", "dead_tmp(tmp1);", "}" ]
[ 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
11,040
static int ac3_parse_bsi(AC3DecodeContext *ctx) { ac3_bsi *bsi = &ctx->bsi; uint32_t *flags = &bsi->flags; GetBitContext *gb = &ctx->gb; *flags = 0; bsi->cmixlev = 0; bsi->surmixlev = 0; bsi->dsurmod = 0; bsi->bsid = get_bits(gb, 5); if (bsi->bsid > 0x08) return -1; bsi->bsmod = get_bits(gb, 3); bsi->acmod = get_bits(gb, 3); if (bsi->acmod & 0x01 && bsi->acmod != 0x01) bsi->cmixlev = get_bits(gb, 2); if (bsi->acmod & 0x04) bsi->surmixlev = get_bits(gb, 2); if (bsi->acmod == 0x02) bsi->dsurmod = get_bits(gb, 2); if (get_bits(gb, 1)) *flags |= AC3_BSI_LFEON; bsi->dialnorm = get_bits(gb, 5); if (get_bits(gb, 1)) { *flags |= AC3_BSI_COMPRE; bsi->compr = get_bits(gb, 5); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_LANGCODE; bsi->langcod = get_bits(gb, 8); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_AUDPRODIE; bsi->mixlevel = get_bits(gb, 5); bsi->roomtyp = get_bits(gb, 2); } if (bsi->acmod == 0x00) { bsi->dialnorm2 = get_bits(gb, 5); if (get_bits(gb, 1)) { *flags |= AC3_BSI_COMPR2E; bsi->compr2 = get_bits(gb, 5); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_LANGCOD2E; bsi->langcod2 = get_bits(gb, 8); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_AUDPRODIE; bsi->mixlevel2 = get_bits(gb, 5); bsi->roomtyp2 = get_bits(gb, 2); } } if (get_bits(gb, 1)) *flags |= AC3_BSI_COPYRIGHTB; if (get_bits(gb, 1)) *flags |= AC3_BSI_ORIGBS; if (get_bits(gb, 1)) { *flags |= AC3_BSI_TIMECOD1E; bsi->timecod1 = get_bits(gb, 14); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_TIMECOD2E; bsi->timecod2 = get_bits(gb, 14); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_ADDBSIE; bsi->addbsil = get_bits(gb, 6); do { get_bits(gb, 8); } while (bsi->addbsil--); } bsi->nfchans = nfchans_tbl[bsi->acmod]; return 0; }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static int ac3_parse_bsi(AC3DecodeContext *ctx) { ac3_bsi *bsi = &ctx->bsi; uint32_t *flags = &bsi->flags; GetBitContext *gb = &ctx->gb; *flags = 0; bsi->cmixlev = 0; bsi->surmixlev = 0; bsi->dsurmod = 0; bsi->bsid = get_bits(gb, 5); if (bsi->bsid > 0x08) return -1; bsi->bsmod = get_bits(gb, 3); bsi->acmod = get_bits(gb, 3); if (bsi->acmod & 0x01 && bsi->acmod != 0x01) bsi->cmixlev = get_bits(gb, 2); if (bsi->acmod & 0x04) bsi->surmixlev = get_bits(gb, 2); if (bsi->acmod == 0x02) bsi->dsurmod = get_bits(gb, 2); if (get_bits(gb, 1)) *flags |= AC3_BSI_LFEON; bsi->dialnorm = get_bits(gb, 5); if (get_bits(gb, 1)) { *flags |= AC3_BSI_COMPRE; bsi->compr = get_bits(gb, 5); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_LANGCODE; bsi->langcod = get_bits(gb, 8); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_AUDPRODIE; bsi->mixlevel = get_bits(gb, 5); bsi->roomtyp = get_bits(gb, 2); } if (bsi->acmod == 0x00) { bsi->dialnorm2 = get_bits(gb, 5); if (get_bits(gb, 1)) { *flags |= AC3_BSI_COMPR2E; bsi->compr2 = get_bits(gb, 5); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_LANGCOD2E; bsi->langcod2 = get_bits(gb, 8); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_AUDPRODIE; bsi->mixlevel2 = get_bits(gb, 5); bsi->roomtyp2 = get_bits(gb, 2); } } if (get_bits(gb, 1)) *flags |= AC3_BSI_COPYRIGHTB; if (get_bits(gb, 1)) *flags |= AC3_BSI_ORIGBS; if (get_bits(gb, 1)) { *flags |= AC3_BSI_TIMECOD1E; bsi->timecod1 = get_bits(gb, 14); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_TIMECOD2E; bsi->timecod2 = get_bits(gb, 14); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_ADDBSIE; bsi->addbsil = get_bits(gb, 6); do { get_bits(gb, 8); } while (bsi->addbsil--); } bsi->nfchans = nfchans_tbl[bsi->acmod]; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AC3DecodeContext *VAR_0) { ac3_bsi *bsi = &VAR_0->bsi; uint32_t *flags = &bsi->flags; GetBitContext *gb = &VAR_0->gb; *flags = 0; bsi->cmixlev = 0; bsi->surmixlev = 0; bsi->dsurmod = 0; bsi->bsid = get_bits(gb, 5); if (bsi->bsid > 0x08) return -1; bsi->bsmod = get_bits(gb, 3); bsi->acmod = get_bits(gb, 3); if (bsi->acmod & 0x01 && bsi->acmod != 0x01) bsi->cmixlev = get_bits(gb, 2); if (bsi->acmod & 0x04) bsi->surmixlev = get_bits(gb, 2); if (bsi->acmod == 0x02) bsi->dsurmod = get_bits(gb, 2); if (get_bits(gb, 1)) *flags |= AC3_BSI_LFEON; bsi->dialnorm = get_bits(gb, 5); if (get_bits(gb, 1)) { *flags |= AC3_BSI_COMPRE; bsi->compr = get_bits(gb, 5); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_LANGCODE; bsi->langcod = get_bits(gb, 8); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_AUDPRODIE; bsi->mixlevel = get_bits(gb, 5); bsi->roomtyp = get_bits(gb, 2); } if (bsi->acmod == 0x00) { bsi->dialnorm2 = get_bits(gb, 5); if (get_bits(gb, 1)) { *flags |= AC3_BSI_COMPR2E; bsi->compr2 = get_bits(gb, 5); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_LANGCOD2E; bsi->langcod2 = get_bits(gb, 8); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_AUDPRODIE; bsi->mixlevel2 = get_bits(gb, 5); bsi->roomtyp2 = get_bits(gb, 2); } } if (get_bits(gb, 1)) *flags |= AC3_BSI_COPYRIGHTB; if (get_bits(gb, 1)) *flags |= AC3_BSI_ORIGBS; if (get_bits(gb, 1)) { *flags |= AC3_BSI_TIMECOD1E; bsi->timecod1 = get_bits(gb, 14); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_TIMECOD2E; bsi->timecod2 = get_bits(gb, 14); } if (get_bits(gb, 1)) { *flags |= AC3_BSI_ADDBSIE; bsi->addbsil = get_bits(gb, 6); do { get_bits(gb, 8); } while (bsi->addbsil--); } bsi->nfchans = nfchans_tbl[bsi->acmod]; return 0; }
[ "static int FUNC_0(AC3DecodeContext *VAR_0)\n{", "ac3_bsi *bsi = &VAR_0->bsi;", "uint32_t *flags = &bsi->flags;", "GetBitContext *gb = &VAR_0->gb;", "*flags = 0;", "bsi->cmixlev = 0;", "bsi->surmixlev = 0;", "bsi->dsurmod = 0;", "bsi->bsid = get_bits(gb, 5);", "if (bsi->bsid > 0x08)\nreturn -1;", "bsi->bsmod = get_bits(gb, 3);", "bsi->acmod = get_bits(gb, 3);", "if (bsi->acmod & 0x01 && bsi->acmod != 0x01)\nbsi->cmixlev = get_bits(gb, 2);", "if (bsi->acmod & 0x04)\nbsi->surmixlev = get_bits(gb, 2);", "if (bsi->acmod == 0x02)\nbsi->dsurmod = get_bits(gb, 2);", "if (get_bits(gb, 1))\n*flags |= AC3_BSI_LFEON;", "bsi->dialnorm = get_bits(gb, 5);", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_COMPRE;", "bsi->compr = get_bits(gb, 5);", "}", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_LANGCODE;", "bsi->langcod = get_bits(gb, 8);", "}", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_AUDPRODIE;", "bsi->mixlevel = get_bits(gb, 5);", "bsi->roomtyp = get_bits(gb, 2);", "}", "if (bsi->acmod == 0x00) {", "bsi->dialnorm2 = get_bits(gb, 5);", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_COMPR2E;", "bsi->compr2 = get_bits(gb, 5);", "}", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_LANGCOD2E;", "bsi->langcod2 = get_bits(gb, 8);", "}", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_AUDPRODIE;", "bsi->mixlevel2 = get_bits(gb, 5);", "bsi->roomtyp2 = get_bits(gb, 2);", "}", "}", "if (get_bits(gb, 1))\n*flags |= AC3_BSI_COPYRIGHTB;", "if (get_bits(gb, 1))\n*flags |= AC3_BSI_ORIGBS;", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_TIMECOD1E;", "bsi->timecod1 = get_bits(gb, 14);", "}", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_TIMECOD2E;", "bsi->timecod2 = get_bits(gb, 14);", "}", "if (get_bits(gb, 1)) {", "*flags |= AC3_BSI_ADDBSIE;", "bsi->addbsil = get_bits(gb, 6);", "do {", "get_bits(gb, 8);", "} while (bsi->addbsil--);", "}", "bsi->nfchans = nfchans_tbl[bsi->acmod];", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155 ] ]
11,041
int av_grab(AVFormatContext *s) { UINT8 audio_buf[AUDIO_FIFO_SIZE]; UINT8 audio_buf1[AUDIO_FIFO_SIZE]; UINT8 audio_out[AUDIO_FIFO_SIZE]; UINT8 video_buffer[1024*1024]; char buf[256]; short *samples; URLContext *audio_handle = NULL, *video_handle = NULL; int ret; AVCodecContext *enc, *first_video_enc = NULL; int frame_size, frame_bytes; int use_audio, use_video; int frame_rate, sample_rate, channels; int width, height, frame_number, i, pix_fmt = 0; AVOutputStream *ost_table[s->nb_streams], *ost; UINT8 *picture_in_buf = NULL, *picture_420p = NULL; int audio_fifo_size = 0, picture_size = 0; INT64 time_start; /* init output stream info */ for(i=0;i<s->nb_streams;i++) ost_table[i] = NULL; /* output stream init */ for(i=0;i<s->nb_streams;i++) { ost = av_mallocz(sizeof(AVOutputStream)); if (!ost) goto fail; ost->index = i; ost->st = s->streams[i]; ost_table[i] = ost; } use_audio = 0; use_video = 0; frame_rate = 0; sample_rate = 0; frame_size = 0; channels = 1; width = 0; height = 0; frame_number = 0; for(i=0;i<s->nb_streams;i++) { AVCodec *codec; ost = ost_table[i]; enc = &ost->st->codec; codec = avcodec_find_encoder(enc->codec_id); if (!codec) { fprintf(stderr, "Unknown codec\n"); return -1; } if (avcodec_open(enc, codec) < 0) { fprintf(stderr, "Incorrect encode parameters\n"); return -1; } switch(enc->codec_type) { case CODEC_TYPE_AUDIO: use_audio = 1; if (enc->sample_rate > sample_rate) sample_rate = enc->sample_rate; if (enc->frame_size > frame_size) frame_size = enc->frame_size; if (enc->channels > channels) channels = enc->channels; break; case CODEC_TYPE_VIDEO: if (!first_video_enc) first_video_enc = enc; use_video = 1; if (enc->frame_rate > frame_rate) frame_rate = enc->frame_rate; if (enc->width > width) width = enc->width; if (enc->height > height) height = enc->height; break; } } /* audio */ samples = NULL; if (use_audio) { snprintf(buf, sizeof(buf), "audio:%d,%d", sample_rate, channels); ret = url_open(&audio_handle, buf, URL_RDONLY); if (ret < 0) { fprintf(stderr, "Could not open audio device: disabling audio capture\n"); use_audio = 0; } else { URLFormat f; /* read back exact grab parameters */ if (url_getformat(audio_handle, &f) < 0) { fprintf(stderr, "could not read back video grab parameters\n"); goto fail; } sample_rate = f.sample_rate; channels = f.channels; audio_fifo_size = ((AUDIO_FIFO_SIZE / 2) / audio_handle->packet_size) * audio_handle->packet_size; fprintf(stderr, "Audio sampling: %d Hz, %s\n", sample_rate, channels == 2 ? "stereo" : "mono"); } } /* video */ if (use_video) { snprintf(buf, sizeof(buf), "video:%d,%d,%f", width, height, (float)frame_rate / FRAME_RATE_BASE); ret = url_open(&video_handle, buf, URL_RDONLY); if (ret < 0) { fprintf(stderr,"Could not init video 4 linux capture: disabling video capture\n"); use_video = 0; } else { URLFormat f; const char *pix_fmt_str; /* read back exact grab parameters */ if (url_getformat(video_handle, &f) < 0) { fprintf(stderr, "could not read back video grab parameters\n"); goto fail; } width = f.width; height = f.height; pix_fmt = f.pix_fmt; switch(pix_fmt) { case PIX_FMT_YUV420P: pix_fmt_str = "420P"; break; case PIX_FMT_YUV422: pix_fmt_str = "422"; break; case PIX_FMT_RGB24: pix_fmt_str = "RGB24"; break; case PIX_FMT_BGR24: pix_fmt_str = "BGR24"; break; default: pix_fmt_str = "???"; break; } picture_size = video_handle->packet_size; picture_in_buf = malloc(picture_size); if (!picture_in_buf) goto fail; /* allocate a temporary picture if not grabbing in 420P format */ if (pix_fmt != PIX_FMT_YUV420P) { picture_420p = malloc((width * height * 3) / 2); } fprintf(stderr, "Video sampling: %dx%d, %s format, %0.2f fps\n", width, height, pix_fmt_str, (float)frame_rate / FRAME_RATE_BASE); } } if (!use_video && !use_audio) { fprintf(stderr,"Could not open grab devices : exiting\n"); exit(1); } /* init built in conversion functions */ for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: ost->audio_resample = 0; if ((enc->channels != channels || enc->sample_rate != sample_rate)) { ost->audio_resample = 1; ost->resample = audio_resample_init(enc->channels, channels, enc->sample_rate, sample_rate); } if (fifo_init(&ost->fifo, (2 * audio_fifo_size * enc->sample_rate * enc->channels) / sample_rate)) goto fail; break; case CODEC_TYPE_VIDEO: ost->video_resample = 0; if (enc->width != width || enc->height != height) { UINT8 *buf; ost->video_resample = 1; buf = malloc((enc->width * enc->height * 3) / 2); if (!buf) goto fail; ost->pict_tmp.data[0] = buf; ost->pict_tmp.data[1] = buf + enc->width * height; ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (enc->width * height) / 4; ost->pict_tmp.linesize[0] = enc->width; ost->pict_tmp.linesize[1] = enc->width / 2; ost->pict_tmp.linesize[2] = enc->width / 2; ost->img_resample_ctx = img_resample_init( ost->st->codec.width, ost->st->codec.height, width, height); } } } fprintf(stderr, "Press [q] to stop encoding\n"); s->format->write_header(s); time_start = gettime(); term_init(); for(;;) { /* if 'q' pressed, exits */ if (read_key() == 'q') break; /* read & compress audio frames */ if (use_audio) { int ret, nb_samples, nb_samples_out; UINT8 *buftmp; for(;;) { ret = url_read(audio_handle, audio_buf, audio_fifo_size); if (ret <= 0) break; /* fill each codec fifo by doing the right sample rate conversion. This is not optimal because we do too much work, but it is easy to do */ nb_samples = ret / (channels * 2); for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { /* rate & stereo convertion */ if (!ost->audio_resample) { buftmp = audio_buf; nb_samples_out = nb_samples; } else { buftmp = audio_buf1; nb_samples_out = audio_resample(ost->resample, (short *)buftmp, (short *)audio_buf, nb_samples); } fifo_write(&ost->fifo, buftmp, nb_samples_out * enc->channels * 2, &ost->fifo.wptr); } } /* compress as many frame as possible with each audio codec */ for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { frame_bytes = enc->frame_size * 2 * enc->channels; while (fifo_read(&ost->fifo, audio_buf, frame_bytes, &ost->fifo.rptr) == 0) { ret = avcodec_encode_audio(enc, audio_out, sizeof(audio_out), (short *)audio_buf); s->format->write_packet(s, ost->index, audio_out, ret); } } } } } if (use_video) { AVPicture *picture1, *picture2, *picture; AVPicture picture_tmp0, picture_tmp1; ret = url_read(video_handle, picture_in_buf, picture_size); if (ret < 0) break; picture2 = &picture_tmp0; avpicture_fill(picture2, picture_in_buf, pix_fmt, width, height); if (pix_fmt != PIX_FMT_YUV420P) { picture = &picture_tmp1; avpicture_fill(picture, picture_420p, PIX_FMT_YUV420P, width, height); img_convert(picture, PIX_FMT_YUV420P, picture2, pix_fmt, width, height); } else { picture = picture2; } for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_VIDEO) { int n1, n2, nb; /* feed each codec with its requested frame rate */ n1 = ((INT64)frame_number * enc->frame_rate) / frame_rate; n2 = (((INT64)frame_number + 1) * enc->frame_rate) / frame_rate; nb = n2 - n1; if (nb > 0) { /* resize the picture if needed */ if (ost->video_resample) { picture1 = &ost->pict_tmp; img_resample(ost->img_resample_ctx, picture1, picture); } else { picture1 = picture; } ret = avcodec_encode_video(enc, video_buffer, sizeof(video_buffer), picture1); s->format->write_packet(s, ost->index, video_buffer, ret); } } } frame_number++; } /* write report */ { char buf[1024]; INT64 total_size; float ti, bitrate; static float last_ti; INT64 ti1; total_size = url_ftell(&s->pb); ti1 = gettime() - time_start; /* check elapsed time */ if (recording_time && ti1 >= recording_time) break; ti = ti1 / 1000000.0; if (ti < 0.1) ti = 0.1; /* dispaly twice per second */ if ((ti - last_ti) >= 0.5) { last_ti = ti; bitrate = (int)((total_size * 8) / ti / 1000.0); buf[0] = '\0'; if (use_video) { sprintf(buf + strlen(buf), "frame=%5d fps=%4.1f q=%2d ", frame_number, (float)frame_number / ti, first_video_enc->quality); } sprintf(buf + strlen(buf), "size=%8LdkB time=%0.1f bitrate=%6.1fkbits/s", total_size / 1024, ti, bitrate); fprintf(stderr, "%s \r", buf); fflush(stderr); } } } term_exit(); for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; avcodec_close(enc); } s->format->write_trailer(s); if (audio_handle) url_close(audio_handle); if (video_handle) url_close(video_handle); /* write report */ { float ti, bitrate; INT64 total_size; total_size = url_ftell(&s->pb); ti = (gettime() - time_start) / 1000000.0; if (ti < 0.1) ti = 0.1; bitrate = (int)((total_size * 8) / ti / 1000.0); fprintf(stderr, "\033[K\nTotal time = %0.1f s, %Ld KBytes, %0.1f kbits/s\n", ti, total_size / 1024, bitrate); if (use_video) { fprintf(stderr, "Total frames = %d\n", frame_number); } } ret = 0; fail1: if (picture_in_buf) free(picture_in_buf); if (picture_420p) free(picture_420p); for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; if (ost) { if (ost->fifo.buffer) fifo_free(&ost->fifo); if (ost->pict_tmp.data[0]) free(ost->pict_tmp.data[0]); if (ost->video_resample) img_resample_close(ost->img_resample_ctx); if (ost->audio_resample) audio_resample_close(ost->resample); free(ost); } } return ret; fail: ret = -ENOMEM; goto fail1; }
false
FFmpeg
a38469e1da7b4829a2fba4279d8420a33f96832e
int av_grab(AVFormatContext *s) { UINT8 audio_buf[AUDIO_FIFO_SIZE]; UINT8 audio_buf1[AUDIO_FIFO_SIZE]; UINT8 audio_out[AUDIO_FIFO_SIZE]; UINT8 video_buffer[1024*1024]; char buf[256]; short *samples; URLContext *audio_handle = NULL, *video_handle = NULL; int ret; AVCodecContext *enc, *first_video_enc = NULL; int frame_size, frame_bytes; int use_audio, use_video; int frame_rate, sample_rate, channels; int width, height, frame_number, i, pix_fmt = 0; AVOutputStream *ost_table[s->nb_streams], *ost; UINT8 *picture_in_buf = NULL, *picture_420p = NULL; int audio_fifo_size = 0, picture_size = 0; INT64 time_start; for(i=0;i<s->nb_streams;i++) ost_table[i] = NULL; for(i=0;i<s->nb_streams;i++) { ost = av_mallocz(sizeof(AVOutputStream)); if (!ost) goto fail; ost->index = i; ost->st = s->streams[i]; ost_table[i] = ost; } use_audio = 0; use_video = 0; frame_rate = 0; sample_rate = 0; frame_size = 0; channels = 1; width = 0; height = 0; frame_number = 0; for(i=0;i<s->nb_streams;i++) { AVCodec *codec; ost = ost_table[i]; enc = &ost->st->codec; codec = avcodec_find_encoder(enc->codec_id); if (!codec) { fprintf(stderr, "Unknown codec\n"); return -1; } if (avcodec_open(enc, codec) < 0) { fprintf(stderr, "Incorrect encode parameters\n"); return -1; } switch(enc->codec_type) { case CODEC_TYPE_AUDIO: use_audio = 1; if (enc->sample_rate > sample_rate) sample_rate = enc->sample_rate; if (enc->frame_size > frame_size) frame_size = enc->frame_size; if (enc->channels > channels) channels = enc->channels; break; case CODEC_TYPE_VIDEO: if (!first_video_enc) first_video_enc = enc; use_video = 1; if (enc->frame_rate > frame_rate) frame_rate = enc->frame_rate; if (enc->width > width) width = enc->width; if (enc->height > height) height = enc->height; break; } } samples = NULL; if (use_audio) { snprintf(buf, sizeof(buf), "audio:%d,%d", sample_rate, channels); ret = url_open(&audio_handle, buf, URL_RDONLY); if (ret < 0) { fprintf(stderr, "Could not open audio device: disabling audio capture\n"); use_audio = 0; } else { URLFormat f; if (url_getformat(audio_handle, &f) < 0) { fprintf(stderr, "could not read back video grab parameters\n"); goto fail; } sample_rate = f.sample_rate; channels = f.channels; audio_fifo_size = ((AUDIO_FIFO_SIZE / 2) / audio_handle->packet_size) * audio_handle->packet_size; fprintf(stderr, "Audio sampling: %d Hz, %s\n", sample_rate, channels == 2 ? "stereo" : "mono"); } } if (use_video) { snprintf(buf, sizeof(buf), "video:%d,%d,%f", width, height, (float)frame_rate / FRAME_RATE_BASE); ret = url_open(&video_handle, buf, URL_RDONLY); if (ret < 0) { fprintf(stderr,"Could not init video 4 linux capture: disabling video capture\n"); use_video = 0; } else { URLFormat f; const char *pix_fmt_str; if (url_getformat(video_handle, &f) < 0) { fprintf(stderr, "could not read back video grab parameters\n"); goto fail; } width = f.width; height = f.height; pix_fmt = f.pix_fmt; switch(pix_fmt) { case PIX_FMT_YUV420P: pix_fmt_str = "420P"; break; case PIX_FMT_YUV422: pix_fmt_str = "422"; break; case PIX_FMT_RGB24: pix_fmt_str = "RGB24"; break; case PIX_FMT_BGR24: pix_fmt_str = "BGR24"; break; default: pix_fmt_str = "???"; break; } picture_size = video_handle->packet_size; picture_in_buf = malloc(picture_size); if (!picture_in_buf) goto fail; if (pix_fmt != PIX_FMT_YUV420P) { picture_420p = malloc((width * height * 3) / 2); } fprintf(stderr, "Video sampling: %dx%d, %s format, %0.2f fps\n", width, height, pix_fmt_str, (float)frame_rate / FRAME_RATE_BASE); } } if (!use_video && !use_audio) { fprintf(stderr,"Could not open grab devices : exiting\n"); exit(1); } for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: ost->audio_resample = 0; if ((enc->channels != channels || enc->sample_rate != sample_rate)) { ost->audio_resample = 1; ost->resample = audio_resample_init(enc->channels, channels, enc->sample_rate, sample_rate); } if (fifo_init(&ost->fifo, (2 * audio_fifo_size * enc->sample_rate * enc->channels) / sample_rate)) goto fail; break; case CODEC_TYPE_VIDEO: ost->video_resample = 0; if (enc->width != width || enc->height != height) { UINT8 *buf; ost->video_resample = 1; buf = malloc((enc->width * enc->height * 3) / 2); if (!buf) goto fail; ost->pict_tmp.data[0] = buf; ost->pict_tmp.data[1] = buf + enc->width * height; ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (enc->width * height) / 4; ost->pict_tmp.linesize[0] = enc->width; ost->pict_tmp.linesize[1] = enc->width / 2; ost->pict_tmp.linesize[2] = enc->width / 2; ost->img_resample_ctx = img_resample_init( ost->st->codec.width, ost->st->codec.height, width, height); } } } fprintf(stderr, "Press [q] to stop encoding\n"); s->format->write_header(s); time_start = gettime(); term_init(); for(;;) { if (read_key() == 'q') break; if (use_audio) { int ret, nb_samples, nb_samples_out; UINT8 *buftmp; for(;;) { ret = url_read(audio_handle, audio_buf, audio_fifo_size); if (ret <= 0) break; nb_samples = ret / (channels * 2); for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { if (!ost->audio_resample) { buftmp = audio_buf; nb_samples_out = nb_samples; } else { buftmp = audio_buf1; nb_samples_out = audio_resample(ost->resample, (short *)buftmp, (short *)audio_buf, nb_samples); } fifo_write(&ost->fifo, buftmp, nb_samples_out * enc->channels * 2, &ost->fifo.wptr); } } for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { frame_bytes = enc->frame_size * 2 * enc->channels; while (fifo_read(&ost->fifo, audio_buf, frame_bytes, &ost->fifo.rptr) == 0) { ret = avcodec_encode_audio(enc, audio_out, sizeof(audio_out), (short *)audio_buf); s->format->write_packet(s, ost->index, audio_out, ret); } } } } } if (use_video) { AVPicture *picture1, *picture2, *picture; AVPicture picture_tmp0, picture_tmp1; ret = url_read(video_handle, picture_in_buf, picture_size); if (ret < 0) break; picture2 = &picture_tmp0; avpicture_fill(picture2, picture_in_buf, pix_fmt, width, height); if (pix_fmt != PIX_FMT_YUV420P) { picture = &picture_tmp1; avpicture_fill(picture, picture_420p, PIX_FMT_YUV420P, width, height); img_convert(picture, PIX_FMT_YUV420P, picture2, pix_fmt, width, height); } else { picture = picture2; } for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_VIDEO) { int n1, n2, nb; n1 = ((INT64)frame_number * enc->frame_rate) / frame_rate; n2 = (((INT64)frame_number + 1) * enc->frame_rate) / frame_rate; nb = n2 - n1; if (nb > 0) { if (ost->video_resample) { picture1 = &ost->pict_tmp; img_resample(ost->img_resample_ctx, picture1, picture); } else { picture1 = picture; } ret = avcodec_encode_video(enc, video_buffer, sizeof(video_buffer), picture1); s->format->write_packet(s, ost->index, video_buffer, ret); } } } frame_number++; } { char buf[1024]; INT64 total_size; float ti, bitrate; static float last_ti; INT64 ti1; total_size = url_ftell(&s->pb); ti1 = gettime() - time_start; if (recording_time && ti1 >= recording_time) break; ti = ti1 / 1000000.0; if (ti < 0.1) ti = 0.1; if ((ti - last_ti) >= 0.5) { last_ti = ti; bitrate = (int)((total_size * 8) / ti / 1000.0); buf[0] = '\0'; if (use_video) { sprintf(buf + strlen(buf), "frame=%5d fps=%4.1f q=%2d ", frame_number, (float)frame_number / ti, first_video_enc->quality); } sprintf(buf + strlen(buf), "size=%8LdkB time=%0.1f bitrate=%6.1fkbits/s", total_size / 1024, ti, bitrate); fprintf(stderr, "%s \r", buf); fflush(stderr); } } } term_exit(); for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; enc = &ost->st->codec; avcodec_close(enc); } s->format->write_trailer(s); if (audio_handle) url_close(audio_handle); if (video_handle) url_close(video_handle); { float ti, bitrate; INT64 total_size; total_size = url_ftell(&s->pb); ti = (gettime() - time_start) / 1000000.0; if (ti < 0.1) ti = 0.1; bitrate = (int)((total_size * 8) / ti / 1000.0); fprintf(stderr, "\033[K\nTotal time = %0.1f s, %Ld KBytes, %0.1f kbits/s\n", ti, total_size / 1024, bitrate); if (use_video) { fprintf(stderr, "Total frames = %d\n", frame_number); } } ret = 0; fail1: if (picture_in_buf) free(picture_in_buf); if (picture_420p) free(picture_420p); for(i=0;i<s->nb_streams;i++) { ost = ost_table[i]; if (ost) { if (ost->fifo.buffer) fifo_free(&ost->fifo); if (ost->pict_tmp.data[0]) free(ost->pict_tmp.data[0]); if (ost->video_resample) img_resample_close(ost->img_resample_ctx); if (ost->audio_resample) audio_resample_close(ost->resample); free(ost); } } return ret; fail: ret = -ENOMEM; goto fail1; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext *VAR_0) { UINT8 audio_buf[AUDIO_FIFO_SIZE]; UINT8 audio_buf1[AUDIO_FIFO_SIZE]; UINT8 audio_out[AUDIO_FIFO_SIZE]; UINT8 video_buffer[1024*1024]; char VAR_21[256]; short *VAR_2; URLContext *audio_handle = NULL, *video_handle = NULL; int VAR_19; AVCodecContext *enc, *first_video_enc = NULL; int VAR_4, VAR_5; int VAR_6, VAR_7; int VAR_8, VAR_9, VAR_10; int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15 = 0; AVOutputStream *ost_table[VAR_0->nb_streams], *ost; UINT8 *picture_in_buf = NULL, *picture_420p = NULL; int VAR_16 = 0, VAR_17 = 0; INT64 time_start; for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) ost_table[VAR_14] = NULL; for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = av_mallocz(sizeof(AVOutputStream)); if (!ost) goto fail; ost->index = VAR_14; ost->st = VAR_0->streams[VAR_14]; ost_table[VAR_14] = ost; } VAR_6 = 0; VAR_7 = 0; VAR_8 = 0; VAR_9 = 0; VAR_4 = 0; VAR_10 = 1; VAR_11 = 0; VAR_12 = 0; VAR_13 = 0; for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { AVCodec *codec; ost = ost_table[VAR_14]; enc = &ost->st->codec; codec = avcodec_find_encoder(enc->codec_id); if (!codec) { fprintf(stderr, "Unknown codec\n"); return -1; } if (avcodec_open(enc, codec) < 0) { fprintf(stderr, "Incorrect encode parameters\n"); return -1; } switch(enc->codec_type) { case CODEC_TYPE_AUDIO: VAR_6 = 1; if (enc->VAR_9 > VAR_9) VAR_9 = enc->VAR_9; if (enc->VAR_4 > VAR_4) VAR_4 = enc->VAR_4; if (enc->VAR_10 > VAR_10) VAR_10 = enc->VAR_10; break; case CODEC_TYPE_VIDEO: if (!first_video_enc) first_video_enc = enc; VAR_7 = 1; if (enc->VAR_8 > VAR_8) VAR_8 = enc->VAR_8; if (enc->VAR_11 > VAR_11) VAR_11 = enc->VAR_11; if (enc->VAR_12 > VAR_12) VAR_12 = enc->VAR_12; break; } } VAR_2 = NULL; if (VAR_6) { snprintf(VAR_21, sizeof(VAR_21), "audio:%d,%d", VAR_9, VAR_10); VAR_19 = url_open(&audio_handle, VAR_21, URL_RDONLY); if (VAR_19 < 0) { fprintf(stderr, "Could not open audio device: disabling audio capture\n"); VAR_6 = 0; } else { URLFormat f; if (url_getformat(audio_handle, &f) < 0) { fprintf(stderr, "could not read back video grab parameters\n"); goto fail; } VAR_9 = f.VAR_9; VAR_10 = f.VAR_10; VAR_16 = ((AUDIO_FIFO_SIZE / 2) / audio_handle->packet_size) * audio_handle->packet_size; fprintf(stderr, "Audio sampling: %d Hz, %VAR_0\n", VAR_9, VAR_10 == 2 ? "stereo" : "mono"); } } if (VAR_7) { snprintf(VAR_21, sizeof(VAR_21), "video:%d,%d,%f", VAR_11, VAR_12, (float)VAR_8 / FRAME_RATE_BASE); VAR_19 = url_open(&video_handle, VAR_21, URL_RDONLY); if (VAR_19 < 0) { fprintf(stderr,"Could not init video 4 linux capture: disabling video capture\n"); VAR_7 = 0; } else { URLFormat f; const char *VAR_18; if (url_getformat(video_handle, &f) < 0) { fprintf(stderr, "could not read back video grab parameters\n"); goto fail; } VAR_11 = f.VAR_11; VAR_12 = f.VAR_12; VAR_15 = f.VAR_15; switch(VAR_15) { case PIX_FMT_YUV420P: VAR_18 = "420P"; break; case PIX_FMT_YUV422: VAR_18 = "422"; break; case PIX_FMT_RGB24: VAR_18 = "RGB24"; break; case PIX_FMT_BGR24: VAR_18 = "BGR24"; break; default: VAR_18 = "???"; break; } VAR_17 = video_handle->packet_size; picture_in_buf = malloc(VAR_17); if (!picture_in_buf) goto fail; if (VAR_15 != PIX_FMT_YUV420P) { picture_420p = malloc((VAR_11 * VAR_12 * 3) / 2); } fprintf(stderr, "Video sampling: %dx%d, %VAR_0 format, %0.2f fps\n", VAR_11, VAR_12, VAR_18, (float)VAR_8 / FRAME_RATE_BASE); } } if (!VAR_7 && !VAR_6) { fprintf(stderr,"Could not open grab devices : exiting\n"); exit(1); } for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = ost_table[VAR_14]; enc = &ost->st->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: ost->audio_resample = 0; if ((enc->VAR_10 != VAR_10 || enc->VAR_9 != VAR_9)) { ost->audio_resample = 1; ost->resample = audio_resample_init(enc->VAR_10, VAR_10, enc->VAR_9, VAR_9); } if (fifo_init(&ost->fifo, (2 * VAR_16 * enc->VAR_9 * enc->VAR_10) / VAR_9)) goto fail; break; case CODEC_TYPE_VIDEO: ost->video_resample = 0; if (enc->VAR_11 != VAR_11 || enc->VAR_12 != VAR_12) { UINT8 *VAR_21; ost->video_resample = 1; VAR_21 = malloc((enc->VAR_11 * enc->VAR_12 * 3) / 2); if (!VAR_21) goto fail; ost->pict_tmp.data[0] = VAR_21; ost->pict_tmp.data[1] = VAR_21 + enc->VAR_11 * VAR_12; ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (enc->VAR_11 * VAR_12) / 4; ost->pict_tmp.linesize[0] = enc->VAR_11; ost->pict_tmp.linesize[1] = enc->VAR_11 / 2; ost->pict_tmp.linesize[2] = enc->VAR_11 / 2; ost->img_resample_ctx = img_resample_init( ost->st->codec.VAR_11, ost->st->codec.VAR_12, VAR_11, VAR_12); } } } fprintf(stderr, "Press [q] to stop encoding\n"); VAR_0->format->write_header(VAR_0); time_start = gettime(); term_init(); for(;;) { if (read_key() == 'q') break; if (VAR_6) { int VAR_19, VAR_19, VAR_20; UINT8 *buftmp; for(;;) { VAR_19 = url_read(audio_handle, audio_buf, VAR_16); if (VAR_19 <= 0) break; VAR_19 = VAR_19 / (VAR_10 * 2); for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = ost_table[VAR_14]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { if (!ost->audio_resample) { buftmp = audio_buf; VAR_20 = VAR_19; } else { buftmp = audio_buf1; VAR_20 = audio_resample(ost->resample, (short *)buftmp, (short *)audio_buf, VAR_19); } fifo_write(&ost->fifo, buftmp, VAR_20 * enc->VAR_10 * 2, &ost->fifo.wptr); } } for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = ost_table[VAR_14]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { VAR_5 = enc->VAR_4 * 2 * enc->VAR_10; while (fifo_read(&ost->fifo, audio_buf, VAR_5, &ost->fifo.rptr) == 0) { VAR_19 = avcodec_encode_audio(enc, audio_out, sizeof(audio_out), (short *)audio_buf); VAR_0->format->write_packet(VAR_0, ost->index, audio_out, VAR_19); } } } } } if (VAR_7) { AVPicture *picture1, *picture2, *picture; AVPicture picture_tmp0, picture_tmp1; VAR_19 = url_read(video_handle, picture_in_buf, VAR_17); if (VAR_19 < 0) break; picture2 = &picture_tmp0; avpicture_fill(picture2, picture_in_buf, VAR_15, VAR_11, VAR_12); if (VAR_15 != PIX_FMT_YUV420P) { picture = &picture_tmp1; avpicture_fill(picture, picture_420p, PIX_FMT_YUV420P, VAR_11, VAR_12); img_convert(picture, PIX_FMT_YUV420P, picture2, VAR_15, VAR_11, VAR_12); } else { picture = picture2; } for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = ost_table[VAR_14]; enc = &ost->st->codec; if (enc->codec_type == CODEC_TYPE_VIDEO) { int n1, n2, nb; n1 = ((INT64)VAR_13 * enc->VAR_8) / VAR_8; n2 = (((INT64)VAR_13 + 1) * enc->VAR_8) / VAR_8; nb = n2 - n1; if (nb > 0) { if (ost->video_resample) { picture1 = &ost->pict_tmp; img_resample(ost->img_resample_ctx, picture1, picture); } else { picture1 = picture; } VAR_19 = avcodec_encode_video(enc, video_buffer, sizeof(video_buffer), picture1); VAR_0->format->write_packet(VAR_0, ost->index, video_buffer, VAR_19); } } } VAR_13++; } { char VAR_21[1024]; INT64 total_size; float VAR_24, VAR_24; static float VAR_23; INT64 ti1; total_size = url_ftell(&VAR_0->pb); ti1 = gettime() - time_start; if (recording_time && ti1 >= recording_time) break; VAR_24 = ti1 / 1000000.0; if (VAR_24 < 0.1) VAR_24 = 0.1; if ((VAR_24 - VAR_23) >= 0.5) { VAR_23 = VAR_24; VAR_24 = (int)((total_size * 8) / VAR_24 / 1000.0); VAR_21[0] = '\0'; if (VAR_7) { sprintf(VAR_21 + strlen(VAR_21), "frame=%5d fps=%4.1f q=%2d ", VAR_13, (float)VAR_13 / VAR_24, first_video_enc->quality); } sprintf(VAR_21 + strlen(VAR_21), "size=%8LdkB time=%0.1f VAR_24=%6.1fkbits/VAR_0", total_size / 1024, VAR_24, VAR_24); fprintf(stderr, "%VAR_0 \r", VAR_21); fflush(stderr); } } } term_exit(); for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = ost_table[VAR_14]; enc = &ost->st->codec; avcodec_close(enc); } VAR_0->format->write_trailer(VAR_0); if (audio_handle) url_close(audio_handle); if (video_handle) url_close(video_handle); { float VAR_24, VAR_24; INT64 total_size; total_size = url_ftell(&VAR_0->pb); VAR_24 = (gettime() - time_start) / 1000000.0; if (VAR_24 < 0.1) VAR_24 = 0.1; VAR_24 = (int)((total_size * 8) / VAR_24 / 1000.0); fprintf(stderr, "\033[K\nTotal time = %0.1f VAR_0, %Ld KBytes, %0.1f kbits/VAR_0\n", VAR_24, total_size / 1024, VAR_24); if (VAR_7) { fprintf(stderr, "Total frames = %d\n", VAR_13); } } VAR_19 = 0; fail1: if (picture_in_buf) free(picture_in_buf); if (picture_420p) free(picture_420p); for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) { ost = ost_table[VAR_14]; if (ost) { if (ost->fifo.buffer) fifo_free(&ost->fifo); if (ost->pict_tmp.data[0]) free(ost->pict_tmp.data[0]); if (ost->video_resample) img_resample_close(ost->img_resample_ctx); if (ost->audio_resample) audio_resample_close(ost->resample); free(ost); } } return VAR_19; fail: VAR_19 = -ENOMEM; goto fail1; }
[ "int FUNC_0(AVFormatContext *VAR_0)\n{", "UINT8 audio_buf[AUDIO_FIFO_SIZE];", "UINT8 audio_buf1[AUDIO_FIFO_SIZE];", "UINT8 audio_out[AUDIO_FIFO_SIZE];", "UINT8 video_buffer[1024*1024];", "char VAR_21[256];", "short *VAR_2;", "URLContext *audio_handle = NULL, *video_handle = NULL;", "int VAR_19;", "AVCodecContext *enc, *first_video_enc = NULL;", "int VAR_4, VAR_5;", "int VAR_6, VAR_7;", "int VAR_8, VAR_9, VAR_10;", "int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15 = 0;", "AVOutputStream *ost_table[VAR_0->nb_streams], *ost;", "UINT8 *picture_in_buf = NULL, *picture_420p = NULL;", "int VAR_16 = 0, VAR_17 = 0;", "INT64 time_start;", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++)", "ost_table[VAR_14] = NULL;", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = av_mallocz(sizeof(AVOutputStream));", "if (!ost)\ngoto fail;", "ost->index = VAR_14;", "ost->st = VAR_0->streams[VAR_14];", "ost_table[VAR_14] = ost;", "}", "VAR_6 = 0;", "VAR_7 = 0;", "VAR_8 = 0;", "VAR_9 = 0;", "VAR_4 = 0;", "VAR_10 = 1;", "VAR_11 = 0;", "VAR_12 = 0;", "VAR_13 = 0;", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "AVCodec *codec;", "ost = ost_table[VAR_14];", "enc = &ost->st->codec;", "codec = avcodec_find_encoder(enc->codec_id);", "if (!codec) {", "fprintf(stderr, \"Unknown codec\\n\");", "return -1;", "}", "if (avcodec_open(enc, codec) < 0) {", "fprintf(stderr, \"Incorrect encode parameters\\n\");", "return -1;", "}", "switch(enc->codec_type) {", "case CODEC_TYPE_AUDIO:\nVAR_6 = 1;", "if (enc->VAR_9 > VAR_9)\nVAR_9 = enc->VAR_9;", "if (enc->VAR_4 > VAR_4)\nVAR_4 = enc->VAR_4;", "if (enc->VAR_10 > VAR_10)\nVAR_10 = enc->VAR_10;", "break;", "case CODEC_TYPE_VIDEO:\nif (!first_video_enc)\nfirst_video_enc = enc;", "VAR_7 = 1;", "if (enc->VAR_8 > VAR_8)\nVAR_8 = enc->VAR_8;", "if (enc->VAR_11 > VAR_11)\nVAR_11 = enc->VAR_11;", "if (enc->VAR_12 > VAR_12)\nVAR_12 = enc->VAR_12;", "break;", "}", "}", "VAR_2 = NULL;", "if (VAR_6) {", "snprintf(VAR_21, sizeof(VAR_21), \"audio:%d,%d\", VAR_9, VAR_10);", "VAR_19 = url_open(&audio_handle, VAR_21, URL_RDONLY);", "if (VAR_19 < 0) {", "fprintf(stderr, \"Could not open audio device: disabling audio capture\\n\");", "VAR_6 = 0;", "} else {", "URLFormat f;", "if (url_getformat(audio_handle, &f) < 0) {", "fprintf(stderr, \"could not read back video grab parameters\\n\");", "goto fail;", "}", "VAR_9 = f.VAR_9;", "VAR_10 = f.VAR_10;", "VAR_16 = ((AUDIO_FIFO_SIZE / 2) / audio_handle->packet_size) *\naudio_handle->packet_size;", "fprintf(stderr, \"Audio sampling: %d Hz, %VAR_0\\n\",\nVAR_9, VAR_10 == 2 ? \"stereo\" : \"mono\");", "}", "}", "if (VAR_7) {", "snprintf(VAR_21, sizeof(VAR_21), \"video:%d,%d,%f\",\nVAR_11, VAR_12, (float)VAR_8 / FRAME_RATE_BASE);", "VAR_19 = url_open(&video_handle, VAR_21, URL_RDONLY);", "if (VAR_19 < 0) {", "fprintf(stderr,\"Could not init video 4 linux capture: disabling video capture\\n\");", "VAR_7 = 0;", "} else {", "URLFormat f;", "const char *VAR_18;", "if (url_getformat(video_handle, &f) < 0) {", "fprintf(stderr, \"could not read back video grab parameters\\n\");", "goto fail;", "}", "VAR_11 = f.VAR_11;", "VAR_12 = f.VAR_12;", "VAR_15 = f.VAR_15;", "switch(VAR_15) {", "case PIX_FMT_YUV420P:\nVAR_18 = \"420P\";", "break;", "case PIX_FMT_YUV422:\nVAR_18 = \"422\";", "break;", "case PIX_FMT_RGB24:\nVAR_18 = \"RGB24\";", "break;", "case PIX_FMT_BGR24:\nVAR_18 = \"BGR24\";", "break;", "default:\nVAR_18 = \"???\";", "break;", "}", "VAR_17 = video_handle->packet_size;", "picture_in_buf = malloc(VAR_17);", "if (!picture_in_buf)\ngoto fail;", "if (VAR_15 != PIX_FMT_YUV420P) {", "picture_420p = malloc((VAR_11 * VAR_12 * 3) / 2);", "}", "fprintf(stderr, \"Video sampling: %dx%d, %VAR_0 format, %0.2f fps\\n\",\nVAR_11, VAR_12, VAR_18, (float)VAR_8 / FRAME_RATE_BASE);", "}", "}", "if (!VAR_7 && !VAR_6) {", "fprintf(stderr,\"Could not open grab devices : exiting\\n\");", "exit(1);", "}", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = ost_table[VAR_14];", "enc = &ost->st->codec;", "switch(enc->codec_type) {", "case CODEC_TYPE_AUDIO:\nost->audio_resample = 0;", "if ((enc->VAR_10 != VAR_10 ||\nenc->VAR_9 != VAR_9)) {", "ost->audio_resample = 1;", "ost->resample = audio_resample_init(enc->VAR_10, VAR_10,\nenc->VAR_9, VAR_9);", "}", "if (fifo_init(&ost->fifo, (2 * VAR_16 * enc->VAR_9 *\nenc->VAR_10) / VAR_9))\ngoto fail;", "break;", "case CODEC_TYPE_VIDEO:\nost->video_resample = 0;", "if (enc->VAR_11 != VAR_11 ||\nenc->VAR_12 != VAR_12) {", "UINT8 *VAR_21;", "ost->video_resample = 1;", "VAR_21 = malloc((enc->VAR_11 * enc->VAR_12 * 3) / 2);", "if (!VAR_21)\ngoto fail;", "ost->pict_tmp.data[0] = VAR_21;", "ost->pict_tmp.data[1] = VAR_21 + enc->VAR_11 * VAR_12;", "ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (enc->VAR_11 * VAR_12) / 4;", "ost->pict_tmp.linesize[0] = enc->VAR_11;", "ost->pict_tmp.linesize[1] = enc->VAR_11 / 2;", "ost->pict_tmp.linesize[2] = enc->VAR_11 / 2;", "ost->img_resample_ctx = img_resample_init(\nost->st->codec.VAR_11, ost->st->codec.VAR_12,\nVAR_11, VAR_12);", "}", "}", "}", "fprintf(stderr, \"Press [q] to stop encoding\\n\");", "VAR_0->format->write_header(VAR_0);", "time_start = gettime();", "term_init();", "for(;;) {", "if (read_key() == 'q')\nbreak;", "if (VAR_6) {", "int VAR_19, VAR_19, VAR_20;", "UINT8 *buftmp;", "for(;;) {", "VAR_19 = url_read(audio_handle, audio_buf, VAR_16);", "if (VAR_19 <= 0)\nbreak;", "VAR_19 = VAR_19 / (VAR_10 * 2);", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = ost_table[VAR_14];", "enc = &ost->st->codec;", "if (enc->codec_type == CODEC_TYPE_AUDIO) {", "if (!ost->audio_resample) {", "buftmp = audio_buf;", "VAR_20 = VAR_19;", "} else {", "buftmp = audio_buf1;", "VAR_20 = audio_resample(ost->resample,\n(short *)buftmp, (short *)audio_buf,\nVAR_19);", "}", "fifo_write(&ost->fifo, buftmp, VAR_20 * enc->VAR_10 * 2,\n&ost->fifo.wptr);", "}", "}", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = ost_table[VAR_14];", "enc = &ost->st->codec;", "if (enc->codec_type == CODEC_TYPE_AUDIO) {", "VAR_5 = enc->VAR_4 * 2 * enc->VAR_10;", "while (fifo_read(&ost->fifo, audio_buf,\nVAR_5, &ost->fifo.rptr) == 0) {", "VAR_19 = avcodec_encode_audio(enc,\naudio_out, sizeof(audio_out),\n(short *)audio_buf);", "VAR_0->format->write_packet(VAR_0, ost->index, audio_out, VAR_19);", "}", "}", "}", "}", "}", "if (VAR_7) {", "AVPicture *picture1, *picture2, *picture;", "AVPicture picture_tmp0, picture_tmp1;", "VAR_19 = url_read(video_handle, picture_in_buf, VAR_17);", "if (VAR_19 < 0)\nbreak;", "picture2 = &picture_tmp0;", "avpicture_fill(picture2, picture_in_buf, VAR_15, VAR_11, VAR_12);", "if (VAR_15 != PIX_FMT_YUV420P) {", "picture = &picture_tmp1;", "avpicture_fill(picture, picture_420p,\nPIX_FMT_YUV420P, VAR_11, VAR_12);", "img_convert(picture, PIX_FMT_YUV420P,\npicture2, VAR_15,\nVAR_11, VAR_12);", "} else {", "picture = picture2;", "}", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = ost_table[VAR_14];", "enc = &ost->st->codec;", "if (enc->codec_type == CODEC_TYPE_VIDEO) {", "int n1, n2, nb;", "n1 = ((INT64)VAR_13 * enc->VAR_8) / VAR_8;", "n2 = (((INT64)VAR_13 + 1) * enc->VAR_8) / VAR_8;", "nb = n2 - n1;", "if (nb > 0) {", "if (ost->video_resample) {", "picture1 = &ost->pict_tmp;", "img_resample(ost->img_resample_ctx,\npicture1, picture);", "} else {", "picture1 = picture;", "}", "VAR_19 = avcodec_encode_video(enc, video_buffer,\nsizeof(video_buffer),\npicture1);", "VAR_0->format->write_packet(VAR_0, ost->index, video_buffer, VAR_19);", "}", "}", "}", "VAR_13++;", "}", "{", "char VAR_21[1024];", "INT64 total_size;", "float VAR_24, VAR_24;", "static float VAR_23;", "INT64 ti1;", "total_size = url_ftell(&VAR_0->pb);", "ti1 = gettime() - time_start;", "if (recording_time && ti1 >= recording_time)\nbreak;", "VAR_24 = ti1 / 1000000.0;", "if (VAR_24 < 0.1)\nVAR_24 = 0.1;", "if ((VAR_24 - VAR_23) >= 0.5) {", "VAR_23 = VAR_24;", "VAR_24 = (int)((total_size * 8) / VAR_24 / 1000.0);", "VAR_21[0] = '\\0';", "if (VAR_7) {", "sprintf(VAR_21 + strlen(VAR_21), \"frame=%5d fps=%4.1f q=%2d \",\nVAR_13, (float)VAR_13 / VAR_24, first_video_enc->quality);", "}", "sprintf(VAR_21 + strlen(VAR_21), \"size=%8LdkB time=%0.1f VAR_24=%6.1fkbits/VAR_0\",\ntotal_size / 1024, VAR_24, VAR_24);", "fprintf(stderr, \"%VAR_0 \\r\", VAR_21);", "fflush(stderr);", "}", "}", "}", "term_exit();", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = ost_table[VAR_14];", "enc = &ost->st->codec;", "avcodec_close(enc);", "}", "VAR_0->format->write_trailer(VAR_0);", "if (audio_handle)\nurl_close(audio_handle);", "if (video_handle)\nurl_close(video_handle);", "{", "float VAR_24, VAR_24;", "INT64 total_size;", "total_size = url_ftell(&VAR_0->pb);", "VAR_24 = (gettime() - time_start) / 1000000.0;", "if (VAR_24 < 0.1)\nVAR_24 = 0.1;", "VAR_24 = (int)((total_size * 8) / VAR_24 / 1000.0);", "fprintf(stderr, \"\\033[K\\nTotal time = %0.1f VAR_0, %Ld KBytes, %0.1f kbits/VAR_0\\n\",\nVAR_24, total_size / 1024, VAR_24);", "if (VAR_7) {", "fprintf(stderr, \"Total frames = %d\\n\", VAR_13);", "}", "}", "VAR_19 = 0;", "fail1:\nif (picture_in_buf)\nfree(picture_in_buf);", "if (picture_420p)\nfree(picture_420p);", "for(VAR_14=0;VAR_14<VAR_0->nb_streams;VAR_14++) {", "ost = ost_table[VAR_14];", "if (ost) {", "if (ost->fifo.buffer)\nfifo_free(&ost->fifo);", "if (ost->pict_tmp.data[0])\nfree(ost->pict_tmp.data[0]);", "if (ost->video_resample)\nimg_resample_close(ost->img_resample_ctx);", "if (ost->audio_resample)\naudio_resample_close(ost->resample);", "free(ost);", "}", "}", "return VAR_19;", "fail:\nVAR_19 = -ENOMEM;", "goto fail1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127, 129 ], [ 131, 133 ], [ 135 ], [ 137, 139, 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 215 ], [ 217, 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273, 275 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337, 339 ], [ 341 ], [ 343, 345 ], [ 347 ], [ 349, 351, 353 ], [ 355 ], [ 357, 359 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387, 389, 391 ], [ 393 ], [ 395 ], [ 397 ], [ 401 ], [ 405 ], [ 407 ], [ 409 ], [ 413 ], [ 417, 419 ], [ 425 ], [ 427 ], [ 429 ], [ 433 ], [ 435 ], [ 437, 439 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469, 471, 473 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 501, 503 ], [ 505, 507, 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 527 ], [ 529 ], [ 533 ], [ 535, 537 ], [ 541 ], [ 543 ], [ 547 ], [ 549 ], [ 551, 553 ], [ 555, 557, 559 ], [ 561 ], [ 563 ], [ 565 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 593 ], [ 595 ], [ 597, 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607, 609, 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 643 ], [ 645 ], [ 649, 651 ], [ 655 ], [ 657, 659 ], [ 663 ], [ 665 ], [ 667 ], [ 671 ], [ 673 ], [ 675, 677 ], [ 679 ], [ 683, 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 715, 717 ], [ 721, 723 ], [ 729 ], [ 731 ], [ 733 ], [ 737 ], [ 741 ], [ 743, 745 ], [ 747 ], [ 751, 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 765 ], [ 767, 769, 771 ], [ 773, 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783, 785 ], [ 787, 789 ], [ 791, 793 ], [ 795, 797 ], [ 799 ], [ 801 ], [ 803 ], [ 805 ], [ 807, 809 ], [ 811 ], [ 813 ] ]
11,042
static int64_t nfs_client_open(NFSClient *client, QDict *options, int flags, Error **errp, int open_flags) { int ret = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat st; char *file = NULL, *strp = NULL; opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { ret = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } strp = strrchr(client->path, '/'); if (strp == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } file = g_strdup(strp); *strp = 0; /* Pop the config into our state object, Exit if invalid */ client->server = nfs_config(options, errp); if (!client->server) { ret = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "uid")) { client->uid = qemu_opt_get_number(opts, "uid", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "gid")) { client->gid = qemu_opt_get_number(opts, "gid", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syncnt")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syncnt", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { error_report("NFS Warning: Truncating NFS readahead " "size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "pagecache")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "pagecache", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { error_report("NFS Warning: Truncating NFS pagecache " "size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); /* limit the maximum debug level to avoid potential flooding * of our log files. */ if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { error_report("NFS Warning: Limiting NFS debug level " "to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif ret = nfs_mount(client->context, client->server->host, client->path); if (ret < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { ret = nfs_creat(client->context, file, 0600, &client->fh); if (ret < 0) { error_setg(errp, "Failed to create file: %s", nfs_get_error(client->context)); goto fail; } } else { ret = nfs_open(client->context, file, flags, &client->fh); if (ret < 0) { error_setg(errp, "Failed to open file : %s", nfs_get_error(client->context)); goto fail; } } ret = nfs_fstat(client->context, client->fh, &st); if (ret < 0) { error_setg(errp, "Failed to fstat file: %s", nfs_get_error(client->context)); goto fail; } ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); client->st_blocks = st.st_blocks; client->has_zero_init = S_ISREG(st.st_mode); *strp = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(file); return ret; }
true
qemu
f67409a5bb43ebe74401fa8e187267eb0f139293
static int64_t nfs_client_open(NFSClient *client, QDict *options, int flags, Error **errp, int open_flags) { int ret = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat st; char *file = NULL, *strp = NULL; opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { ret = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } strp = strrchr(client->path, '/'); if (strp == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } file = g_strdup(strp); *strp = 0; client->server = nfs_config(options, errp); if (!client->server) { ret = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "uid")) { client->uid = qemu_opt_get_number(opts, "uid", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "gid")) { client->gid = qemu_opt_get_number(opts, "gid", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syncnt")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syncnt", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { error_report("NFS Warning: Truncating NFS readahead " "size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "pagecache")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "pagecache", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { error_report("NFS Warning: Truncating NFS pagecache " "size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { error_report("NFS Warning: Limiting NFS debug level " "to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif ret = nfs_mount(client->context, client->server->host, client->path); if (ret < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { ret = nfs_creat(client->context, file, 0600, &client->fh); if (ret < 0) { error_setg(errp, "Failed to create file: %s", nfs_get_error(client->context)); goto fail; } } else { ret = nfs_open(client->context, file, flags, &client->fh); if (ret < 0) { error_setg(errp, "Failed to open file : %s", nfs_get_error(client->context)); goto fail; } } ret = nfs_fstat(client->context, client->fh, &st); if (ret < 0) { error_setg(errp, "Failed to fstat file: %s", nfs_get_error(client->context)); goto fail; } ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); client->st_blocks = st.st_blocks; client->has_zero_init = S_ISREG(st.st_mode); *strp = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(file); return ret; }
{ "code": [ " if (qemu_opt_get(opts, \"uid\")) {", " client->uid = qemu_opt_get_number(opts, \"uid\", 0);", " if (qemu_opt_get(opts, \"gid\")) {", " client->gid = qemu_opt_get_number(opts, \"gid\", 0);", " if (qemu_opt_get(opts, \"tcp-syncnt\")) {", " client->tcp_syncnt = qemu_opt_get_number(opts, \"tcp-syncnt\", 0);", " if (qemu_opt_get(opts, \"readahead\")) {", " client->readahead = qemu_opt_get_number(opts, \"readahead\", 0);", " if (qemu_opt_get(opts, \"pagecache\")) {", " client->pagecache = qemu_opt_get_number(opts, \"pagecache\", 0);" ], "line_no": [ 91, 93, 101, 103, 111, 113, 123, 135, 165, 177 ] }
static int64_t FUNC_0(NFSClient *client, QDict *options, int flags, Error **errp, int open_flags) { int VAR_0 = -EINVAL; QemuOpts *opts = NULL; Error *local_err = NULL; struct stat VAR_1; char *VAR_2 = NULL, *VAR_3 = NULL; opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); VAR_0 = -EINVAL; goto fail; } client->path = g_strdup(qemu_opt_get(opts, "path")); if (!client->path) { VAR_0 = -EINVAL; error_setg(errp, "No path was specified"); goto fail; } VAR_3 = strrchr(client->path, '/'); if (VAR_3 == NULL) { error_setg(errp, "Invalid URL specified"); goto fail; } VAR_2 = g_strdup(VAR_3); *VAR_3 = 0; client->server = nfs_config(options, errp); if (!client->server) { VAR_0 = -EINVAL; goto fail; } client->context = nfs_init_context(); if (client->context == NULL) { error_setg(errp, "Failed to init NFS context"); goto fail; } if (qemu_opt_get(opts, "uid")) { client->uid = qemu_opt_get_number(opts, "uid", 0); nfs_set_uid(client->context, client->uid); } if (qemu_opt_get(opts, "gid")) { client->gid = qemu_opt_get_number(opts, "gid", 0); nfs_set_gid(client->context, client->gid); } if (qemu_opt_get(opts, "tcp-syncnt")) { client->tcp_syncnt = qemu_opt_get_number(opts, "tcp-syncnt", 0); nfs_set_tcp_syncnt(client->context, client->tcp_syncnt); } #ifdef LIBNFS_FEATURE_READAHEAD if (qemu_opt_get(opts, "readahead")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS readahead " "if cache.direct = on"); goto fail; } client->readahead = qemu_opt_get_number(opts, "readahead", 0); if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) { error_report("NFS Warning: Truncating NFS readahead " "size to %d", QEMU_NFS_MAX_READAHEAD_SIZE); client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE; } nfs_set_readahead(client->context, client->readahead); #ifdef LIBNFS_FEATURE_PAGECACHE nfs_set_pagecache_ttl(client->context, 0); #endif client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_PAGECACHE if (qemu_opt_get(opts, "pagecache")) { if (open_flags & BDRV_O_NOCACHE) { error_setg(errp, "Cannot enable NFS pagecache " "if cache.direct = on"); goto fail; } client->pagecache = qemu_opt_get_number(opts, "pagecache", 0); if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) { error_report("NFS Warning: Truncating NFS pagecache " "size to %d pages", QEMU_NFS_MAX_PAGECACHE_SIZE); client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE; } nfs_set_pagecache(client->context, client->pagecache); nfs_set_pagecache_ttl(client->context, 0); client->cache_used = true; } #endif #ifdef LIBNFS_FEATURE_DEBUG if (qemu_opt_get(opts, "debug")) { client->debug = qemu_opt_get_number(opts, "debug", 0); if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) { error_report("NFS Warning: Limiting NFS debug level " "to %d", QEMU_NFS_MAX_DEBUG_LEVEL); client->debug = QEMU_NFS_MAX_DEBUG_LEVEL; } nfs_set_debug(client->context, client->debug); } #endif VAR_0 = nfs_mount(client->context, client->server->host, client->path); if (VAR_0 < 0) { error_setg(errp, "Failed to mount nfs share: %s", nfs_get_error(client->context)); goto fail; } if (flags & O_CREAT) { VAR_0 = nfs_creat(client->context, VAR_2, 0600, &client->fh); if (VAR_0 < 0) { error_setg(errp, "Failed to create VAR_2: %s", nfs_get_error(client->context)); goto fail; } } else { VAR_0 = nfs_open(client->context, VAR_2, flags, &client->fh); if (VAR_0 < 0) { error_setg(errp, "Failed to open VAR_2 : %s", nfs_get_error(client->context)); goto fail; } } VAR_0 = nfs_fstat(client->context, client->fh, &VAR_1); if (VAR_0 < 0) { error_setg(errp, "Failed to fstat VAR_2: %s", nfs_get_error(client->context)); goto fail; } VAR_0 = DIV_ROUND_UP(VAR_1.st_size, BDRV_SECTOR_SIZE); client->st_blocks = VAR_1.st_blocks; client->has_zero_init = S_ISREG(VAR_1.st_mode); *VAR_3 = '/'; goto out; fail: nfs_client_close(client); out: qemu_opts_del(opts); g_free(VAR_2); return VAR_0; }
[ "static int64_t FUNC_0(NFSClient *client, QDict *options,\nint flags, Error **errp, int open_flags)\n{", "int VAR_0 = -EINVAL;", "QemuOpts *opts = NULL;", "Error *local_err = NULL;", "struct stat VAR_1;", "char *VAR_2 = NULL, *VAR_3 = NULL;", "opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, options, &local_err);", "if (local_err) {", "error_propagate(errp, local_err);", "VAR_0 = -EINVAL;", "goto fail;", "}", "client->path = g_strdup(qemu_opt_get(opts, \"path\"));", "if (!client->path) {", "VAR_0 = -EINVAL;", "error_setg(errp, \"No path was specified\");", "goto fail;", "}", "VAR_3 = strrchr(client->path, '/');", "if (VAR_3 == NULL) {", "error_setg(errp, \"Invalid URL specified\");", "goto fail;", "}", "VAR_2 = g_strdup(VAR_3);", "*VAR_3 = 0;", "client->server = nfs_config(options, errp);", "if (!client->server) {", "VAR_0 = -EINVAL;", "goto fail;", "}", "client->context = nfs_init_context();", "if (client->context == NULL) {", "error_setg(errp, \"Failed to init NFS context\");", "goto fail;", "}", "if (qemu_opt_get(opts, \"uid\")) {", "client->uid = qemu_opt_get_number(opts, \"uid\", 0);", "nfs_set_uid(client->context, client->uid);", "}", "if (qemu_opt_get(opts, \"gid\")) {", "client->gid = qemu_opt_get_number(opts, \"gid\", 0);", "nfs_set_gid(client->context, client->gid);", "}", "if (qemu_opt_get(opts, \"tcp-syncnt\")) {", "client->tcp_syncnt = qemu_opt_get_number(opts, \"tcp-syncnt\", 0);", "nfs_set_tcp_syncnt(client->context, client->tcp_syncnt);", "}", "#ifdef LIBNFS_FEATURE_READAHEAD\nif (qemu_opt_get(opts, \"readahead\")) {", "if (open_flags & BDRV_O_NOCACHE) {", "error_setg(errp, \"Cannot enable NFS readahead \"\n\"if cache.direct = on\");", "goto fail;", "}", "client->readahead = qemu_opt_get_number(opts, \"readahead\", 0);", "if (client->readahead > QEMU_NFS_MAX_READAHEAD_SIZE) {", "error_report(\"NFS Warning: Truncating NFS readahead \"\n\"size to %d\", QEMU_NFS_MAX_READAHEAD_SIZE);", "client->readahead = QEMU_NFS_MAX_READAHEAD_SIZE;", "}", "nfs_set_readahead(client->context, client->readahead);", "#ifdef LIBNFS_FEATURE_PAGECACHE\nnfs_set_pagecache_ttl(client->context, 0);", "#endif\nclient->cache_used = true;", "}", "#endif\n#ifdef LIBNFS_FEATURE_PAGECACHE\nif (qemu_opt_get(opts, \"pagecache\")) {", "if (open_flags & BDRV_O_NOCACHE) {", "error_setg(errp, \"Cannot enable NFS pagecache \"\n\"if cache.direct = on\");", "goto fail;", "}", "client->pagecache = qemu_opt_get_number(opts, \"pagecache\", 0);", "if (client->pagecache > QEMU_NFS_MAX_PAGECACHE_SIZE) {", "error_report(\"NFS Warning: Truncating NFS pagecache \"\n\"size to %d pages\", QEMU_NFS_MAX_PAGECACHE_SIZE);", "client->pagecache = QEMU_NFS_MAX_PAGECACHE_SIZE;", "}", "nfs_set_pagecache(client->context, client->pagecache);", "nfs_set_pagecache_ttl(client->context, 0);", "client->cache_used = true;", "}", "#endif\n#ifdef LIBNFS_FEATURE_DEBUG\nif (qemu_opt_get(opts, \"debug\")) {", "client->debug = qemu_opt_get_number(opts, \"debug\", 0);", "if (client->debug > QEMU_NFS_MAX_DEBUG_LEVEL) {", "error_report(\"NFS Warning: Limiting NFS debug level \"\n\"to %d\", QEMU_NFS_MAX_DEBUG_LEVEL);", "client->debug = QEMU_NFS_MAX_DEBUG_LEVEL;", "}", "nfs_set_debug(client->context, client->debug);", "}", "#endif\nVAR_0 = nfs_mount(client->context, client->server->host, client->path);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to mount nfs share: %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "if (flags & O_CREAT) {", "VAR_0 = nfs_creat(client->context, VAR_2, 0600, &client->fh);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to create VAR_2: %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "} else {", "VAR_0 = nfs_open(client->context, VAR_2, flags, &client->fh);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to open VAR_2 : %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "}", "VAR_0 = nfs_fstat(client->context, client->fh, &VAR_1);", "if (VAR_0 < 0) {", "error_setg(errp, \"Failed to fstat VAR_2: %s\",\nnfs_get_error(client->context));", "goto fail;", "}", "VAR_0 = DIV_ROUND_UP(VAR_1.st_size, BDRV_SECTOR_SIZE);", "client->st_blocks = VAR_1.st_blocks;", "client->has_zero_init = S_ISREG(VAR_1.st_mode);", "*VAR_3 = '/';", "goto out;", "fail:\nnfs_client_close(client);", "out:\nqemu_opts_del(opts);", "g_free(VAR_2);", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 159, 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 201, 203 ], [ 205 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 301, 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 313 ] ]
11,043
void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, IVITile *tile, int32_t mv_scale) { int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type; int offs, mb_offset, row_offset; IVIMbInfo *mb, *ref_mb; const int16_t *src; int16_t *dst; void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); offs = tile->ypos * band->pitch + tile->xpos; mb = tile->mbs; ref_mb = tile->ref_mbs; row_offset = band->mb_size * band->pitch; need_mc = 0; /* reset the mc tracking flag */ for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; mb->type = 1; /* set the macroblocks type = INTER */ mb->cbp = 0; /* all blocks are empty */ if (!band->qdelta_present && !band->plane && !band->band_num) { mb->q_delta = band->glob_quant; mb->mv_x = 0; mb->mv_y = 0; } if (band->inherit_qdelta && ref_mb) mb->q_delta = ref_mb->q_delta; if (band->inherit_mv) { /* motion vector inheritance */ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } need_mc |= mb->mv_x || mb->mv_y; /* tracking non-zero motion vectors */ } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } // for x offs += row_offset; } // for y if (band->inherit_mv && need_mc) { /* apply motion compensation if there is at least one non-zero motion vector */ num_blocks = (band->mb_size != band->blk_size) ? 4 : 1; /* number of blocks per mb */ mc_no_delta_func = (band->blk_size == 8) ? ff_ivi_mc_8x8_no_delta : ff_ivi_mc_4x4_no_delta; for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) { mv_x = mb->mv_x; mv_y = mb->mv_y; if (!band->is_halfpel) { mc_type = 0; /* we have only fullpel vectors */ } else { mc_type = ((mv_y & 1) << 1) | (mv_x & 1); mv_x >>= 1; mv_y >>= 1; /* convert halfpel vectors into fullpel ones */ } for (blk = 0; blk < num_blocks; blk++) { /* adjust block position in the buffer according with its number */ offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch); mc_no_delta_func(band->buf + offs, band->ref_buf + offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } } } else { /* copy data from the reference tile into the current one */ src = band->ref_buf + tile->ypos * band->pitch + tile->xpos; dst = band->buf + tile->ypos * band->pitch + tile->xpos; for (y = 0; y < tile->height; y++) { memcpy(dst, src, tile->width*sizeof(band->buf[0])); src += band->pitch; dst += band->pitch; } } }
true
FFmpeg
4b35ee0b7c0c4cbac3541a25a5e8c00b657c8f95
void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, IVITile *tile, int32_t mv_scale) { int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type; int offs, mb_offset, row_offset; IVIMbInfo *mb, *ref_mb; const int16_t *src; int16_t *dst; void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); offs = tile->ypos * band->pitch + tile->xpos; mb = tile->mbs; ref_mb = tile->ref_mbs; row_offset = band->mb_size * band->pitch; need_mc = 0; for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; mb->type = 1; mb->cbp = 0; if (!band->qdelta_present && !band->plane && !band->band_num) { mb->q_delta = band->glob_quant; mb->mv_x = 0; mb->mv_y = 0; } if (band->inherit_qdelta && ref_mb) mb->q_delta = ref_mb->q_delta; if (band->inherit_mv) { if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } need_mc |= mb->mv_x || mb->mv_y; } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } if (band->inherit_mv && need_mc) { num_blocks = (band->mb_size != band->blk_size) ? 4 : 1; mc_no_delta_func = (band->blk_size == 8) ? ff_ivi_mc_8x8_no_delta : ff_ivi_mc_4x4_no_delta; for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) { mv_x = mb->mv_x; mv_y = mb->mv_y; if (!band->is_halfpel) { mc_type = 0; } else { mc_type = ((mv_y & 1) << 1) | (mv_x & 1); mv_x >>= 1; mv_y >>= 1; } for (blk = 0; blk < num_blocks; blk++) { offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch); mc_no_delta_func(band->buf + offs, band->ref_buf + offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } } } else { src = band->ref_buf + tile->ypos * band->pitch + tile->xpos; dst = band->buf + tile->ypos * band->pitch + tile->xpos; for (y = 0; y < tile->height; y++) { memcpy(dst, src, tile->width*sizeof(band->buf[0])); src += band->pitch; dst += band->pitch; } } }
{ "code": [ " if (band->inherit_mv) {" ], "line_no": [ 75 ] }
void FUNC_0(AVCodecContext *VAR_0, IVIBandDesc *VAR_1, IVITile *VAR_2, int32_t VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_21; int VAR_13, VAR_14, VAR_15; IVIMbInfo *mb, *ref_mb; const int16_t *VAR_16; int16_t *dst; void (*VAR_17)(int16_t *VAR_18, const int16_t *VAR_19, uint32_t VAR_20, int VAR_21); VAR_13 = VAR_2->ypos * VAR_1->VAR_20 + VAR_2->xpos; mb = VAR_2->mbs; ref_mb = VAR_2->ref_mbs; VAR_15 = VAR_1->mb_size * VAR_1->VAR_20; VAR_6 = 0; for (VAR_5 = VAR_2->ypos; VAR_5 < (VAR_2->ypos + VAR_2->height); VAR_5 += VAR_1->mb_size) { VAR_14 = VAR_13; for (VAR_4 = VAR_2->xpos; VAR_4 < (VAR_2->xpos + VAR_2->width); VAR_4 += VAR_1->mb_size) { mb->xpos = VAR_4; mb->ypos = VAR_5; mb->buf_offs = VAR_14; mb->type = 1; mb->cbp = 0; if (!VAR_1->qdelta_present && !VAR_1->plane && !VAR_1->band_num) { mb->q_delta = VAR_1->glob_quant; mb->VAR_10 = 0; mb->VAR_11 = 0; } if (VAR_1->inherit_qdelta && ref_mb) mb->q_delta = ref_mb->q_delta; if (VAR_1->inherit_mv) { if (VAR_3) { mb->VAR_10 = ivi_scale_mv(ref_mb->VAR_10, VAR_3); mb->VAR_11 = ivi_scale_mv(ref_mb->VAR_11, VAR_3); } else { mb->VAR_10 = ref_mb->VAR_10; mb->VAR_11 = ref_mb->VAR_11; } VAR_6 |= mb->VAR_10 || mb->VAR_11; } mb++; if (ref_mb) ref_mb++; VAR_14 += VAR_1->mb_size; } VAR_13 += VAR_15; } if (VAR_1->inherit_mv && VAR_6) { VAR_9 = (VAR_1->mb_size != VAR_1->blk_size) ? 4 : 1; VAR_17 = (VAR_1->blk_size == 8) ? ff_ivi_mc_8x8_no_delta : ff_ivi_mc_4x4_no_delta; for (VAR_7 = 0, mb = VAR_2->mbs; VAR_7 < VAR_2->num_MBs; mb++, VAR_7++) { VAR_10 = mb->VAR_10; VAR_11 = mb->VAR_11; if (!VAR_1->is_halfpel) { VAR_21 = 0; } else { VAR_21 = ((VAR_11 & 1) << 1) | (VAR_10 & 1); VAR_10 >>= 1; VAR_11 >>= 1; } for (VAR_8 = 0; VAR_8 < VAR_9; VAR_8++) { VAR_13 = mb->buf_offs + VAR_1->blk_size * ((VAR_8 & 1) + !!(VAR_8 & 2) * VAR_1->VAR_20); VAR_17(VAR_1->VAR_18 + VAR_13, VAR_1->VAR_19 + VAR_13 + VAR_11 * VAR_1->VAR_20 + VAR_10, VAR_1->VAR_20, VAR_21); } } } else { VAR_16 = VAR_1->VAR_19 + VAR_2->ypos * VAR_1->VAR_20 + VAR_2->xpos; dst = VAR_1->VAR_18 + VAR_2->ypos * VAR_1->VAR_20 + VAR_2->xpos; for (VAR_5 = 0; VAR_5 < VAR_2->height; VAR_5++) { memcpy(dst, VAR_16, VAR_2->width*sizeof(VAR_1->VAR_18[0])); VAR_16 += VAR_1->VAR_20; dst += VAR_1->VAR_20; } } }
[ "void FUNC_0(AVCodecContext *VAR_0, IVIBandDesc *VAR_1,\nIVITile *VAR_2, int32_t VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_21;", "int VAR_13, VAR_14, VAR_15;", "IVIMbInfo *mb, *ref_mb;", "const int16_t *VAR_16;", "int16_t *dst;", "void (*VAR_17)(int16_t *VAR_18, const int16_t *VAR_19, uint32_t VAR_20,\nint VAR_21);", "VAR_13 = VAR_2->ypos * VAR_1->VAR_20 + VAR_2->xpos;", "mb = VAR_2->mbs;", "ref_mb = VAR_2->ref_mbs;", "VAR_15 = VAR_1->mb_size * VAR_1->VAR_20;", "VAR_6 = 0;", "for (VAR_5 = VAR_2->ypos; VAR_5 < (VAR_2->ypos + VAR_2->height); VAR_5 += VAR_1->mb_size) {", "VAR_14 = VAR_13;", "for (VAR_4 = VAR_2->xpos; VAR_4 < (VAR_2->xpos + VAR_2->width); VAR_4 += VAR_1->mb_size) {", "mb->xpos = VAR_4;", "mb->ypos = VAR_5;", "mb->buf_offs = VAR_14;", "mb->type = 1;", "mb->cbp = 0;", "if (!VAR_1->qdelta_present && !VAR_1->plane && !VAR_1->band_num) {", "mb->q_delta = VAR_1->glob_quant;", "mb->VAR_10 = 0;", "mb->VAR_11 = 0;", "}", "if (VAR_1->inherit_qdelta && ref_mb)\nmb->q_delta = ref_mb->q_delta;", "if (VAR_1->inherit_mv) {", "if (VAR_3) {", "mb->VAR_10 = ivi_scale_mv(ref_mb->VAR_10, VAR_3);", "mb->VAR_11 = ivi_scale_mv(ref_mb->VAR_11, VAR_3);", "} else {", "mb->VAR_10 = ref_mb->VAR_10;", "mb->VAR_11 = ref_mb->VAR_11;", "}", "VAR_6 |= mb->VAR_10 || mb->VAR_11;", "}", "mb++;", "if (ref_mb)\nref_mb++;", "VAR_14 += VAR_1->mb_size;", "}", "VAR_13 += VAR_15;", "}", "if (VAR_1->inherit_mv && VAR_6) {", "VAR_9 = (VAR_1->mb_size != VAR_1->blk_size) ? 4 : 1;", "VAR_17 = (VAR_1->blk_size == 8) ? ff_ivi_mc_8x8_no_delta\n: ff_ivi_mc_4x4_no_delta;", "for (VAR_7 = 0, mb = VAR_2->mbs; VAR_7 < VAR_2->num_MBs; mb++, VAR_7++) {", "VAR_10 = mb->VAR_10;", "VAR_11 = mb->VAR_11;", "if (!VAR_1->is_halfpel) {", "VAR_21 = 0;", "} else {", "VAR_21 = ((VAR_11 & 1) << 1) | (VAR_10 & 1);", "VAR_10 >>= 1;", "VAR_11 >>= 1;", "}", "for (VAR_8 = 0; VAR_8 < VAR_9; VAR_8++) {", "VAR_13 = mb->buf_offs + VAR_1->blk_size * ((VAR_8 & 1) + !!(VAR_8 & 2) * VAR_1->VAR_20);", "VAR_17(VAR_1->VAR_18 + VAR_13,\nVAR_1->VAR_19 + VAR_13 + VAR_11 * VAR_1->VAR_20 + VAR_10,\nVAR_1->VAR_20, VAR_21);", "}", "}", "} else {", "VAR_16 = VAR_1->VAR_19 + VAR_2->ypos * VAR_1->VAR_20 + VAR_2->xpos;", "dst = VAR_1->VAR_18 + VAR_2->ypos * VAR_1->VAR_20 + VAR_2->xpos;", "for (VAR_5 = 0; VAR_5 < VAR_2->height; VAR_5++) {", "memcpy(dst, VAR_16, VAR_2->width*sizeof(VAR_1->VAR_18[0]));", "VAR_16 += VAR_1->VAR_20;", "dst += VAR_1->VAR_20;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 151 ], [ 153, 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ] ]
11,044
static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){ int y_size = s->b8_stride * (2 * s->mb_height + 1); int c_size = s->mb_stride * (s->mb_height + 1); int yc_size = y_size + 2 * c_size; int i; // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264) FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21; //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer() FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, (s->width+64)*4*16*2*sizeof(uint8_t), fail) s->me.temp= s->me.scratchpad; s->rd_scratchpad= s->me.scratchpad; s->b_scratchpad= s->me.scratchpad; s->obmc_scratchpad= s->me.scratchpad + 16; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->me.map , ME_MAP_SIZE*sizeof(uint32_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail) if(s->avctx->noise_reduction){ FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_error_sum, 2 * 64 * sizeof(int), fail) } } FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64*12*2 * sizeof(DCTELEM), fail) s->block= s->blocks[0]; for(i=0;i<12;i++){ s->pblocks[i] = &s->block[i]; } if (s->out_format == FMT_H263) { /* ac values */ FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail); s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; s->ac_val[2] = s->ac_val[1] + c_size; } return 0; fail: return -1; //free() through MPV_common_end() }
true
FFmpeg
330deb75923675224fb9aed311d3d6ce3ec52420
static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){ int y_size = s->b8_stride * (2 * s->mb_height + 1); int c_size = s->mb_stride * (s->mb_height + 1); int yc_size = y_size + 2 * c_size; int i; FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2, fail); s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21; FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, (s->width+64)*4*16*2*sizeof(uint8_t), fail) s->me.temp= s->me.scratchpad; s->rd_scratchpad= s->me.scratchpad; s->b_scratchpad= s->me.scratchpad; s->obmc_scratchpad= s->me.scratchpad + 16; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->me.map , ME_MAP_SIZE*sizeof(uint32_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail) if(s->avctx->noise_reduction){ FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_error_sum, 2 * 64 * sizeof(int), fail) } } FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64*12*2 * sizeof(DCTELEM), fail) s->block= s->blocks[0]; for(i=0;i<12;i++){ s->pblocks[i] = &s->block[i]; } if (s->out_format == FMT_H263) { FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail); s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; s->ac_val[2] = s->ac_val[1] + c_size; } return 0; fail: return -1; }
{ "code": [ " s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;" ], "line_no": [ 17 ] }
static int FUNC_0(MpegEncContext *VAR_0, MpegEncContext *VAR_1){ int VAR_2 = VAR_0->b8_stride * (2 * VAR_0->mb_height + 1); int VAR_3 = VAR_0->mb_stride * (VAR_0->mb_height + 1); int VAR_4 = VAR_2 + 2 * VAR_3; int VAR_5; FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->allocated_edge_emu_buffer, (VAR_0->width+64)*2*21*2, fail); VAR_0->edge_emu_buffer= VAR_0->allocated_edge_emu_buffer + (VAR_0->width+64)*2*21; FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->me.scratchpad, (VAR_0->width+64)*4*16*2*sizeof(uint8_t), fail) VAR_0->me.temp= VAR_0->me.scratchpad; VAR_0->rd_scratchpad= VAR_0->me.scratchpad; VAR_0->b_scratchpad= VAR_0->me.scratchpad; VAR_0->obmc_scratchpad= VAR_0->me.scratchpad + 16; if (VAR_0->encoding) { FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->me.map , ME_MAP_SIZE*sizeof(uint32_t), fail) FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail) if(VAR_0->avctx->noise_reduction){ FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->dct_error_sum, 2 * 64 * sizeof(int), fail) } } FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->blocks, 64*12*2 * sizeof(DCTELEM), fail) VAR_0->block= VAR_0->blocks[0]; for(VAR_5=0;VAR_5<12;VAR_5++){ VAR_0->pblocks[VAR_5] = &VAR_0->block[VAR_5]; } if (VAR_0->out_format == FMT_H263) { FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->ac_val_base, VAR_4 * sizeof(int16_t) * 16, fail); VAR_0->ac_val[0] = VAR_0->ac_val_base + VAR_0->b8_stride + 1; VAR_0->ac_val[1] = VAR_0->ac_val_base + VAR_2 + VAR_0->mb_stride + 1; VAR_0->ac_val[2] = VAR_0->ac_val[1] + VAR_3; } return 0; fail: return -1; }
[ "static int FUNC_0(MpegEncContext *VAR_0, MpegEncContext *VAR_1){", "int VAR_2 = VAR_0->b8_stride * (2 * VAR_0->mb_height + 1);", "int VAR_3 = VAR_0->mb_stride * (VAR_0->mb_height + 1);", "int VAR_4 = VAR_2 + 2 * VAR_3;", "int VAR_5;", "FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->allocated_edge_emu_buffer, (VAR_0->width+64)*2*21*2, fail);", "VAR_0->edge_emu_buffer= VAR_0->allocated_edge_emu_buffer + (VAR_0->width+64)*2*21;", "FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->me.scratchpad, (VAR_0->width+64)*4*16*2*sizeof(uint8_t), fail)\nVAR_0->me.temp= VAR_0->me.scratchpad;", "VAR_0->rd_scratchpad= VAR_0->me.scratchpad;", "VAR_0->b_scratchpad= VAR_0->me.scratchpad;", "VAR_0->obmc_scratchpad= VAR_0->me.scratchpad + 16;", "if (VAR_0->encoding) {", "FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->me.map , ME_MAP_SIZE*sizeof(uint32_t), fail)\nFF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail)\nif(VAR_0->avctx->noise_reduction){", "FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->dct_error_sum, 2 * 64 * sizeof(int), fail)\n}", "}", "FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->blocks, 64*12*2 * sizeof(DCTELEM), fail)\nVAR_0->block= VAR_0->blocks[0];", "for(VAR_5=0;VAR_5<12;VAR_5++){", "VAR_0->pblocks[VAR_5] = &VAR_0->block[VAR_5];", "}", "if (VAR_0->out_format == FMT_H263) {", "FF_ALLOCZ_OR_GOTO(VAR_0->avctx, VAR_0->ac_val_base, VAR_4 * sizeof(int16_t) * 16, fail);", "VAR_0->ac_val[0] = VAR_0->ac_val_base + VAR_0->b8_stride + 1;", "VAR_0->ac_val[1] = VAR_0->ac_val_base + VAR_2 + VAR_0->mb_stride + 1;", "VAR_0->ac_val[2] = VAR_0->ac_val[1] + VAR_3;", "}", "return 0;", "fail:\nreturn -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79, 81 ], [ 83 ] ]
11,045
static int msrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MsrleContext *s = avctx->priv_data; int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8; int ret; s->buf = buf; s->size = buf_size; if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } /* make the palette available */ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } /* FIXME how to correctly detect RLE ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0); uint8_t *ptr = s->frame->data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; for (i = 0; i < avctx->height; i++) { if (avctx->bits_per_coded_sample == 4) { for (j = 0; j < avctx->width - 1; j += 2) { ptr[j+0] = buf[j>>1] >> 4; ptr[j+1] = buf[j>>1] & 0xF; } if (avctx->width & 1) ptr[j+0] = buf[j>>1] >> 4; } else { memcpy(ptr, buf, linesize); } buf -= istride; ptr += s->frame->linesize[0]; } } else { bytestream2_init(&s->gb, buf, buf_size); ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb); } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; /* report that the buffer was completely consumed */ return buf_size; }
true
FFmpeg
754f84663e8b3a88fa2e953b195d59230393fb8d
static int msrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MsrleContext *s = avctx->priv_data; int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8; int ret; s->buf = buf; s->size = buf_size; if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } if (avctx->height * istride == avpkt->size) { int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0); uint8_t *ptr = s->frame->data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; for (i = 0; i < avctx->height; i++) { if (avctx->bits_per_coded_sample == 4) { for (j = 0; j < avctx->width - 1; j += 2) { ptr[j+0] = buf[j>>1] >> 4; ptr[j+1] = buf[j>>1] & 0xF; } if (avctx->width & 1) ptr[j+0] = buf[j>>1] >> 4; } else { memcpy(ptr, buf, linesize); } buf -= istride; ptr += s->frame->linesize[0]; } } else { bytestream2_init(&s->gb, buf, buf_size); ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb); } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; MsrleContext *s = VAR_0->priv_data; int VAR_6 = FFALIGN(VAR_0->width*VAR_0->bits_per_coded_sample, 32) / 8; int VAR_7; s->VAR_4 = VAR_4; s->size = VAR_5; if ((VAR_7 = ff_reget_buffer(VAR_0, s->frame)) < 0) return VAR_7; if (VAR_0->bits_per_coded_sample > 1 && VAR_0->bits_per_coded_sample <= 8) { const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL); if (VAR_8) { s->frame->palette_has_changed = 1; memcpy(s->VAR_8, VAR_8, AVPALETTE_SIZE); } memcpy(s->frame->VAR_1[1], s->VAR_8, AVPALETTE_SIZE); } if (VAR_0->height * VAR_6 == VAR_3->size) { int VAR_9 = av_image_get_linesize(VAR_0->pix_fmt, VAR_0->width, 0); uint8_t *ptr = s->frame->VAR_1[0]; uint8_t *VAR_4 = VAR_3->VAR_1 + (VAR_0->height-1)*VAR_6; int VAR_10, VAR_11; for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) { if (VAR_0->bits_per_coded_sample == 4) { for (VAR_11 = 0; VAR_11 < VAR_0->width - 1; VAR_11 += 2) { ptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4; ptr[VAR_11+1] = VAR_4[VAR_11>>1] & 0xF; } if (VAR_0->width & 1) ptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4; } else { memcpy(ptr, VAR_4, VAR_9); } VAR_4 -= VAR_6; ptr += s->frame->VAR_9[0]; } } else { bytestream2_init(&s->gb, VAR_4, VAR_5); ff_msrle_decode(VAR_0, (AVPicture*)s->frame, VAR_0->bits_per_coded_sample, &s->gb); } if ((VAR_7 = av_frame_ref(VAR_1, s->frame)) < 0) return VAR_7; *VAR_2 = 1; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MsrleContext *s = VAR_0->priv_data;", "int VAR_6 = FFALIGN(VAR_0->width*VAR_0->bits_per_coded_sample, 32) / 8;", "int VAR_7;", "s->VAR_4 = VAR_4;", "s->size = VAR_5;", "if ((VAR_7 = ff_reget_buffer(VAR_0, s->frame)) < 0)\nreturn VAR_7;", "if (VAR_0->bits_per_coded_sample > 1 && VAR_0->bits_per_coded_sample <= 8) {", "const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL);", "if (VAR_8) {", "s->frame->palette_has_changed = 1;", "memcpy(s->VAR_8, VAR_8, AVPALETTE_SIZE);", "}", "memcpy(s->frame->VAR_1[1], s->VAR_8, AVPALETTE_SIZE);", "}", "if (VAR_0->height * VAR_6 == VAR_3->size) {", "int VAR_9 = av_image_get_linesize(VAR_0->pix_fmt, VAR_0->width, 0);", "uint8_t *ptr = s->frame->VAR_1[0];", "uint8_t *VAR_4 = VAR_3->VAR_1 + (VAR_0->height-1)*VAR_6;", "int VAR_10, VAR_11;", "for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) {", "if (VAR_0->bits_per_coded_sample == 4) {", "for (VAR_11 = 0; VAR_11 < VAR_0->width - 1; VAR_11 += 2) {", "ptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4;", "ptr[VAR_11+1] = VAR_4[VAR_11>>1] & 0xF;", "}", "if (VAR_0->width & 1)\nptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4;", "} else {", "memcpy(ptr, VAR_4, VAR_9);", "}", "VAR_4 -= VAR_6;", "ptr += s->frame->VAR_9[0];", "}", "} else {", "bytestream2_init(&s->gb, VAR_4, VAR_5);", "ff_msrle_decode(VAR_0, (AVPicture*)s->frame, VAR_0->bits_per_coded_sample, &s->gb);", "}", "if ((VAR_7 = av_frame_ref(VAR_1, s->frame)) < 0)\nreturn VAR_7;", "*VAR_2 = 1;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12, 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 21 ], [ 22 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35, 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47, 48 ], [ 49 ], [ 51 ], [ 52 ] ]
11,047
static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat, int srcW, int srcH, int dstW, int dstH, int flags){ uint8_t *src[3]; uint8_t *dst[3]; uint8_t *out[3]; int srcStride[3], dstStride[3]; int i; uint64_t ssdY, ssdU, ssdV; struct SwsContext *srcContext, *dstContext, *outContext; int res; res = 0; for (i=0; i<3; i++){ // avoid stride % bpp != 0 if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24) srcStride[i]= srcW*3; else srcStride[i]= srcW*4; if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24) dstStride[i]= dstW*3; else dstStride[i]= dstW*4; src[i]= (uint8_t*) malloc(srcStride[i]*srcH); dst[i]= (uint8_t*) malloc(dstStride[i]*dstH); out[i]= (uint8_t*) malloc(refStride[i]*h); if (!src[i] || !dst[i] || !out[i]) { perror("Malloc"); res = -1; goto end; } } dstContext = outContext = NULL; srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL); if (!srcContext) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(PIX_FMT_YUV420P), sws_format_name(srcFormat)); res = -1; goto end; } dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL); if (!dstContext) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); res = -1; goto end; } outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL); if (!outContext) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(dstFormat), sws_format_name(PIX_FMT_YUV420P)); res = -1; goto end; } // printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2], // (int)src[0], (int)src[1], (int)src[2]); sws_scale(srcContext, ref, refStride, 0, h , src, srcStride); sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride); sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride); ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h); ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1); ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1); if (srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; //FIXME check that output is really gray ssdY/= w*h; ssdU/= w*h/4; ssdV/= w*h/4; printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n", sws_format_name(srcFormat), srcW, srcH, sws_format_name(dstFormat), dstW, dstH, flags, ssdY, ssdU, ssdV); fflush(stdout); end: sws_freeContext(srcContext); sws_freeContext(dstContext); sws_freeContext(outContext); for (i=0; i<3; i++){ free(src[i]); free(dst[i]); free(out[i]); } return res; }
true
FFmpeg
54ea773614e6dd43e31f870cde969d762f2deba6
static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat, int srcW, int srcH, int dstW, int dstH, int flags){ uint8_t *src[3]; uint8_t *dst[3]; uint8_t *out[3]; int srcStride[3], dstStride[3]; int i; uint64_t ssdY, ssdU, ssdV; struct SwsContext *srcContext, *dstContext, *outContext; int res; res = 0; for (i=0; i<3; i++){ if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24) srcStride[i]= srcW*3; else srcStride[i]= srcW*4; if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24) dstStride[i]= dstW*3; else dstStride[i]= dstW*4; src[i]= (uint8_t*) malloc(srcStride[i]*srcH); dst[i]= (uint8_t*) malloc(dstStride[i]*dstH); out[i]= (uint8_t*) malloc(refStride[i]*h); if (!src[i] || !dst[i] || !out[i]) { perror("Malloc"); res = -1; goto end; } } dstContext = outContext = NULL; srcContext= sws_getContext(w, h, PIX_FMT_YUV420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL); if (!srcContext) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(PIX_FMT_YUV420P), sws_format_name(srcFormat)); res = -1; goto end; } dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL); if (!dstContext) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); res = -1; goto end; } outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUV420P, flags, NULL, NULL, NULL); if (!outContext) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(dstFormat), sws_format_name(PIX_FMT_YUV420P)); res = -1; goto end; } sws_scale(srcContext, ref, refStride, 0, h , src, srcStride); sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride); sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride); ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h); ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1); ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1); if (srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; ssdY/= w*h; ssdU/= w*h/4; ssdV/= w*h/4; printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n", sws_format_name(srcFormat), srcW, srcH, sws_format_name(dstFormat), dstW, dstH, flags, ssdY, ssdU, ssdV); fflush(stdout); end: sws_freeContext(srcContext); sws_freeContext(dstContext); sws_freeContext(outContext); for (i=0; i<3; i++){ free(src[i]); free(dst[i]); free(out[i]); } return res; }
{ "code": [ " struct SwsContext *srcContext, *dstContext, *outContext;", " dstContext = outContext = NULL;" ], "line_no": [ 17, 71 ] }
static int FUNC_0(uint8_t *VAR_0[3], int VAR_1[3], int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10){ uint8_t *src[3]; uint8_t *dst[3]; uint8_t *out[3]; int VAR_11[3], VAR_12[3]; int VAR_13; uint64_t ssdY, ssdU, ssdV; struct SwsContext *VAR_14, *VAR_15, *VAR_16; int VAR_17; VAR_17 = 0; for (VAR_13=0; VAR_13<3; VAR_13++){ if (VAR_4==PIX_FMT_RGB24 || VAR_4==PIX_FMT_BGR24) VAR_11[VAR_13]= VAR_6*3; else VAR_11[VAR_13]= VAR_6*4; if (VAR_5==PIX_FMT_RGB24 || VAR_5==PIX_FMT_BGR24) VAR_12[VAR_13]= VAR_8*3; else VAR_12[VAR_13]= VAR_8*4; src[VAR_13]= (uint8_t*) malloc(VAR_11[VAR_13]*VAR_7); dst[VAR_13]= (uint8_t*) malloc(VAR_12[VAR_13]*VAR_9); out[VAR_13]= (uint8_t*) malloc(VAR_1[VAR_13]*VAR_3); if (!src[VAR_13] || !dst[VAR_13] || !out[VAR_13]) { perror("Malloc"); VAR_17 = -1; goto end; } } VAR_15 = VAR_16 = NULL; VAR_14= sws_getContext(VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_6, VAR_7, VAR_4, VAR_10, NULL, NULL, NULL); if (!VAR_14) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(PIX_FMT_YUV420P), sws_format_name(VAR_4)); VAR_17 = -1; goto end; } VAR_15= sws_getContext(VAR_6, VAR_7, VAR_4, VAR_8, VAR_9, VAR_5, VAR_10, NULL, NULL, NULL); if (!VAR_15) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(VAR_4), sws_format_name(VAR_5)); VAR_17 = -1; goto end; } VAR_16= sws_getContext(VAR_8, VAR_9, VAR_5, VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_10, NULL, NULL, NULL); if (!VAR_16) { fprintf(stderr, "Failed to get %s ---> %s\n", sws_format_name(VAR_5), sws_format_name(PIX_FMT_YUV420P)); VAR_17 = -1; goto end; } sws_scale(VAR_14, VAR_0, VAR_1, 0, VAR_3 , src, VAR_11); sws_scale(VAR_15, src, VAR_11, 0, VAR_7, dst, VAR_12); sws_scale(VAR_16, dst, VAR_12, 0, VAR_9, out, VAR_1); ssdY= getSSD(VAR_0[0], out[0], VAR_1[0], VAR_1[0], VAR_2, VAR_3); ssdU= getSSD(VAR_0[1], out[1], VAR_1[1], VAR_1[1], (VAR_2+1)>>1, (VAR_3+1)>>1); ssdV= getSSD(VAR_0[2], out[2], VAR_1[2], VAR_1[2], (VAR_2+1)>>1, (VAR_3+1)>>1); if (VAR_4 == PIX_FMT_GRAY8 || VAR_5==PIX_FMT_GRAY8) ssdU=ssdV=0; ssdY/= VAR_2*VAR_3; ssdU/= VAR_2*VAR_3/4; ssdV/= VAR_2*VAR_3/4; printf(" %s %dx%d -> %s %4dx%4d VAR_10=%2d SSD=%5lld,%5lld,%5lld\n", sws_format_name(VAR_4), VAR_6, VAR_7, sws_format_name(VAR_5), VAR_8, VAR_9, VAR_10, ssdY, ssdU, ssdV); fflush(stdout); end: sws_freeContext(VAR_14); sws_freeContext(VAR_15); sws_freeContext(VAR_16); for (VAR_13=0; VAR_13<3; VAR_13++){ free(src[VAR_13]); free(dst[VAR_13]); free(out[VAR_13]); } return VAR_17; }
[ "static int FUNC_0(uint8_t *VAR_0[3], int VAR_1[3], int VAR_2, int VAR_3, int VAR_4, int VAR_5,\nint VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10){", "uint8_t *src[3];", "uint8_t *dst[3];", "uint8_t *out[3];", "int VAR_11[3], VAR_12[3];", "int VAR_13;", "uint64_t ssdY, ssdU, ssdV;", "struct SwsContext *VAR_14, *VAR_15, *VAR_16;", "int VAR_17;", "VAR_17 = 0;", "for (VAR_13=0; VAR_13<3; VAR_13++){", "if (VAR_4==PIX_FMT_RGB24 || VAR_4==PIX_FMT_BGR24)\nVAR_11[VAR_13]= VAR_6*3;", "else\nVAR_11[VAR_13]= VAR_6*4;", "if (VAR_5==PIX_FMT_RGB24 || VAR_5==PIX_FMT_BGR24)\nVAR_12[VAR_13]= VAR_8*3;", "else\nVAR_12[VAR_13]= VAR_8*4;", "src[VAR_13]= (uint8_t*) malloc(VAR_11[VAR_13]*VAR_7);", "dst[VAR_13]= (uint8_t*) malloc(VAR_12[VAR_13]*VAR_9);", "out[VAR_13]= (uint8_t*) malloc(VAR_1[VAR_13]*VAR_3);", "if (!src[VAR_13] || !dst[VAR_13] || !out[VAR_13]) {", "perror(\"Malloc\");", "VAR_17 = -1;", "goto end;", "}", "}", "VAR_15 = VAR_16 = NULL;", "VAR_14= sws_getContext(VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_6, VAR_7, VAR_4, VAR_10, NULL, NULL, NULL);", "if (!VAR_14) {", "fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(PIX_FMT_YUV420P),\nsws_format_name(VAR_4));", "VAR_17 = -1;", "goto end;", "}", "VAR_15= sws_getContext(VAR_6, VAR_7, VAR_4, VAR_8, VAR_9, VAR_5, VAR_10, NULL, NULL, NULL);", "if (!VAR_15) {", "fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(VAR_4),\nsws_format_name(VAR_5));", "VAR_17 = -1;", "goto end;", "}", "VAR_16= sws_getContext(VAR_8, VAR_9, VAR_5, VAR_2, VAR_3, PIX_FMT_YUV420P, VAR_10, NULL, NULL, NULL);", "if (!VAR_16) {", "fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(VAR_5),\nsws_format_name(PIX_FMT_YUV420P));", "VAR_17 = -1;", "goto end;", "}", "sws_scale(VAR_14, VAR_0, VAR_1, 0, VAR_3 , src, VAR_11);", "sws_scale(VAR_15, src, VAR_11, 0, VAR_7, dst, VAR_12);", "sws_scale(VAR_16, dst, VAR_12, 0, VAR_9, out, VAR_1);", "ssdY= getSSD(VAR_0[0], out[0], VAR_1[0], VAR_1[0], VAR_2, VAR_3);", "ssdU= getSSD(VAR_0[1], out[1], VAR_1[1], VAR_1[1], (VAR_2+1)>>1, (VAR_3+1)>>1);", "ssdV= getSSD(VAR_0[2], out[2], VAR_1[2], VAR_1[2], (VAR_2+1)>>1, (VAR_3+1)>>1);", "if (VAR_4 == PIX_FMT_GRAY8 || VAR_5==PIX_FMT_GRAY8) ssdU=ssdV=0;", "ssdY/= VAR_2*VAR_3;", "ssdU/= VAR_2*VAR_3/4;", "ssdV/= VAR_2*VAR_3/4;", "printf(\" %s %dx%d -> %s %4dx%4d VAR_10=%2d SSD=%5lld,%5lld,%5lld\\n\",\nsws_format_name(VAR_4), VAR_6, VAR_7,\nsws_format_name(VAR_5), VAR_8, VAR_9,\nVAR_10, ssdY, ssdU, ssdV);", "fflush(stdout);", "end:\nsws_freeContext(VAR_14);", "sws_freeContext(VAR_15);", "sws_freeContext(VAR_16);", "for (VAR_13=0; VAR_13<3; VAR_13++){", "free(src[VAR_13]);", "free(dst[VAR_13]);", "free(out[VAR_13]);", "}", "return VAR_17;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 39, 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115, 117 ], [ 119 ], [ 123 ], [ 125 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161, 163, 165, 167 ], [ 169 ], [ 173, 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ] ]
11,048
static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp) { int ret; struct addrinfo *res; char port_str[16]; struct rdma_cm_event *cm_event; char ip[40] = "unknown"; struct addrinfo *e; if (rdma->host == NULL || !strcmp(rdma->host, "")) { ERROR(errp, "RDMA hostname has not been set"); return -1; } /* create CM channel */ rdma->channel = rdma_create_event_channel(); if (!rdma->channel) { ERROR(errp, "could not create CM channel"); return -1; } /* create CM id */ ret = rdma_create_id(rdma->channel, &rdma->cm_id, NULL, RDMA_PS_TCP); if (ret) { ERROR(errp, "could not create channel id"); goto err_resolve_create_id; } snprintf(port_str, 16, "%d", rdma->port); port_str[15] = '\0'; ret = getaddrinfo(rdma->host, port_str, NULL, &res); if (ret < 0) { ERROR(errp, "could not getaddrinfo address %s", rdma->host); goto err_resolve_get_addr; } for (e = res; e != NULL; e = e->ai_next) { inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_addr)->sin_addr, ip, sizeof ip); DPRINTF("Trying %s => %s\n", rdma->host, ip); /* resolve the first address */ ret = rdma_resolve_addr(rdma->cm_id, NULL, e->ai_addr, RDMA_RESOLVE_TIMEOUT_MS); if (!ret) { goto route; } } ERROR(errp, "could not resolve address %s", rdma->host); goto err_resolve_get_addr; route: qemu_rdma_dump_gid("source_resolve_addr", rdma->cm_id); ret = rdma_get_cm_event(rdma->channel, &cm_event); if (ret) { ERROR(errp, "could not perform event_addr_resolved"); goto err_resolve_get_addr; } if (cm_event->event != RDMA_CM_EVENT_ADDR_RESOLVED) { ERROR(errp, "result not equal to event_addr_resolved %s", rdma_event_str(cm_event->event)); perror("rdma_resolve_addr"); goto err_resolve_get_addr; } rdma_ack_cm_event(cm_event); /* resolve route */ ret = rdma_resolve_route(rdma->cm_id, RDMA_RESOLVE_TIMEOUT_MS); if (ret) { ERROR(errp, "could not resolve rdma route"); goto err_resolve_get_addr; } ret = rdma_get_cm_event(rdma->channel, &cm_event); if (ret) { ERROR(errp, "could not perform event_route_resolved"); goto err_resolve_get_addr; } if (cm_event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) { ERROR(errp, "result not equal to event_route_resolved: %s", rdma_event_str(cm_event->event)); rdma_ack_cm_event(cm_event); goto err_resolve_get_addr; } rdma_ack_cm_event(cm_event); rdma->verbs = rdma->cm_id->verbs; qemu_rdma_dump_id("source_resolve_host", rdma->cm_id->verbs); qemu_rdma_dump_gid("source_resolve_host", rdma->cm_id); return 0; err_resolve_get_addr: rdma_destroy_id(rdma->cm_id); rdma->cm_id = NULL; err_resolve_create_id: rdma_destroy_event_channel(rdma->channel); rdma->channel = NULL; return -1; }
true
qemu
7fc5b13fd7b05babc7bcad9dcb8281ae202a9494
static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp) { int ret; struct addrinfo *res; char port_str[16]; struct rdma_cm_event *cm_event; char ip[40] = "unknown"; struct addrinfo *e; if (rdma->host == NULL || !strcmp(rdma->host, "")) { ERROR(errp, "RDMA hostname has not been set"); return -1; } rdma->channel = rdma_create_event_channel(); if (!rdma->channel) { ERROR(errp, "could not create CM channel"); return -1; } ret = rdma_create_id(rdma->channel, &rdma->cm_id, NULL, RDMA_PS_TCP); if (ret) { ERROR(errp, "could not create channel id"); goto err_resolve_create_id; } snprintf(port_str, 16, "%d", rdma->port); port_str[15] = '\0'; ret = getaddrinfo(rdma->host, port_str, NULL, &res); if (ret < 0) { ERROR(errp, "could not getaddrinfo address %s", rdma->host); goto err_resolve_get_addr; } for (e = res; e != NULL; e = e->ai_next) { inet_ntop(e->ai_family, &((struct sockaddr_in *) e->ai_addr)->sin_addr, ip, sizeof ip); DPRINTF("Trying %s => %s\n", rdma->host, ip); ret = rdma_resolve_addr(rdma->cm_id, NULL, e->ai_addr, RDMA_RESOLVE_TIMEOUT_MS); if (!ret) { goto route; } } ERROR(errp, "could not resolve address %s", rdma->host); goto err_resolve_get_addr; route: qemu_rdma_dump_gid("source_resolve_addr", rdma->cm_id); ret = rdma_get_cm_event(rdma->channel, &cm_event); if (ret) { ERROR(errp, "could not perform event_addr_resolved"); goto err_resolve_get_addr; } if (cm_event->event != RDMA_CM_EVENT_ADDR_RESOLVED) { ERROR(errp, "result not equal to event_addr_resolved %s", rdma_event_str(cm_event->event)); perror("rdma_resolve_addr"); goto err_resolve_get_addr; } rdma_ack_cm_event(cm_event); ret = rdma_resolve_route(rdma->cm_id, RDMA_RESOLVE_TIMEOUT_MS); if (ret) { ERROR(errp, "could not resolve rdma route"); goto err_resolve_get_addr; } ret = rdma_get_cm_event(rdma->channel, &cm_event); if (ret) { ERROR(errp, "could not perform event_route_resolved"); goto err_resolve_get_addr; } if (cm_event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) { ERROR(errp, "result not equal to event_route_resolved: %s", rdma_event_str(cm_event->event)); rdma_ack_cm_event(cm_event); goto err_resolve_get_addr; } rdma_ack_cm_event(cm_event); rdma->verbs = rdma->cm_id->verbs; qemu_rdma_dump_id("source_resolve_host", rdma->cm_id->verbs); qemu_rdma_dump_gid("source_resolve_host", rdma->cm_id); return 0; err_resolve_get_addr: rdma_destroy_id(rdma->cm_id); rdma->cm_id = NULL; err_resolve_create_id: rdma_destroy_event_channel(rdma->channel); rdma->channel = NULL; return -1; }
{ "code": [ " struct addrinfo *res;", " struct addrinfo *e;", " return -1;", " return -1;", " ret = getaddrinfo(rdma->host, port_str, NULL, &res);", " ERROR(errp, \"could not getaddrinfo address %s\", rdma->host);", " &((struct sockaddr_in *) e->ai_addr)->sin_addr, ip, sizeof ip);", " ret = rdma_resolve_addr(rdma->cm_id, NULL, e->ai_addr,", " return -1;", " struct addrinfo *res;" ], "line_no": [ 7, 15, 23, 23, 63, 67, 79, 87, 203, 7 ] }
static int FUNC_0(RDMAContext *VAR_0, Error **VAR_1) { int VAR_2; struct addrinfo *VAR_3; char VAR_4[16]; struct rdma_cm_event *VAR_5; char VAR_6[40] = "unknown"; struct addrinfo *VAR_7; if (VAR_0->host == NULL || !strcmp(VAR_0->host, "")) { ERROR(VAR_1, "RDMA hostname has not been set"); return -1; } VAR_0->channel = rdma_create_event_channel(); if (!VAR_0->channel) { ERROR(VAR_1, "could not create CM channel"); return -1; } VAR_2 = rdma_create_id(VAR_0->channel, &VAR_0->cm_id, NULL, RDMA_PS_TCP); if (VAR_2) { ERROR(VAR_1, "could not create channel id"); goto err_resolve_create_id; } snprintf(VAR_4, 16, "%d", VAR_0->port); VAR_4[15] = '\0'; VAR_2 = getaddrinfo(VAR_0->host, VAR_4, NULL, &VAR_3); if (VAR_2 < 0) { ERROR(VAR_1, "could not getaddrinfo address %s", VAR_0->host); goto err_resolve_get_addr; } for (VAR_7 = VAR_3; VAR_7 != NULL; VAR_7 = VAR_7->ai_next) { inet_ntop(VAR_7->ai_family, &((struct sockaddr_in *) VAR_7->ai_addr)->sin_addr, VAR_6, sizeof VAR_6); DPRINTF("Trying %s => %s\n", VAR_0->host, VAR_6); VAR_2 = rdma_resolve_addr(VAR_0->cm_id, NULL, VAR_7->ai_addr, RDMA_RESOLVE_TIMEOUT_MS); if (!VAR_2) { goto route; } } ERROR(VAR_1, "could not resolve address %s", VAR_0->host); goto err_resolve_get_addr; route: qemu_rdma_dump_gid("source_resolve_addr", VAR_0->cm_id); VAR_2 = rdma_get_cm_event(VAR_0->channel, &VAR_5); if (VAR_2) { ERROR(VAR_1, "could not perform event_addr_resolved"); goto err_resolve_get_addr; } if (VAR_5->event != RDMA_CM_EVENT_ADDR_RESOLVED) { ERROR(VAR_1, "result not equal to event_addr_resolved %s", rdma_event_str(VAR_5->event)); perror("rdma_resolve_addr"); goto err_resolve_get_addr; } rdma_ack_cm_event(VAR_5); VAR_2 = rdma_resolve_route(VAR_0->cm_id, RDMA_RESOLVE_TIMEOUT_MS); if (VAR_2) { ERROR(VAR_1, "could not resolve VAR_0 route"); goto err_resolve_get_addr; } VAR_2 = rdma_get_cm_event(VAR_0->channel, &VAR_5); if (VAR_2) { ERROR(VAR_1, "could not perform event_route_resolved"); goto err_resolve_get_addr; } if (VAR_5->event != RDMA_CM_EVENT_ROUTE_RESOLVED) { ERROR(VAR_1, "result not equal to event_route_resolved: %s", rdma_event_str(VAR_5->event)); rdma_ack_cm_event(VAR_5); goto err_resolve_get_addr; } rdma_ack_cm_event(VAR_5); VAR_0->verbs = VAR_0->cm_id->verbs; qemu_rdma_dump_id("source_resolve_host", VAR_0->cm_id->verbs); qemu_rdma_dump_gid("source_resolve_host", VAR_0->cm_id); return 0; err_resolve_get_addr: rdma_destroy_id(VAR_0->cm_id); VAR_0->cm_id = NULL; err_resolve_create_id: rdma_destroy_event_channel(VAR_0->channel); VAR_0->channel = NULL; return -1; }
[ "static int FUNC_0(RDMAContext *VAR_0, Error **VAR_1)\n{", "int VAR_2;", "struct addrinfo *VAR_3;", "char VAR_4[16];", "struct rdma_cm_event *VAR_5;", "char VAR_6[40] = \"unknown\";", "struct addrinfo *VAR_7;", "if (VAR_0->host == NULL || !strcmp(VAR_0->host, \"\")) {", "ERROR(VAR_1, \"RDMA hostname has not been set\");", "return -1;", "}", "VAR_0->channel = rdma_create_event_channel();", "if (!VAR_0->channel) {", "ERROR(VAR_1, \"could not create CM channel\");", "return -1;", "}", "VAR_2 = rdma_create_id(VAR_0->channel, &VAR_0->cm_id, NULL, RDMA_PS_TCP);", "if (VAR_2) {", "ERROR(VAR_1, \"could not create channel id\");", "goto err_resolve_create_id;", "}", "snprintf(VAR_4, 16, \"%d\", VAR_0->port);", "VAR_4[15] = '\\0';", "VAR_2 = getaddrinfo(VAR_0->host, VAR_4, NULL, &VAR_3);", "if (VAR_2 < 0) {", "ERROR(VAR_1, \"could not getaddrinfo address %s\", VAR_0->host);", "goto err_resolve_get_addr;", "}", "for (VAR_7 = VAR_3; VAR_7 != NULL; VAR_7 = VAR_7->ai_next) {", "inet_ntop(VAR_7->ai_family,\n&((struct sockaddr_in *) VAR_7->ai_addr)->sin_addr, VAR_6, sizeof VAR_6);", "DPRINTF(\"Trying %s => %s\\n\", VAR_0->host, VAR_6);", "VAR_2 = rdma_resolve_addr(VAR_0->cm_id, NULL, VAR_7->ai_addr,\nRDMA_RESOLVE_TIMEOUT_MS);", "if (!VAR_2) {", "goto route;", "}", "}", "ERROR(VAR_1, \"could not resolve address %s\", VAR_0->host);", "goto err_resolve_get_addr;", "route:\nqemu_rdma_dump_gid(\"source_resolve_addr\", VAR_0->cm_id);", "VAR_2 = rdma_get_cm_event(VAR_0->channel, &VAR_5);", "if (VAR_2) {", "ERROR(VAR_1, \"could not perform event_addr_resolved\");", "goto err_resolve_get_addr;", "}", "if (VAR_5->event != RDMA_CM_EVENT_ADDR_RESOLVED) {", "ERROR(VAR_1, \"result not equal to event_addr_resolved %s\",\nrdma_event_str(VAR_5->event));", "perror(\"rdma_resolve_addr\");", "goto err_resolve_get_addr;", "}", "rdma_ack_cm_event(VAR_5);", "VAR_2 = rdma_resolve_route(VAR_0->cm_id, RDMA_RESOLVE_TIMEOUT_MS);", "if (VAR_2) {", "ERROR(VAR_1, \"could not resolve VAR_0 route\");", "goto err_resolve_get_addr;", "}", "VAR_2 = rdma_get_cm_event(VAR_0->channel, &VAR_5);", "if (VAR_2) {", "ERROR(VAR_1, \"could not perform event_route_resolved\");", "goto err_resolve_get_addr;", "}", "if (VAR_5->event != RDMA_CM_EVENT_ROUTE_RESOLVED) {", "ERROR(VAR_1, \"result not equal to event_route_resolved: %s\",\nrdma_event_str(VAR_5->event));", "rdma_ack_cm_event(VAR_5);", "goto err_resolve_get_addr;", "}", "rdma_ack_cm_event(VAR_5);", "VAR_0->verbs = VAR_0->cm_id->verbs;", "qemu_rdma_dump_id(\"source_resolve_host\", VAR_0->cm_id->verbs);", "qemu_rdma_dump_gid(\"source_resolve_host\", VAR_0->cm_id);", "return 0;", "err_resolve_get_addr:\nrdma_destroy_id(VAR_0->cm_id);", "VAR_0->cm_id = NULL;", "err_resolve_create_id:\nrdma_destroy_event_channel(VAR_0->channel);", "VAR_0->channel = NULL;", "return -1;", "}" ]
[ 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 203 ], [ 205 ] ]
11,049
static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, const char *model, const char *name, int fd, int is_connected, const char *mcast, Error **errp) { struct sockaddr_in saddr; int newfd; NetClientState *nc; NetSocketState *s; /* fd passed: multicast: "learn" dgram_dst address from bound address and save it * Because this may be "shared" socket from a "master" process, datagrams would be recv() * by ONLY ONE process: we must "clone" this dgram socket --jjo */ if (is_connected && mcast != NULL) { if (parse_host_port(&saddr, mcast, errp) < 0) { goto err; } /* must be bound */ if (saddr.sin_addr.s_addr == 0) { error_setg(errp, "can't setup multicast destination address"); goto err; } /* clone dgram socket */ newfd = net_socket_mcast_create(&saddr, NULL, errp); if (newfd < 0) { goto err; } /* clone newfd to fd, close newfd */ dup2(newfd, fd); close(newfd); } nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name); s = DO_UPCAST(NetSocketState, nc, nc); s->fd = fd; s->listen_fd = -1; s->send_fn = net_socket_send_dgram; net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); net_socket_read_poll(s, true); /* mcast: save bound address as dst */ if (is_connected) { s->dgram_dst = saddr; snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d (cloned mcast=%s:%d)", fd, inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); } else { snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd); } return s; err: closesocket(fd); return NULL; }
true
qemu
bb160b571fe469b03228d4502c75a18045978a74
static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, const char *model, const char *name, int fd, int is_connected, const char *mcast, Error **errp) { struct sockaddr_in saddr; int newfd; NetClientState *nc; NetSocketState *s; if (is_connected && mcast != NULL) { if (parse_host_port(&saddr, mcast, errp) < 0) { goto err; } if (saddr.sin_addr.s_addr == 0) { error_setg(errp, "can't setup multicast destination address"); goto err; } newfd = net_socket_mcast_create(&saddr, NULL, errp); if (newfd < 0) { goto err; } dup2(newfd, fd); close(newfd); } nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name); s = DO_UPCAST(NetSocketState, nc, nc); s->fd = fd; s->listen_fd = -1; s->send_fn = net_socket_send_dgram; net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); net_socket_read_poll(s, true); if (is_connected) { s->dgram_dst = saddr; snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d (cloned mcast=%s:%d)", fd, inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); } else { snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd); } return s; err: closesocket(fd); return NULL; }
{ "code": [ " if (is_connected) {" ], "line_no": [ 97 ] }
static NetSocketState *FUNC_0(NetClientState *peer, const char *model, const char *name, int fd, int is_connected, const char *mcast, Error **errp) { struct sockaddr_in VAR_0; int VAR_1; NetClientState *nc; NetSocketState *s; if (is_connected && mcast != NULL) { if (parse_host_port(&VAR_0, mcast, errp) < 0) { goto err; } if (VAR_0.sin_addr.s_addr == 0) { error_setg(errp, "can't setup multicast destination address"); goto err; } VAR_1 = net_socket_mcast_create(&VAR_0, NULL, errp); if (VAR_1 < 0) { goto err; } dup2(VAR_1, fd); close(VAR_1); } nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name); s = DO_UPCAST(NetSocketState, nc, nc); s->fd = fd; s->listen_fd = -1; s->send_fn = net_socket_send_dgram; net_socket_rs_init(&s->rs, net_socket_rs_finalize, false); net_socket_read_poll(s, true); if (is_connected) { s->dgram_dst = VAR_0; snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d (cloned mcast=%s:%d)", fd, inet_ntoa(VAR_0.sin_addr), ntohs(VAR_0.sin_port)); } else { snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd); } return s; err: closesocket(fd); return NULL; }
[ "static NetSocketState *FUNC_0(NetClientState *peer,\nconst char *model,\nconst char *name,\nint fd, int is_connected,\nconst char *mcast,\nError **errp)\n{", "struct sockaddr_in VAR_0;", "int VAR_1;", "NetClientState *nc;", "NetSocketState *s;", "if (is_connected && mcast != NULL) {", "if (parse_host_port(&VAR_0, mcast, errp) < 0) {", "goto err;", "}", "if (VAR_0.sin_addr.s_addr == 0) {", "error_setg(errp, \"can't setup multicast destination address\");", "goto err;", "}", "VAR_1 = net_socket_mcast_create(&VAR_0, NULL, errp);", "if (VAR_1 < 0) {", "goto err;", "}", "dup2(VAR_1, fd);", "close(VAR_1);", "}", "nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);", "s = DO_UPCAST(NetSocketState, nc, nc);", "s->fd = fd;", "s->listen_fd = -1;", "s->send_fn = net_socket_send_dgram;", "net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);", "net_socket_read_poll(s, true);", "if (is_connected) {", "s->dgram_dst = VAR_0;", "snprintf(nc->info_str, sizeof(nc->info_str),\n\"socket: fd=%d (cloned mcast=%s:%d)\",\nfd, inet_ntoa(VAR_0.sin_addr), ntohs(VAR_0.sin_port));", "} else {", "snprintf(nc->info_str, sizeof(nc->info_str),\n\"socket: fd=%d\", fd);", "}", "return s;", "err:\nclosesocket(fd);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ] ]
11,050
static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); ((pixel4*)(src+0*stride))[0]= PIXEL_SPLAT_X4(src[-1+0*stride]); ((pixel4*)(src+1*stride))[0]= PIXEL_SPLAT_X4(src[-1+1*stride]); ((pixel4*)(src+2*stride))[0]= PIXEL_SPLAT_X4(src[-1+2*stride]); ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(src[-1+3*stride]); }
true
FFmpeg
2caf19e90f270abe1e80a3e85acaf0eb5c9d0aac
static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); ((pixel4*)(src+0*stride))[0]= PIXEL_SPLAT_X4(src[-1+0*stride]); ((pixel4*)(src+1*stride))[0]= PIXEL_SPLAT_X4(src[-1+1*stride]); ((pixel4*)(src+2*stride))[0]= PIXEL_SPLAT_X4(src[-1+2*stride]); ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(src[-1+3*stride]); }
{ "code": [ " ((pixel4*)(src+0*stride))[0]= PIXEL_SPLAT_X4(src[-1+0*stride]);", " ((pixel4*)(src+1*stride))[0]= PIXEL_SPLAT_X4(src[-1+1*stride]);", " ((pixel4*)(src+2*stride))[0]= PIXEL_SPLAT_X4(src[-1+2*stride]);", " ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(src[-1+3*stride]);" ], "line_no": [ 7, 9, 11, 13 ] }
static void FUNC_0(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int VAR_0 = _stride/sizeof(pixel); ((pixel4*)(src+0*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+0*VAR_0]); ((pixel4*)(src+1*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+1*VAR_0]); ((pixel4*)(src+2*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+2*VAR_0]); ((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+3*VAR_0]); }
[ "static void FUNC_0(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, int _stride){", "pixel *src = (pixel*)_src;", "int VAR_0 = _stride/sizeof(pixel);", "((pixel4*)(src+0*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+0*VAR_0]);", "((pixel4*)(src+1*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+1*VAR_0]);", "((pixel4*)(src+2*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+2*VAR_0]);", "((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4(src[-1+3*VAR_0]);", "}" ]
[ 0, 0, 0, 1, 1, 1, 1, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
11,051
static void ehci_trace_itd(EHCIState *s, target_phys_addr_t addr, EHCIitd *itd) { trace_usb_ehci_itd(addr, itd->next); }
true
qemu
e654887f3880fb0f6d4d40d15d2977de245a6440
static void ehci_trace_itd(EHCIState *s, target_phys_addr_t addr, EHCIitd *itd) { trace_usb_ehci_itd(addr, itd->next); }
{ "code": [ " trace_usb_ehci_itd(addr, itd->next);" ], "line_no": [ 5 ] }
static void FUNC_0(EHCIState *VAR_0, target_phys_addr_t VAR_1, EHCIitd *VAR_2) { trace_usb_ehci_itd(VAR_1, VAR_2->next); }
[ "static void FUNC_0(EHCIState *VAR_0, target_phys_addr_t VAR_1, EHCIitd *VAR_2)\n{", "trace_usb_ehci_itd(VAR_1, VAR_2->next);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,052
static inline void horizX1Filter(uint8_t *src, int stride, int QP) { int y; static uint64_t *lut= NULL; if(lut==NULL) { int i; lut = av_malloc(256*8); for(i=0; i<256; i++) { int v= i < 128 ? 2*i : 2*(i-256); /* //Simulate 112242211 9-Tap filter uint64_t a= (v/16) & 0xFF; uint64_t b= (v/8) & 0xFF; uint64_t c= (v/4) & 0xFF; uint64_t d= (3*v/8) & 0xFF; */ //Simulate piecewise linear interpolation uint64_t a= (v/16) & 0xFF; uint64_t b= (v*3/16) & 0xFF; uint64_t c= (v*5/16) & 0xFF; uint64_t d= (7*v/16) & 0xFF; uint64_t A= (0x100 - a)&0xFF; uint64_t B= (0x100 - b)&0xFF; uint64_t C= (0x100 - c)&0xFF; uint64_t D= (0x100 - c)&0xFF; lut[i] = (a<<56) | (b<<48) | (c<<40) | (d<<32) | (D<<24) | (C<<16) | (B<<8) | (A); //lut[i] = (v<<32) | (v<<24); } } for(y=0; y<BLOCK_SIZE; y++){ int a= src[1] - src[2]; int b= src[3] - src[4]; int c= src[5] - src[6]; int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0); if(d < QP){ int v = d * FFSIGN(-b); src[1] +=v/8; src[2] +=v/4; src[3] +=3*v/8; src[4] -=3*v/8; src[5] -=v/4; src[6] -=v/8; } src+=stride; } }
true
FFmpeg
f9d8658d67cfb478e5e36ce1d2795eabdb201bcb
static inline void horizX1Filter(uint8_t *src, int stride, int QP) { int y; static uint64_t *lut= NULL; if(lut==NULL) { int i; lut = av_malloc(256*8); for(i=0; i<256; i++) { int v= i < 128 ? 2*i : 2*(i-256); uint64_t a= (v/16) & 0xFF; uint64_t b= (v*3/16) & 0xFF; uint64_t c= (v*5/16) & 0xFF; uint64_t d= (7*v/16) & 0xFF; uint64_t A= (0x100 - a)&0xFF; uint64_t B= (0x100 - b)&0xFF; uint64_t C= (0x100 - c)&0xFF; uint64_t D= (0x100 - c)&0xFF; lut[i] = (a<<56) | (b<<48) | (c<<40) | (d<<32) | (D<<24) | (C<<16) | (B<<8) | (A); } } for(y=0; y<BLOCK_SIZE; y++){ int a= src[1] - src[2]; int b= src[3] - src[4]; int c= src[5] - src[6]; int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0); if(d < QP){ int v = d * FFSIGN(-b); src[1] +=v/8; src[2] +=v/4; src[3] +=3*v/8; src[4] -=3*v/8; src[5] -=v/4; src[6] -=v/8; } src+=stride; } }
{ "code": [ " static uint64_t *lut= NULL;", " if(lut==NULL)", " lut = av_malloc(256*8);" ], "line_no": [ 7, 9, 15 ] }
static inline void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2) { int VAR_3; static uint64_t *VAR_4= NULL; if(VAR_4==NULL) { int VAR_5; VAR_4 = av_malloc(256*8); for(VAR_5=0; VAR_5<256; VAR_5++) { int VAR_6= VAR_5 < 128 ? 2*VAR_5 : 2*(VAR_5-256); uint64_t a= (VAR_6/16) & 0xFF; uint64_t b= (VAR_6*3/16) & 0xFF; uint64_t c= (VAR_6*5/16) & 0xFF; uint64_t d= (7*VAR_6/16) & 0xFF; uint64_t A= (0x100 - a)&0xFF; uint64_t B= (0x100 - b)&0xFF; uint64_t C= (0x100 - c)&0xFF; uint64_t D= (0x100 - c)&0xFF; VAR_4[VAR_5] = (a<<56) | (b<<48) | (c<<40) | (d<<32) | (D<<24) | (C<<16) | (B<<8) | (A); } } for(VAR_3=0; VAR_3<BLOCK_SIZE; VAR_3++){ int a= VAR_0[1] - VAR_0[2]; int b= VAR_0[3] - VAR_0[4]; int c= VAR_0[5] - VAR_0[6]; int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0); if(d < VAR_2){ int VAR_6 = d * FFSIGN(-b); VAR_0[1] +=VAR_6/8; VAR_0[2] +=VAR_6/4; VAR_0[3] +=3*VAR_6/8; VAR_0[4] -=3*VAR_6/8; VAR_0[5] -=VAR_6/4; VAR_0[6] -=VAR_6/8; } VAR_0+=VAR_1; } }
[ "static inline void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3;", "static uint64_t *VAR_4= NULL;", "if(VAR_4==NULL)\n{", "int VAR_5;", "VAR_4 = av_malloc(256*8);", "for(VAR_5=0; VAR_5<256; VAR_5++)", "{", "int VAR_6= VAR_5 < 128 ? 2*VAR_5 : 2*(VAR_5-256);", "uint64_t a= (VAR_6/16) & 0xFF;", "uint64_t b= (VAR_6*3/16) & 0xFF;", "uint64_t c= (VAR_6*5/16) & 0xFF;", "uint64_t d= (7*VAR_6/16) & 0xFF;", "uint64_t A= (0x100 - a)&0xFF;", "uint64_t B= (0x100 - b)&0xFF;", "uint64_t C= (0x100 - c)&0xFF;", "uint64_t D= (0x100 - c)&0xFF;", "VAR_4[VAR_5] = (a<<56) | (b<<48) | (c<<40) | (d<<32) |\n(D<<24) | (C<<16) | (B<<8) | (A);", "}", "}", "for(VAR_3=0; VAR_3<BLOCK_SIZE; VAR_3++){", "int a= VAR_0[1] - VAR_0[2];", "int b= VAR_0[3] - VAR_0[4];", "int c= VAR_0[5] - VAR_0[6];", "int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0);", "if(d < VAR_2){", "int VAR_6 = d * FFSIGN(-b);", "VAR_0[1] +=VAR_6/8;", "VAR_0[2] +=VAR_6/4;", "VAR_0[3] +=3*VAR_6/8;", "VAR_0[4] -=3*VAR_6/8;", "VAR_0[5] -=VAR_6/4;", "VAR_0[6] -=VAR_6/8;", "}", "VAR_0+=VAR_1;", "}", "}" ]
[ 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ] ]
11,053
AVCodecParserContext *av_parser_init(int codec_id) { AVCodecParserContext *s; AVCodecParser *parser; int ret; if(codec_id == CODEC_ID_NONE) return NULL; for(parser = av_first_parser; parser != NULL; parser = parser->next) { if (parser->codec_ids[0] == codec_id || parser->codec_ids[1] == codec_id || parser->codec_ids[2] == codec_id || parser->codec_ids[3] == codec_id || parser->codec_ids[4] == codec_id) goto found; } return NULL; found: s = av_mallocz(sizeof(AVCodecParserContext)); if (!s) return NULL; s->parser = parser; if (parser->priv_data_size) { s->priv_data = av_mallocz(parser->priv_data_size); if (!s->priv_data) { av_free(s); return NULL; } } if (parser->parser_init) { ret = parser->parser_init(s); if (ret != 0) { av_free(s->priv_data); av_free(s); return NULL; } } s->fetch_timestamp=1; s->pict_type = FF_I_TYPE; s->key_frame = -1; s->convergence_duration = 0; s->dts_sync_point = INT_MIN; s->dts_ref_dts_delta = INT_MIN; s->pts_dts_delta = INT_MIN; return s; }
false
FFmpeg
85ff33948963257d418abe7d8975b4c9c4641223
AVCodecParserContext *av_parser_init(int codec_id) { AVCodecParserContext *s; AVCodecParser *parser; int ret; if(codec_id == CODEC_ID_NONE) return NULL; for(parser = av_first_parser; parser != NULL; parser = parser->next) { if (parser->codec_ids[0] == codec_id || parser->codec_ids[1] == codec_id || parser->codec_ids[2] == codec_id || parser->codec_ids[3] == codec_id || parser->codec_ids[4] == codec_id) goto found; } return NULL; found: s = av_mallocz(sizeof(AVCodecParserContext)); if (!s) return NULL; s->parser = parser; if (parser->priv_data_size) { s->priv_data = av_mallocz(parser->priv_data_size); if (!s->priv_data) { av_free(s); return NULL; } } if (parser->parser_init) { ret = parser->parser_init(s); if (ret != 0) { av_free(s->priv_data); av_free(s); return NULL; } } s->fetch_timestamp=1; s->pict_type = FF_I_TYPE; s->key_frame = -1; s->convergence_duration = 0; s->dts_sync_point = INT_MIN; s->dts_ref_dts_delta = INT_MIN; s->pts_dts_delta = INT_MIN; return s; }
{ "code": [], "line_no": [] }
AVCodecParserContext *FUNC_0(int codec_id) { AVCodecParserContext *s; AVCodecParser *parser; int VAR_0; if(codec_id == CODEC_ID_NONE) return NULL; for(parser = av_first_parser; parser != NULL; parser = parser->next) { if (parser->codec_ids[0] == codec_id || parser->codec_ids[1] == codec_id || parser->codec_ids[2] == codec_id || parser->codec_ids[3] == codec_id || parser->codec_ids[4] == codec_id) goto found; } return NULL; found: s = av_mallocz(sizeof(AVCodecParserContext)); if (!s) return NULL; s->parser = parser; if (parser->priv_data_size) { s->priv_data = av_mallocz(parser->priv_data_size); if (!s->priv_data) { av_free(s); return NULL; } } if (parser->parser_init) { VAR_0 = parser->parser_init(s); if (VAR_0 != 0) { av_free(s->priv_data); av_free(s); return NULL; } } s->fetch_timestamp=1; s->pict_type = FF_I_TYPE; s->key_frame = -1; s->convergence_duration = 0; s->dts_sync_point = INT_MIN; s->dts_ref_dts_delta = INT_MIN; s->pts_dts_delta = INT_MIN; return s; }
[ "AVCodecParserContext *FUNC_0(int codec_id)\n{", "AVCodecParserContext *s;", "AVCodecParser *parser;", "int VAR_0;", "if(codec_id == CODEC_ID_NONE)\nreturn NULL;", "for(parser = av_first_parser; parser != NULL; parser = parser->next) {", "if (parser->codec_ids[0] == codec_id ||\nparser->codec_ids[1] == codec_id ||\nparser->codec_ids[2] == codec_id ||\nparser->codec_ids[3] == codec_id ||\nparser->codec_ids[4] == codec_id)\ngoto found;", "}", "return NULL;", "found:\ns = av_mallocz(sizeof(AVCodecParserContext));", "if (!s)\nreturn NULL;", "s->parser = parser;", "if (parser->priv_data_size) {", "s->priv_data = av_mallocz(parser->priv_data_size);", "if (!s->priv_data) {", "av_free(s);", "return NULL;", "}", "}", "if (parser->parser_init) {", "VAR_0 = parser->parser_init(s);", "if (VAR_0 != 0) {", "av_free(s->priv_data);", "av_free(s);", "return NULL;", "}", "}", "s->fetch_timestamp=1;", "s->pict_type = FF_I_TYPE;", "s->key_frame = -1;", "s->convergence_duration = 0;", "s->dts_sync_point = INT_MIN;", "s->dts_ref_dts_delta = INT_MIN;", "s->pts_dts_delta = INT_MIN;", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21, 23, 25, 27, 29, 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
11,054
int migrate_use_xbzrle(void) { MigrationState *s; s = migrate_get_current(); return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
int migrate_use_xbzrle(void) { MigrationState *s; s = migrate_get_current(); return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; }
{ "code": [], "line_no": [] }
int FUNC_0(void) { MigrationState *s; s = migrate_get_current(); return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; }
[ "int FUNC_0(void)\n{", "MigrationState *s;", "s = migrate_get_current();", "return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ] ]
11,056
static void xen_hvm_change_state_handler(void *opaque, int running, RunState rstate) { if (running) { xen_main_loop_prepare((XenIOState *)opaque); } }
true
qemu
3996e85c1822e05c50250f8d2d1e57b6bea1229d
static void xen_hvm_change_state_handler(void *opaque, int running, RunState rstate) { if (running) { xen_main_loop_prepare((XenIOState *)opaque); } }
{ "code": [ " xen_main_loop_prepare((XenIOState *)opaque);" ], "line_no": [ 9 ] }
static void FUNC_0(void *VAR_0, int VAR_1, RunState VAR_2) { if (VAR_1) { xen_main_loop_prepare((XenIOState *)VAR_0); } }
[ "static void FUNC_0(void *VAR_0, int VAR_1,\nRunState VAR_2)\n{", "if (VAR_1) {", "xen_main_loop_prepare((XenIOState *)VAR_0);", "}", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
11,057
static int parse_vlan(DeviceState *dev, Property *prop, const char *str) { VLANState **ptr = qdev_get_prop_ptr(dev, prop); int id; if (sscanf(str, "%d", &id) != 1) return -EINVAL; *ptr = qemu_find_vlan(id, 1); if (*ptr == NULL) return -ENOENT; return 0; }
true
qemu
5cb9b56acfc0b50acf7ccd2d044ab4991c47fdde
static int parse_vlan(DeviceState *dev, Property *prop, const char *str) { VLANState **ptr = qdev_get_prop_ptr(dev, prop); int id; if (sscanf(str, "%d", &id) != 1) return -EINVAL; *ptr = qemu_find_vlan(id, 1); if (*ptr == NULL) return -ENOENT; return 0; }
{ "code": [ " return -EINVAL;", " return 0;", " return -EINVAL;", " return 0;", " return -EINVAL;", " return 0;", " return -EINVAL;", " return 0;", " return -EINVAL;", " return 0;", " return -EINVAL;", " return 0;", "static int parse_vlan(DeviceState *dev, Property *prop, const char *str)", " VLANState **ptr = qdev_get_prop_ptr(dev, prop);", " int id;", " if (sscanf(str, \"%d\", &id) != 1)", " return -EINVAL;", " *ptr = qemu_find_vlan(id, 1);", " if (*ptr == NULL)", " return -ENOENT;", " return 0;" ], "line_no": [ 13, 21, 13, 21, 13, 21, 13, 21, 13, 21, 13, 21, 1, 5, 7, 11, 13, 15, 17, 19, 21 ] }
static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, const char *VAR_2) { VLANState **ptr = qdev_get_prop_ptr(VAR_0, VAR_1); int VAR_3; if (sscanf(VAR_2, "%d", &VAR_3) != 1) return -EINVAL; *ptr = qemu_find_vlan(VAR_3, 1); if (*ptr == NULL) return -ENOENT; return 0; }
[ "static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, const char *VAR_2)\n{", "VLANState **ptr = qdev_get_prop_ptr(VAR_0, VAR_1);", "int VAR_3;", "if (sscanf(VAR_2, \"%d\", &VAR_3) != 1)\nreturn -EINVAL;", "*ptr = qemu_find_vlan(VAR_3, 1);", "if (*ptr == NULL)\nreturn -ENOENT;", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ] ]
11,058
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; QtrleContext *s = avctx->priv_data; int header, start_line; int stream_ptr, height, row_ptr; int has_palette = 0; s->buf = buf; s->size = buf_size; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE; if (avctx->reget_buffer(avctx, &s->frame)) { av_log (s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } /* check if this frame is even supposed to change */ if (s->size < 8) goto done; /* start after the chunk size */ stream_ptr = 4; /* fetch the header */ header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; /* if a header is present, fetch additional decoding parameters */ if (header & 0x0008) { if(s->size < 14) goto done; start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; height = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; height = s->avctx->height; } row_ptr = s->frame.linesize[0] * start_line; switch (avctx->bits_per_coded_sample) { case 1: case 33: qtrle_decode_1bpp(s, stream_ptr, row_ptr, height); break; case 2: case 34: qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 2); has_palette = 1; break; case 4: case 36: qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 4); has_palette = 1; break; case 8: case 40: qtrle_decode_8bpp(s, stream_ptr, row_ptr, height); has_palette = 1; break; case 16: qtrle_decode_16bpp(s, stream_ptr, row_ptr, height); break; case 24: qtrle_decode_24bpp(s, stream_ptr, row_ptr, height); break; case 32: qtrle_decode_32bpp(s, stream_ptr, row_ptr, height); break; default: av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n", avctx->bits_per_coded_sample); break; } if(has_palette) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame.palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } /* make the palette available on the way out */ memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); } done: *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; /* always report that the buffer was completely consumed */ return buf_size; }
true
FFmpeg
de64d8cf171c6ecdca22d57f0bdd7efec95d0c0e
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; QtrleContext *s = avctx->priv_data; int header, start_line; int stream_ptr, height, row_ptr; int has_palette = 0; s->buf = buf; s->size = buf_size; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE; if (avctx->reget_buffer(avctx, &s->frame)) { av_log (s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } if (s->size < 8) goto done; stream_ptr = 4; header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; if (header & 0x0008) { if(s->size < 14) goto done; start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; height = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; height = s->avctx->height; } row_ptr = s->frame.linesize[0] * start_line; switch (avctx->bits_per_coded_sample) { case 1: case 33: qtrle_decode_1bpp(s, stream_ptr, row_ptr, height); break; case 2: case 34: qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 2); has_palette = 1; break; case 4: case 36: qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 4); has_palette = 1; break; case 8: case 40: qtrle_decode_8bpp(s, stream_ptr, row_ptr, height); has_palette = 1; break; case 16: qtrle_decode_16bpp(s, stream_ptr, row_ptr, height); break; case 24: qtrle_decode_24bpp(s, stream_ptr, row_ptr, height); break; case 32: qtrle_decode_32bpp(s, stream_ptr, row_ptr, height); break; default: av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n", avctx->bits_per_coded_sample); break; } if(has_palette) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame.palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); } done: *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; return buf_size; }
{ "code": [ " const uint8_t *buf = avpkt->data;", " int buf_size = avpkt->size;", " int stream_ptr, height, row_ptr;", " s->buf = buf;", " s->size = buf_size;", " if (s->size < 8)", " stream_ptr = 4;", " header = AV_RB16(&s->buf[stream_ptr]);", " stream_ptr += 2;", " if(s->size < 14)", " start_line = AV_RB16(&s->buf[stream_ptr]);", " stream_ptr += 4;", " height = AV_RB16(&s->buf[stream_ptr]);", " stream_ptr += 4;", " height = s->avctx->height;", " qtrle_decode_1bpp(s, stream_ptr, row_ptr, height);", " qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 2);", " qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 4);", " qtrle_decode_8bpp(s, stream_ptr, row_ptr, height);", " qtrle_decode_16bpp(s, stream_ptr, row_ptr, height);", " qtrle_decode_24bpp(s, stream_ptr, row_ptr, height);", " qtrle_decode_32bpp(s, stream_ptr, row_ptr, height);", " return buf_size;" ], "line_no": [ 9, 11, 17, 23, 25, 47, 55, 61, 63, 71, 75, 77, 79, 77, 87, 101, 111, 123, 135, 145, 153, 161, 213 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; QtrleContext *s = VAR_0->priv_data; int VAR_6, VAR_7; int VAR_8, VAR_9, VAR_10; int VAR_11 = 0; s->VAR_4 = VAR_4; s->size = VAR_5; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE; if (VAR_0->reget_buffer(VAR_0, &s->frame)) { av_log (s->VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } if (s->size < 8) goto done; VAR_8 = 4; VAR_6 = AV_RB16(&s->VAR_4[VAR_8]); VAR_8 += 2; if (VAR_6 & 0x0008) { if(s->size < 14) goto done; VAR_7 = AV_RB16(&s->VAR_4[VAR_8]); VAR_8 += 4; VAR_9 = AV_RB16(&s->VAR_4[VAR_8]); VAR_8 += 4; } else { VAR_7 = 0; VAR_9 = s->VAR_0->VAR_9; } VAR_10 = s->frame.linesize[0] * VAR_7; switch (VAR_0->bits_per_coded_sample) { case 1: case 33: qtrle_decode_1bpp(s, VAR_8, VAR_10, VAR_9); break; case 2: case 34: qtrle_decode_2n4bpp(s, VAR_8, VAR_10, VAR_9, 2); VAR_11 = 1; break; case 4: case 36: qtrle_decode_2n4bpp(s, VAR_8, VAR_10, VAR_9, 4); VAR_11 = 1; break; case 8: case 40: qtrle_decode_8bpp(s, VAR_8, VAR_10, VAR_9); VAR_11 = 1; break; case 16: qtrle_decode_16bpp(s, VAR_8, VAR_10, VAR_9); break; case 24: qtrle_decode_24bpp(s, VAR_8, VAR_10, VAR_9); break; case 32: qtrle_decode_32bpp(s, VAR_8, VAR_10, VAR_9); break; default: av_log (s->VAR_0, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n", VAR_0->bits_per_coded_sample); break; } if(VAR_11) { const uint8_t *VAR_12 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL); if (VAR_12) { s->frame.palette_has_changed = 1; memcpy(s->VAR_12, VAR_12, AVPALETTE_SIZE); } memcpy(s->frame.VAR_1[1], s->VAR_12, AVPALETTE_SIZE); } done: *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = s->frame; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "QtrleContext *s = VAR_0->priv_data;", "int VAR_6, VAR_7;", "int VAR_8, VAR_9, VAR_10;", "int VAR_11 = 0;", "s->VAR_4 = VAR_4;", "s->size = VAR_5;", "s->frame.reference = 1;", "s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |\nFF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;", "if (VAR_0->reget_buffer(VAR_0, &s->frame)) {", "av_log (s->VAR_0, AV_LOG_ERROR, \"reget_buffer() failed\\n\");", "return -1;", "}", "if (s->size < 8)\ngoto done;", "VAR_8 = 4;", "VAR_6 = AV_RB16(&s->VAR_4[VAR_8]);", "VAR_8 += 2;", "if (VAR_6 & 0x0008) {", "if(s->size < 14)\ngoto done;", "VAR_7 = AV_RB16(&s->VAR_4[VAR_8]);", "VAR_8 += 4;", "VAR_9 = AV_RB16(&s->VAR_4[VAR_8]);", "VAR_8 += 4;", "} else {", "VAR_7 = 0;", "VAR_9 = s->VAR_0->VAR_9;", "}", "VAR_10 = s->frame.linesize[0] * VAR_7;", "switch (VAR_0->bits_per_coded_sample) {", "case 1:\ncase 33:\nqtrle_decode_1bpp(s, VAR_8, VAR_10, VAR_9);", "break;", "case 2:\ncase 34:\nqtrle_decode_2n4bpp(s, VAR_8, VAR_10, VAR_9, 2);", "VAR_11 = 1;", "break;", "case 4:\ncase 36:\nqtrle_decode_2n4bpp(s, VAR_8, VAR_10, VAR_9, 4);", "VAR_11 = 1;", "break;", "case 8:\ncase 40:\nqtrle_decode_8bpp(s, VAR_8, VAR_10, VAR_9);", "VAR_11 = 1;", "break;", "case 16:\nqtrle_decode_16bpp(s, VAR_8, VAR_10, VAR_9);", "break;", "case 24:\nqtrle_decode_24bpp(s, VAR_8, VAR_10, VAR_9);", "break;", "case 32:\nqtrle_decode_32bpp(s, VAR_8, VAR_10, VAR_9);", "break;", "default:\nav_log (s->VAR_0, AV_LOG_ERROR, \"Unsupported colorspace: %d bits/sample?\\n\",\nVAR_0->bits_per_coded_sample);", "break;", "}", "if(VAR_11) {", "const uint8_t *VAR_12 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL);", "if (VAR_12) {", "s->frame.palette_has_changed = 1;", "memcpy(s->VAR_12, VAR_12, AVPALETTE_SIZE);", "}", "memcpy(s->frame.VAR_1[1], s->VAR_12, AVPALETTE_SIZE);", "}", "done:\n*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = s->frame;", "return VAR_5;", "}" ]
[ 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47, 49 ], [ 55 ], [ 61 ], [ 63 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99, 101 ], [ 103 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 119, 121, 123 ], [ 125 ], [ 127 ], [ 131, 133, 135 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 159, 161 ], [ 163 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 197 ], [ 199 ], [ 203, 205 ], [ 207 ], [ 213 ], [ 215 ] ]
11,059
static void cabac_init_decoder(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; skip_bits(gb, 1); align_get_bits(gb); ff_init_cabac_decoder(&s->HEVClc->cc, gb->buffer + get_bits_count(gb) / 8, (get_bits_left(gb) + 7) / 8); }
true
FFmpeg
933aa91e31d5cbf9dbc0cf416a988e6011bc4a40
static void cabac_init_decoder(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; skip_bits(gb, 1); align_get_bits(gb); ff_init_cabac_decoder(&s->HEVClc->cc, gb->buffer + get_bits_count(gb) / 8, (get_bits_left(gb) + 7) / 8); }
{ "code": [ "static void cabac_init_decoder(HEVCContext *s)", " ff_init_cabac_decoder(&s->HEVClc->cc," ], "line_no": [ 1, 11 ] }
static void FUNC_0(HEVCContext *VAR_0) { GetBitContext *gb = &VAR_0->HEVClc->gb; skip_bits(gb, 1); align_get_bits(gb); ff_init_cabac_decoder(&VAR_0->HEVClc->cc, gb->buffer + get_bits_count(gb) / 8, (get_bits_left(gb) + 7) / 8); }
[ "static void FUNC_0(HEVCContext *VAR_0)\n{", "GetBitContext *gb = &VAR_0->HEVClc->gb;", "skip_bits(gb, 1);", "align_get_bits(gb);", "ff_init_cabac_decoder(&VAR_0->HEVClc->cc,\ngb->buffer + get_bits_count(gb) / 8,\n(get_bits_left(gb) + 7) / 8);", "}" ]
[ 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17 ] ]
11,060
static void swap_sample_fmts_on_filter(AVFilterContext *filter) { AVFilterLink *link = NULL; int format, bps; int i, j; for (i = 0; i < filter->nb_inputs; i++) { link = filter->inputs[i]; if (link->type == AVMEDIA_TYPE_AUDIO && link->out_formats->format_count == 1) break; } if (i == filter->nb_inputs) return; format = link->out_formats->formats[0]; bps = av_get_bytes_per_sample(format); for (i = 0; i < filter->nb_outputs; i++) { AVFilterLink *outlink = filter->outputs[i]; int best_idx, best_score = INT_MIN; if (outlink->type != AVMEDIA_TYPE_AUDIO || outlink->in_formats->format_count < 2) continue; for (j = 0; j < outlink->in_formats->format_count; j++) { int out_format = outlink->in_formats->formats[j]; int out_bps = av_get_bytes_per_sample(out_format); int score; if (av_get_packed_sample_fmt(out_format) == format || av_get_planar_sample_fmt(out_format) == format) { best_idx = j; break; } /* for s32 and float prefer double to prevent loss of information */ if (bps == 4 && out_bps == 8) { best_idx = j; break; } /* prefer closest higher or equal bps */ score = -abs(out_bps - bps); if (out_bps >= bps) score += INT_MAX/2; if (score > best_score) { best_score = score; best_idx = j; } } FFSWAP(int, outlink->in_formats->formats[0], outlink->in_formats->formats[best_idx]); } }
true
FFmpeg
61d158c321a82ec7bfc46ce480997797e8048b85
static void swap_sample_fmts_on_filter(AVFilterContext *filter) { AVFilterLink *link = NULL; int format, bps; int i, j; for (i = 0; i < filter->nb_inputs; i++) { link = filter->inputs[i]; if (link->type == AVMEDIA_TYPE_AUDIO && link->out_formats->format_count == 1) break; } if (i == filter->nb_inputs) return; format = link->out_formats->formats[0]; bps = av_get_bytes_per_sample(format); for (i = 0; i < filter->nb_outputs; i++) { AVFilterLink *outlink = filter->outputs[i]; int best_idx, best_score = INT_MIN; if (outlink->type != AVMEDIA_TYPE_AUDIO || outlink->in_formats->format_count < 2) continue; for (j = 0; j < outlink->in_formats->format_count; j++) { int out_format = outlink->in_formats->formats[j]; int out_bps = av_get_bytes_per_sample(out_format); int score; if (av_get_packed_sample_fmt(out_format) == format || av_get_planar_sample_fmt(out_format) == format) { best_idx = j; break; } if (bps == 4 && out_bps == 8) { best_idx = j; break; } score = -abs(out_bps - bps); if (out_bps >= bps) score += INT_MAX/2; if (score > best_score) { best_score = score; best_idx = j; } } FFSWAP(int, outlink->in_formats->formats[0], outlink->in_formats->formats[best_idx]); } }
{ "code": [ " int best_idx, best_score = INT_MIN;" ], "line_no": [ 43 ] }
static void FUNC_0(AVFilterContext *VAR_0) { AVFilterLink *link = NULL; int VAR_1, VAR_2; int VAR_3, VAR_4; for (VAR_3 = 0; VAR_3 < VAR_0->nb_inputs; VAR_3++) { link = VAR_0->inputs[VAR_3]; if (link->type == AVMEDIA_TYPE_AUDIO && link->out_formats->format_count == 1) break; } if (VAR_3 == VAR_0->nb_inputs) return; VAR_1 = link->out_formats->formats[0]; VAR_2 = av_get_bytes_per_sample(VAR_1); for (VAR_3 = 0; VAR_3 < VAR_0->nb_outputs; VAR_3++) { AVFilterLink *outlink = VAR_0->outputs[VAR_3]; int best_idx, best_score = INT_MIN; if (outlink->type != AVMEDIA_TYPE_AUDIO || outlink->in_formats->format_count < 2) continue; for (VAR_4 = 0; VAR_4 < outlink->in_formats->format_count; VAR_4++) { int out_format = outlink->in_formats->formats[VAR_4]; int out_bps = av_get_bytes_per_sample(out_format); int score; if (av_get_packed_sample_fmt(out_format) == VAR_1 || av_get_planar_sample_fmt(out_format) == VAR_1) { best_idx = VAR_4; break; } if (VAR_2 == 4 && out_bps == 8) { best_idx = VAR_4; break; } score = -abs(out_bps - VAR_2); if (out_bps >= VAR_2) score += INT_MAX/2; if (score > best_score) { best_score = score; best_idx = VAR_4; } } FFSWAP(int, outlink->in_formats->formats[0], outlink->in_formats->formats[best_idx]); } }
[ "static void FUNC_0(AVFilterContext *VAR_0)\n{", "AVFilterLink *link = NULL;", "int VAR_1, VAR_2;", "int VAR_3, VAR_4;", "for (VAR_3 = 0; VAR_3 < VAR_0->nb_inputs; VAR_3++) {", "link = VAR_0->inputs[VAR_3];", "if (link->type == AVMEDIA_TYPE_AUDIO &&\nlink->out_formats->format_count == 1)\nbreak;", "}", "if (VAR_3 == VAR_0->nb_inputs)\nreturn;", "VAR_1 = link->out_formats->formats[0];", "VAR_2 = av_get_bytes_per_sample(VAR_1);", "for (VAR_3 = 0; VAR_3 < VAR_0->nb_outputs; VAR_3++) {", "AVFilterLink *outlink = VAR_0->outputs[VAR_3];", "int best_idx, best_score = INT_MIN;", "if (outlink->type != AVMEDIA_TYPE_AUDIO ||\noutlink->in_formats->format_count < 2)\ncontinue;", "for (VAR_4 = 0; VAR_4 < outlink->in_formats->format_count; VAR_4++) {", "int out_format = outlink->in_formats->formats[VAR_4];", "int out_bps = av_get_bytes_per_sample(out_format);", "int score;", "if (av_get_packed_sample_fmt(out_format) == VAR_1 ||\nav_get_planar_sample_fmt(out_format) == VAR_1) {", "best_idx = VAR_4;", "break;", "}", "if (VAR_2 == 4 && out_bps == 8) {", "best_idx = VAR_4;", "break;", "}", "score = -abs(out_bps - VAR_2);", "if (out_bps >= VAR_2)\nscore += INT_MAX/2;", "if (score > best_score) {", "best_score = score;", "best_idx = VAR_4;", "}", "}", "FFSWAP(int, outlink->in_formats->formats[0],\noutlink->in_formats->formats[best_idx]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19, 21, 23 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ] ]
11,061
int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top, BlockDriverState *base, const char *backing_file_str) { BlockDriverState *intermediate; BlockDriverState *base_bs = NULL; BlockDriverState *new_top_bs = NULL; BlkIntermediateStates *intermediate_state, *next; int ret = -EIO; QSIMPLEQ_HEAD(states_to_delete, BlkIntermediateStates) states_to_delete; QSIMPLEQ_INIT(&states_to_delete); if (!top->drv || !base->drv) { goto exit; } new_top_bs = bdrv_find_overlay(active, top); if (new_top_bs == NULL) { /* we could not find the image above 'top', this is an error */ goto exit; } /* special case of new_top_bs->backing_hd already pointing to base - nothing * to do, no intermediate images */ if (new_top_bs->backing_hd == base) { ret = 0; goto exit; } intermediate = top; /* now we will go down through the list, and add each BDS we find * into our deletion queue, until we hit the 'base' */ while (intermediate) { intermediate_state = g_malloc0(sizeof(BlkIntermediateStates)); intermediate_state->bs = intermediate; QSIMPLEQ_INSERT_TAIL(&states_to_delete, intermediate_state, entry); if (intermediate->backing_hd == base) { base_bs = intermediate->backing_hd; break; } intermediate = intermediate->backing_hd; } if (base_bs == NULL) { /* something went wrong, we did not end at the base. safely * unravel everything, and exit with error */ goto exit; } /* success - we can delete the intermediate states, and link top->base */ backing_file_str = backing_file_str ? backing_file_str : base_bs->filename; ret = bdrv_change_backing_file(new_top_bs, backing_file_str, base_bs->drv ? base_bs->drv->format_name : ""); if (ret) { goto exit; } bdrv_set_backing_hd(new_top_bs, base_bs); QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) { /* so that bdrv_close() does not recursively close the chain */ bdrv_set_backing_hd(intermediate_state->bs, NULL); bdrv_unref(intermediate_state->bs); } ret = 0; exit: QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) { g_free(intermediate_state); } return ret; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top, BlockDriverState *base, const char *backing_file_str) { BlockDriverState *intermediate; BlockDriverState *base_bs = NULL; BlockDriverState *new_top_bs = NULL; BlkIntermediateStates *intermediate_state, *next; int ret = -EIO; QSIMPLEQ_HEAD(states_to_delete, BlkIntermediateStates) states_to_delete; QSIMPLEQ_INIT(&states_to_delete); if (!top->drv || !base->drv) { goto exit; } new_top_bs = bdrv_find_overlay(active, top); if (new_top_bs == NULL) { goto exit; } if (new_top_bs->backing_hd == base) { ret = 0; goto exit; } intermediate = top; while (intermediate) { intermediate_state = g_malloc0(sizeof(BlkIntermediateStates)); intermediate_state->bs = intermediate; QSIMPLEQ_INSERT_TAIL(&states_to_delete, intermediate_state, entry); if (intermediate->backing_hd == base) { base_bs = intermediate->backing_hd; break; } intermediate = intermediate->backing_hd; } if (base_bs == NULL) { goto exit; } backing_file_str = backing_file_str ? backing_file_str : base_bs->filename; ret = bdrv_change_backing_file(new_top_bs, backing_file_str, base_bs->drv ? base_bs->drv->format_name : ""); if (ret) { goto exit; } bdrv_set_backing_hd(new_top_bs, base_bs); QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) { bdrv_set_backing_hd(intermediate_state->bs, NULL); bdrv_unref(intermediate_state->bs); } ret = 0; exit: QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) { g_free(intermediate_state); } return ret; }
{ "code": [ " intermediate_state = g_malloc0(sizeof(BlkIntermediateStates));" ], "line_no": [ 73 ] }
int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, BlockDriverState *VAR_2, const char *VAR_3) { BlockDriverState *intermediate; BlockDriverState *base_bs = NULL; BlockDriverState *new_top_bs = NULL; BlkIntermediateStates *intermediate_state, *next; int VAR_4 = -EIO; QSIMPLEQ_HEAD(states_to_delete, BlkIntermediateStates) states_to_delete; QSIMPLEQ_INIT(&states_to_delete); if (!VAR_1->drv || !VAR_2->drv) { goto exit; } new_top_bs = bdrv_find_overlay(VAR_0, VAR_1); if (new_top_bs == NULL) { goto exit; } if (new_top_bs->backing_hd == VAR_2) { VAR_4 = 0; goto exit; } intermediate = VAR_1; while (intermediate) { intermediate_state = g_malloc0(sizeof(BlkIntermediateStates)); intermediate_state->bs = intermediate; QSIMPLEQ_INSERT_TAIL(&states_to_delete, intermediate_state, entry); if (intermediate->backing_hd == VAR_2) { base_bs = intermediate->backing_hd; break; } intermediate = intermediate->backing_hd; } if (base_bs == NULL) { goto exit; } VAR_3 = VAR_3 ? VAR_3 : base_bs->filename; VAR_4 = bdrv_change_backing_file(new_top_bs, VAR_3, base_bs->drv ? base_bs->drv->format_name : ""); if (VAR_4) { goto exit; } bdrv_set_backing_hd(new_top_bs, base_bs); QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) { bdrv_set_backing_hd(intermediate_state->bs, NULL); bdrv_unref(intermediate_state->bs); } VAR_4 = 0; exit: QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) { g_free(intermediate_state); } return VAR_4; }
[ "int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,\nBlockDriverState *VAR_2, const char *VAR_3)\n{", "BlockDriverState *intermediate;", "BlockDriverState *base_bs = NULL;", "BlockDriverState *new_top_bs = NULL;", "BlkIntermediateStates *intermediate_state, *next;", "int VAR_4 = -EIO;", "QSIMPLEQ_HEAD(states_to_delete, BlkIntermediateStates) states_to_delete;", "QSIMPLEQ_INIT(&states_to_delete);", "if (!VAR_1->drv || !VAR_2->drv) {", "goto exit;", "}", "new_top_bs = bdrv_find_overlay(VAR_0, VAR_1);", "if (new_top_bs == NULL) {", "goto exit;", "}", "if (new_top_bs->backing_hd == VAR_2) {", "VAR_4 = 0;", "goto exit;", "}", "intermediate = VAR_1;", "while (intermediate) {", "intermediate_state = g_malloc0(sizeof(BlkIntermediateStates));", "intermediate_state->bs = intermediate;", "QSIMPLEQ_INSERT_TAIL(&states_to_delete, intermediate_state, entry);", "if (intermediate->backing_hd == VAR_2) {", "base_bs = intermediate->backing_hd;", "break;", "}", "intermediate = intermediate->backing_hd;", "}", "if (base_bs == NULL) {", "goto exit;", "}", "VAR_3 = VAR_3 ? VAR_3 : base_bs->filename;", "VAR_4 = bdrv_change_backing_file(new_top_bs, VAR_3,\nbase_bs->drv ? base_bs->drv->format_name : \"\");", "if (VAR_4) {", "goto exit;", "}", "bdrv_set_backing_hd(new_top_bs, base_bs);", "QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) {", "bdrv_set_backing_hd(intermediate_state->bs, NULL);", "bdrv_unref(intermediate_state->bs);", "}", "VAR_4 = 0;", "exit:\nQSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) {", "g_free(intermediate_state);", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ] ]
11,062
static int smacker_decode_bigtree(BitstreamContext *bc, HuffContext *hc, DBCtx *ctx) { if (hc->current + 1 >= hc->length) { av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n"); return AVERROR_INVALIDDATA; } if (!bitstream_read_bit(bc)) { // Leaf int val, i1, i2; i1 = ctx->v1->table ? bitstream_read_vlc(bc, ctx->v1->table, SMKTREE_BITS, 3) : 0; i2 = ctx->v2->table ? bitstream_read_vlc(bc, ctx->v2->table, SMKTREE_BITS, 3) : 0; if (i1 < 0 || i2 < 0) return AVERROR_INVALIDDATA; val = ctx->recode1[i1] | (ctx->recode2[i2] << 8); if(val == ctx->escapes[0]) { ctx->last[0] = hc->current; val = 0; } else if(val == ctx->escapes[1]) { ctx->last[1] = hc->current; val = 0; } else if(val == ctx->escapes[2]) { ctx->last[2] = hc->current; val = 0; } hc->values[hc->current++] = val; return 1; } else { //Node int r = 0, r_new, t; t = hc->current++; r = smacker_decode_bigtree(bc, hc, ctx); if(r < 0) return r; hc->values[t] = SMK_NODE | r; r++; r_new = smacker_decode_bigtree(bc, hc, ctx); if (r_new < 0) return r_new; return r + r_new; } }
true
FFmpeg
0ccddbad200c1d9439c5a836501917d515cddf76
static int smacker_decode_bigtree(BitstreamContext *bc, HuffContext *hc, DBCtx *ctx) { if (hc->current + 1 >= hc->length) { av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n"); return AVERROR_INVALIDDATA; } if (!bitstream_read_bit(bc)) { int val, i1, i2; i1 = ctx->v1->table ? bitstream_read_vlc(bc, ctx->v1->table, SMKTREE_BITS, 3) : 0; i2 = ctx->v2->table ? bitstream_read_vlc(bc, ctx->v2->table, SMKTREE_BITS, 3) : 0; if (i1 < 0 || i2 < 0) return AVERROR_INVALIDDATA; val = ctx->recode1[i1] | (ctx->recode2[i2] << 8); if(val == ctx->escapes[0]) { ctx->last[0] = hc->current; val = 0; } else if(val == ctx->escapes[1]) { ctx->last[1] = hc->current; val = 0; } else if(val == ctx->escapes[2]) { ctx->last[2] = hc->current; val = 0; } hc->values[hc->current++] = val; return 1; } else { int r = 0, r_new, t; t = hc->current++; r = smacker_decode_bigtree(bc, hc, ctx); if(r < 0) return r; hc->values[t] = SMK_NODE | r; r++; r_new = smacker_decode_bigtree(bc, hc, ctx); if (r_new < 0) return r_new; return r + r_new; } }
{ "code": [ " DBCtx *ctx)", " r = smacker_decode_bigtree(bc, hc, ctx);", " r_new = smacker_decode_bigtree(bc, hc, ctx);" ], "line_no": [ 3, 63, 73 ] }
static int FUNC_0(BitstreamContext *VAR_0, HuffContext *VAR_1, DBCtx *VAR_2) { if (VAR_1->current + 1 >= VAR_1->length) { av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n"); return AVERROR_INVALIDDATA; } if (!bitstream_read_bit(VAR_0)) { int VAR_3, VAR_4, VAR_5; VAR_4 = VAR_2->v1->table ? bitstream_read_vlc(VAR_0, VAR_2->v1->table, SMKTREE_BITS, 3) : 0; VAR_5 = VAR_2->v2->table ? bitstream_read_vlc(VAR_0, VAR_2->v2->table, SMKTREE_BITS, 3) : 0; if (VAR_4 < 0 || VAR_5 < 0) return AVERROR_INVALIDDATA; VAR_3 = VAR_2->recode1[VAR_4] | (VAR_2->recode2[VAR_5] << 8); if(VAR_3 == VAR_2->escapes[0]) { VAR_2->last[0] = VAR_1->current; VAR_3 = 0; } else if(VAR_3 == VAR_2->escapes[1]) { VAR_2->last[1] = VAR_1->current; VAR_3 = 0; } else if(VAR_3 == VAR_2->escapes[2]) { VAR_2->last[2] = VAR_1->current; VAR_3 = 0; } VAR_1->values[VAR_1->current++] = VAR_3; return 1; } else { int VAR_6 = 0, VAR_7, VAR_8; VAR_8 = VAR_1->current++; VAR_6 = FUNC_0(VAR_0, VAR_1, VAR_2); if(VAR_6 < 0) return VAR_6; VAR_1->values[VAR_8] = SMK_NODE | VAR_6; VAR_6++; VAR_7 = FUNC_0(VAR_0, VAR_1, VAR_2); if (VAR_7 < 0) return VAR_7; return VAR_6 + VAR_7; } }
[ "static int FUNC_0(BitstreamContext *VAR_0, HuffContext *VAR_1,\nDBCtx *VAR_2)\n{", "if (VAR_1->current + 1 >= VAR_1->length) {", "av_log(NULL, AV_LOG_ERROR, \"Tree size exceeded!\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (!bitstream_read_bit(VAR_0)) {", "int VAR_3, VAR_4, VAR_5;", "VAR_4 = VAR_2->v1->table ? bitstream_read_vlc(VAR_0, VAR_2->v1->table, SMKTREE_BITS, 3) : 0;", "VAR_5 = VAR_2->v2->table ? bitstream_read_vlc(VAR_0, VAR_2->v2->table, SMKTREE_BITS, 3) : 0;", "if (VAR_4 < 0 || VAR_5 < 0)\nreturn AVERROR_INVALIDDATA;", "VAR_3 = VAR_2->recode1[VAR_4] | (VAR_2->recode2[VAR_5] << 8);", "if(VAR_3 == VAR_2->escapes[0]) {", "VAR_2->last[0] = VAR_1->current;", "VAR_3 = 0;", "} else if(VAR_3 == VAR_2->escapes[1]) {", "VAR_2->last[1] = VAR_1->current;", "VAR_3 = 0;", "} else if(VAR_3 == VAR_2->escapes[2]) {", "VAR_2->last[2] = VAR_1->current;", "VAR_3 = 0;", "}", "VAR_1->values[VAR_1->current++] = VAR_3;", "return 1;", "} else {", "int VAR_6 = 0, VAR_7, VAR_8;", "VAR_8 = VAR_1->current++;", "VAR_6 = FUNC_0(VAR_0, VAR_1, VAR_2);", "if(VAR_6 < 0)\nreturn VAR_6;", "VAR_1->values[VAR_8] = SMK_NODE | VAR_6;", "VAR_6++;", "VAR_7 = FUNC_0(VAR_0, VAR_1, VAR_2);", "if (VAR_7 < 0)\nreturn VAR_7;", "return VAR_6 + VAR_7;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ] ]
11,063
static av_cold int qtrle_encode_end(AVCodecContext *avctx) { QtrleEncContext *s = avctx->priv_data; av_frame_free(&avctx->coded_frame); avpicture_free(&s->previous_frame); av_free(s->rlecode_table); av_free(s->length_table); av_free(s->skip_table); return 0; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int qtrle_encode_end(AVCodecContext *avctx) { QtrleEncContext *s = avctx->priv_data; av_frame_free(&avctx->coded_frame); avpicture_free(&s->previous_frame); av_free(s->rlecode_table); av_free(s->length_table); av_free(s->skip_table); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { QtrleEncContext *s = avctx->priv_data; av_frame_free(&avctx->coded_frame); avpicture_free(&s->previous_frame); av_free(s->rlecode_table); av_free(s->length_table); av_free(s->skip_table); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "QtrleEncContext *s = avctx->priv_data;", "av_frame_free(&avctx->coded_frame);", "avpicture_free(&s->previous_frame);", "av_free(s->rlecode_table);", "av_free(s->length_table);", "av_free(s->skip_table);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
11,064
static av_cold int pcx_encode_init(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->key_frame = 1; return 0; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int pcx_encode_init(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->key_frame = 1; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->key_frame = 1; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "avctx->coded_frame = av_frame_alloc();", "if (!avctx->coded_frame)\nreturn AVERROR(ENOMEM);", "avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;", "avctx->coded_frame->key_frame = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
11,065
static int decode_mb_info(IVI4DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx) { int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb, mv_scale, mb_type_bits; IVIMbInfo *mb, *ref_mb; int row_offset = band->mb_size * band->pitch; mb = tile->mbs; ref_mb = tile->ref_mbs; offs = tile->ypos * band->pitch + tile->xpos; blks_per_mb = band->mb_size != band->blk_size ? 4 : 1; mb_type_bits = ctx->frame_type == FRAMETYPE_BIDIR ? 2 : 1; /* scale factor for motion vectors */ mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3); mv_x = mv_y = 0; for (y = tile->ypos; y < tile->ypos + tile->height; y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < tile->xpos + tile->width; x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; if (get_bits1(&ctx->gb)) { if (ctx->frame_type == FRAMETYPE_INTRA) { av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return AVERROR_INVALIDDATA; } mb->type = 1; /* empty macroblocks are always INTER */ mb->cbp = 0; /* all blocks are empty */ mb->q_delta = 0; if (!band->plane && !band->band_num && ctx->in_q) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->mv_x = mb->mv_y = 0; /* no motion vector coded */ if (band->inherit_mv) { /* motion vector inheritance */ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } } else { if (band->inherit_mv) { mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */ } else if (ctx->frame_type == FRAMETYPE_INTRA) { mb->type = 0; /* mb_type is always INTRA for intra-frames */ } else { mb->type = get_bits(&ctx->gb, mb_type_bits); } mb->cbp = get_bits(&ctx->gb, blks_per_mb); mb->q_delta = 0; if (band->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!band->plane && !band->band_num && ctx->in_q)) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } if (!mb->type) { mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */ } else { if (band->inherit_mv) { /* motion vector inheritance */ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } else { /* decode motion vector deltas */ mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_y += IVI_TOSIGNED(mv_delta); mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_x += IVI_TOSIGNED(mv_delta); mb->mv_x = mv_x; mb->mv_y = mv_y; } } } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } align_get_bits(&ctx->gb); return 0; }
false
FFmpeg
9759d2b886057b90355716edb23262e17f9bc3f9
static int decode_mb_info(IVI4DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx) { int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb, mv_scale, mb_type_bits; IVIMbInfo *mb, *ref_mb; int row_offset = band->mb_size * band->pitch; mb = tile->mbs; ref_mb = tile->ref_mbs; offs = tile->ypos * band->pitch + tile->xpos; blks_per_mb = band->mb_size != band->blk_size ? 4 : 1; mb_type_bits = ctx->frame_type == FRAMETYPE_BIDIR ? 2 : 1; mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3); mv_x = mv_y = 0; for (y = tile->ypos; y < tile->ypos + tile->height; y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < tile->xpos + tile->width; x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; if (get_bits1(&ctx->gb)) { if (ctx->frame_type == FRAMETYPE_INTRA) { av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return AVERROR_INVALIDDATA; } mb->type = 1; mb->cbp = 0; mb->q_delta = 0; if (!band->plane && !band->band_num && ctx->in_q) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->mv_x = mb->mv_y = 0; if (band->inherit_mv) { if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } } else { if (band->inherit_mv) { mb->type = ref_mb->type; } else if (ctx->frame_type == FRAMETYPE_INTRA) { mb->type = 0; } else { mb->type = get_bits(&ctx->gb, mb_type_bits); } mb->cbp = get_bits(&ctx->gb, blks_per_mb); mb->q_delta = 0; if (band->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!band->plane && !band->band_num && ctx->in_q)) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } if (!mb->type) { mb->mv_x = mb->mv_y = 0; } else { if (band->inherit_mv) { if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } else { mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_y += IVI_TOSIGNED(mv_delta); mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_x += IVI_TOSIGNED(mv_delta); mb->mv_x = mv_x; mb->mv_y = mv_y; } } } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } align_get_bits(&ctx->gb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(IVI4DecContext *VAR_0, IVIBandDesc *VAR_1, IVITile *VAR_2, AVCodecContext *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; IVIMbInfo *mb, *ref_mb; int VAR_14 = VAR_1->mb_size * VAR_1->pitch; mb = VAR_2->mbs; ref_mb = VAR_2->ref_mbs; VAR_9 = VAR_2->ypos * VAR_1->pitch + VAR_2->xpos; VAR_11 = VAR_1->mb_size != VAR_1->blk_size ? 4 : 1; VAR_13 = VAR_0->frame_type == FRAMETYPE_BIDIR ? 2 : 1; VAR_12 = (VAR_0->planes[0].bands[0].mb_size >> 3) - (VAR_1->mb_size >> 3); VAR_6 = VAR_7 = 0; for (VAR_5 = VAR_2->ypos; VAR_5 < VAR_2->ypos + VAR_2->height; VAR_5 += VAR_1->mb_size) { VAR_10 = VAR_9; for (VAR_4 = VAR_2->xpos; VAR_4 < VAR_2->xpos + VAR_2->width; VAR_4 += VAR_1->mb_size) { mb->xpos = VAR_4; mb->ypos = VAR_5; mb->buf_offs = VAR_10; if (get_bits1(&VAR_0->gb)) { if (VAR_0->frame_type == FRAMETYPE_INTRA) { av_log(VAR_3, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return AVERROR_INVALIDDATA; } mb->type = 1; mb->cbp = 0; mb->q_delta = 0; if (!VAR_1->plane && !VAR_1->band_num && VAR_0->in_q) { mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->VAR_6 = mb->VAR_7 = 0; if (VAR_1->inherit_mv) { if (VAR_12) { mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_12); mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_12); } else { mb->VAR_6 = ref_mb->VAR_6; mb->VAR_7 = ref_mb->VAR_7; } } } else { if (VAR_1->inherit_mv) { mb->type = ref_mb->type; } else if (VAR_0->frame_type == FRAMETYPE_INTRA) { mb->type = 0; } else { mb->type = get_bits(&VAR_0->gb, VAR_13); } mb->cbp = get_bits(&VAR_0->gb, VAR_11); mb->q_delta = 0; if (VAR_1->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!VAR_1->plane && !VAR_1->band_num && VAR_0->in_q)) { mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } if (!mb->type) { mb->VAR_6 = mb->VAR_7 = 0; } else { if (VAR_1->inherit_mv) { if (VAR_12) { mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_12); mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_12); } else { mb->VAR_6 = ref_mb->VAR_6; mb->VAR_7 = ref_mb->VAR_7; } } else { VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); VAR_7 += IVI_TOSIGNED(VAR_8); VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); VAR_6 += IVI_TOSIGNED(VAR_8); mb->VAR_6 = VAR_6; mb->VAR_7 = VAR_7; } } } mb++; if (ref_mb) ref_mb++; VAR_10 += VAR_1->mb_size; } VAR_9 += VAR_14; } align_get_bits(&VAR_0->gb); return 0; }
[ "static int FUNC_0(IVI4DecContext *VAR_0, IVIBandDesc *VAR_1,\nIVITile *VAR_2, AVCodecContext *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11,\nVAR_12, VAR_13;", "IVIMbInfo *mb, *ref_mb;", "int VAR_14 = VAR_1->mb_size * VAR_1->pitch;", "mb = VAR_2->mbs;", "ref_mb = VAR_2->ref_mbs;", "VAR_9 = VAR_2->ypos * VAR_1->pitch + VAR_2->xpos;", "VAR_11 = VAR_1->mb_size != VAR_1->blk_size ? 4 : 1;", "VAR_13 = VAR_0->frame_type == FRAMETYPE_BIDIR ? 2 : 1;", "VAR_12 = (VAR_0->planes[0].bands[0].mb_size >> 3) - (VAR_1->mb_size >> 3);", "VAR_6 = VAR_7 = 0;", "for (VAR_5 = VAR_2->ypos; VAR_5 < VAR_2->ypos + VAR_2->height; VAR_5 += VAR_1->mb_size) {", "VAR_10 = VAR_9;", "for (VAR_4 = VAR_2->xpos; VAR_4 < VAR_2->xpos + VAR_2->width; VAR_4 += VAR_1->mb_size) {", "mb->xpos = VAR_4;", "mb->ypos = VAR_5;", "mb->buf_offs = VAR_10;", "if (get_bits1(&VAR_0->gb)) {", "if (VAR_0->frame_type == FRAMETYPE_INTRA) {", "av_log(VAR_3, AV_LOG_ERROR, \"Empty macroblock in an INTRA picture!\\n\");", "return AVERROR_INVALIDDATA;", "}", "mb->type = 1;", "mb->cbp = 0;", "mb->q_delta = 0;", "if (!VAR_1->plane && !VAR_1->band_num && VAR_0->in_q) {", "mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "mb->q_delta = IVI_TOSIGNED(mb->q_delta);", "}", "mb->VAR_6 = mb->VAR_7 = 0;", "if (VAR_1->inherit_mv) {", "if (VAR_12) {", "mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_12);", "mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_12);", "} else {", "mb->VAR_6 = ref_mb->VAR_6;", "mb->VAR_7 = ref_mb->VAR_7;", "}", "}", "} else {", "if (VAR_1->inherit_mv) {", "mb->type = ref_mb->type;", "} else if (VAR_0->frame_type == FRAMETYPE_INTRA) {", "mb->type = 0;", "} else {", "mb->type = get_bits(&VAR_0->gb, VAR_13);", "}", "mb->cbp = get_bits(&VAR_0->gb, VAR_11);", "mb->q_delta = 0;", "if (VAR_1->inherit_qdelta) {", "if (ref_mb) mb->q_delta = ref_mb->q_delta;", "} else if (mb->cbp || (!VAR_1->plane && !VAR_1->band_num &&", "VAR_0->in_q)) {", "mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "mb->q_delta = IVI_TOSIGNED(mb->q_delta);", "}", "if (!mb->type) {", "mb->VAR_6 = mb->VAR_7 = 0;", "} else {", "if (VAR_1->inherit_mv) {", "if (VAR_12) {", "mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_12);", "mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_12);", "} else {", "mb->VAR_6 = ref_mb->VAR_6;", "mb->VAR_7 = ref_mb->VAR_7;", "}", "} else {", "VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "VAR_7 += IVI_TOSIGNED(VAR_8);", "VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "VAR_6 += IVI_TOSIGNED(VAR_8);", "mb->VAR_6 = VAR_6;", "mb->VAR_7 = VAR_7;", "}", "}", "}", "mb++;", "if (ref_mb)\nref_mb++;", "VAR_10 += VAR_1->mb_size;", "}", "VAR_9 += VAR_14;", "}", "align_get_bits(&VAR_0->gb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177, 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 219 ], [ 223 ], [ 225 ] ]
11,067
static void hevc_parser_close(AVCodecParserContext *s) { HEVCParserContext *ctx = s->priv_data; int i; #if ADVANCED_PARSER HEVCContext *h = &ctx->h; for (i = 0; i < FF_ARRAY_ELEMS(h->ps.vps_list); i++) av_buffer_unref(&h->ps.vps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(h->ps.sps_list); i++) av_buffer_unref(&h->ps.sps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(h->ps.pps_list); i++) av_buffer_unref(&h->ps.pps_list[i]); h->ps.sps = NULL; av_freep(&h->HEVClc); #endif for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.vps_list); i++) av_buffer_unref(&ctx->ps.vps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.sps_list); i++) av_buffer_unref(&ctx->ps.sps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.pps_list); i++) av_buffer_unref(&ctx->ps.pps_list[i]); ctx->ps.sps = NULL; ff_h2645_packet_uninit(&ctx->pkt); av_freep(&ctx->pc.buffer); }
false
FFmpeg
1c088632e98af96f9cbe8129c5d7eb7274f8d4ed
static void hevc_parser_close(AVCodecParserContext *s) { HEVCParserContext *ctx = s->priv_data; int i; #if ADVANCED_PARSER HEVCContext *h = &ctx->h; for (i = 0; i < FF_ARRAY_ELEMS(h->ps.vps_list); i++) av_buffer_unref(&h->ps.vps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(h->ps.sps_list); i++) av_buffer_unref(&h->ps.sps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(h->ps.pps_list); i++) av_buffer_unref(&h->ps.pps_list[i]); h->ps.sps = NULL; av_freep(&h->HEVClc); #endif for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.vps_list); i++) av_buffer_unref(&ctx->ps.vps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.sps_list); i++) av_buffer_unref(&ctx->ps.sps_list[i]); for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.pps_list); i++) av_buffer_unref(&ctx->ps.pps_list[i]); ctx->ps.sps = NULL; ff_h2645_packet_uninit(&ctx->pkt); av_freep(&ctx->pc.buffer); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecParserContext *VAR_0) { HEVCParserContext *ctx = VAR_0->priv_data; int VAR_1; #if ADVANCED_PARSER HEVCContext *h = &ctx->h; for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(h->ps.vps_list); VAR_1++) av_buffer_unref(&h->ps.vps_list[VAR_1]); for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(h->ps.sps_list); VAR_1++) av_buffer_unref(&h->ps.sps_list[VAR_1]); for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(h->ps.pps_list); VAR_1++) av_buffer_unref(&h->ps.pps_list[VAR_1]); h->ps.sps = NULL; av_freep(&h->HEVClc); #endif for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(ctx->ps.vps_list); VAR_1++) av_buffer_unref(&ctx->ps.vps_list[VAR_1]); for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(ctx->ps.sps_list); VAR_1++) av_buffer_unref(&ctx->ps.sps_list[VAR_1]); for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(ctx->ps.pps_list); VAR_1++) av_buffer_unref(&ctx->ps.pps_list[VAR_1]); ctx->ps.sps = NULL; ff_h2645_packet_uninit(&ctx->pkt); av_freep(&ctx->pc.buffer); }
[ "static void FUNC_0(AVCodecParserContext *VAR_0)\n{", "HEVCParserContext *ctx = VAR_0->priv_data;", "int VAR_1;", "#if ADVANCED_PARSER\nHEVCContext *h = &ctx->h;", "for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(h->ps.vps_list); VAR_1++)", "av_buffer_unref(&h->ps.vps_list[VAR_1]);", "for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(h->ps.sps_list); VAR_1++)", "av_buffer_unref(&h->ps.sps_list[VAR_1]);", "for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(h->ps.pps_list); VAR_1++)", "av_buffer_unref(&h->ps.pps_list[VAR_1]);", "h->ps.sps = NULL;", "av_freep(&h->HEVClc);", "#endif\nfor (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(ctx->ps.vps_list); VAR_1++)", "av_buffer_unref(&ctx->ps.vps_list[VAR_1]);", "for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(ctx->ps.sps_list); VAR_1++)", "av_buffer_unref(&ctx->ps.sps_list[VAR_1]);", "for (VAR_1 = 0; VAR_1 < FF_ARRAY_ELEMS(ctx->ps.pps_list); VAR_1++)", "av_buffer_unref(&ctx->ps.pps_list[VAR_1]);", "ctx->ps.sps = NULL;", "ff_h2645_packet_uninit(&ctx->pkt);", "av_freep(&ctx->pc.buffer);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ] ]
11,068
static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt) { MvContext *mv = avctx->priv_data; AVIOContext *pb = avctx->pb; AVStream *st = avctx->streams[mv->stream_index]; const AVIndexEntry *index; int frame = mv->frame[mv->stream_index]; int ret; uint64_t pos; if (frame < st->nb_index_entries) { index = &st->index_entries[frame]; pos = avio_tell(pb); if (index->pos > pos) avio_skip(pb, index->pos - pos); else if (index->pos < pos) { if (!pb->seekable) return AVERROR(EIO); ret = avio_seek(pb, index->pos, SEEK_SET); if (ret < 0) return ret; } ret = av_get_packet(pb, pkt, index->size); if (ret < 0) return ret; pkt->stream_index = mv->stream_index; pkt->pts = index->timestamp; pkt->flags |= AV_PKT_FLAG_KEY; mv->frame[mv->stream_index]++; mv->eof_count = 0; } else { mv->eof_count++; if (mv->eof_count >= avctx->nb_streams) return AVERROR_EOF; // avoid returning 0 without a packet return AVERROR(EAGAIN); } mv->stream_index++; if (mv->stream_index >= avctx->nb_streams) mv->stream_index = 0; return 0; }
true
FFmpeg
26c0cc154e06cb0064b3a3da49447ac44d82444f
static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt) { MvContext *mv = avctx->priv_data; AVIOContext *pb = avctx->pb; AVStream *st = avctx->streams[mv->stream_index]; const AVIndexEntry *index; int frame = mv->frame[mv->stream_index]; int ret; uint64_t pos; if (frame < st->nb_index_entries) { index = &st->index_entries[frame]; pos = avio_tell(pb); if (index->pos > pos) avio_skip(pb, index->pos - pos); else if (index->pos < pos) { if (!pb->seekable) return AVERROR(EIO); ret = avio_seek(pb, index->pos, SEEK_SET); if (ret < 0) return ret; } ret = av_get_packet(pb, pkt, index->size); if (ret < 0) return ret; pkt->stream_index = mv->stream_index; pkt->pts = index->timestamp; pkt->flags |= AV_PKT_FLAG_KEY; mv->frame[mv->stream_index]++; mv->eof_count = 0; } else { mv->eof_count++; if (mv->eof_count >= avctx->nb_streams) return AVERROR_EOF; return AVERROR(EAGAIN); } mv->stream_index++; if (mv->stream_index >= avctx->nb_streams) mv->stream_index = 0; return 0; }
{ "code": [ " int ret;" ], "line_no": [ 15 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { MvContext *mv = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; AVStream *st = VAR_0->streams[mv->stream_index]; const AVIndexEntry *VAR_2; int VAR_3 = mv->VAR_3[mv->stream_index]; int VAR_4; uint64_t pos; if (VAR_3 < st->nb_index_entries) { VAR_2 = &st->index_entries[VAR_3]; pos = avio_tell(pb); if (VAR_2->pos > pos) avio_skip(pb, VAR_2->pos - pos); else if (VAR_2->pos < pos) { if (!pb->seekable) return AVERROR(EIO); VAR_4 = avio_seek(pb, VAR_2->pos, SEEK_SET); if (VAR_4 < 0) return VAR_4; } VAR_4 = av_get_packet(pb, VAR_1, VAR_2->size); if (VAR_4 < 0) return VAR_4; VAR_1->stream_index = mv->stream_index; VAR_1->pts = VAR_2->timestamp; VAR_1->flags |= AV_PKT_FLAG_KEY; mv->VAR_3[mv->stream_index]++; mv->eof_count = 0; } else { mv->eof_count++; if (mv->eof_count >= VAR_0->nb_streams) return AVERROR_EOF; return AVERROR(EAGAIN); } mv->stream_index++; if (mv->stream_index >= VAR_0->nb_streams) mv->stream_index = 0; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "MvContext *mv = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "AVStream *st = VAR_0->streams[mv->stream_index];", "const AVIndexEntry *VAR_2;", "int VAR_3 = mv->VAR_3[mv->stream_index];", "int VAR_4;", "uint64_t pos;", "if (VAR_3 < st->nb_index_entries) {", "VAR_2 = &st->index_entries[VAR_3];", "pos = avio_tell(pb);", "if (VAR_2->pos > pos)\navio_skip(pb, VAR_2->pos - pos);", "else if (VAR_2->pos < pos) {", "if (!pb->seekable)\nreturn AVERROR(EIO);", "VAR_4 = avio_seek(pb, VAR_2->pos, SEEK_SET);", "if (VAR_4 < 0)\nreturn VAR_4;", "}", "VAR_4 = av_get_packet(pb, VAR_1, VAR_2->size);", "if (VAR_4 < 0)\nreturn VAR_4;", "VAR_1->stream_index = mv->stream_index;", "VAR_1->pts = VAR_2->timestamp;", "VAR_1->flags |= AV_PKT_FLAG_KEY;", "mv->VAR_3[mv->stream_index]++;", "mv->eof_count = 0;", "} else {", "mv->eof_count++;", "if (mv->eof_count >= VAR_0->nb_streams)\nreturn AVERROR_EOF;", "return AVERROR(EAGAIN);", "}", "mv->stream_index++;", "if (mv->stream_index >= VAR_0->nb_streams)\nmv->stream_index = 0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 91 ], [ 93 ] ]
11,071
static av_cold int prores_encode_close(AVCodecContext *avctx) { ProresContext* ctx = avctx->priv_data; av_freep(&avctx->coded_frame); av_free(ctx->fill_y); av_free(ctx->fill_u); av_free(ctx->fill_v); return 0; }
true
FFmpeg
d9f4dc52a0fe3edb93f153cf13e750f7c46243d1
static av_cold int prores_encode_close(AVCodecContext *avctx) { ProresContext* ctx = avctx->priv_data; av_freep(&avctx->coded_frame); av_free(ctx->fill_y); av_free(ctx->fill_u); av_free(ctx->fill_v); return 0; }
{ "code": [ " av_free(ctx->fill_y);", " av_free(ctx->fill_u);", " av_free(ctx->fill_v);" ], "line_no": [ 9, 11, 13 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { ProresContext* ctx = avctx->priv_data; av_freep(&avctx->coded_frame); av_free(ctx->fill_y); av_free(ctx->fill_u); av_free(ctx->fill_v); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "ProresContext* ctx = avctx->priv_data;", "av_freep(&avctx->coded_frame);", "av_free(ctx->fill_y);", "av_free(ctx->fill_u);", "av_free(ctx->fill_v);", "return 0;", "}" ]
[ 0, 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
11,072
int ff_rtp_send_rtcp_feedback(RTPDemuxContext *s, URLContext *fd, AVIOContext *avio) { int len, need_keyframe, missing_packets; AVIOContext *pb; uint8_t *buf; int64_t now; uint16_t first_missing, missing_mask; if (!fd && !avio) return -1; need_keyframe = s->handler && s->handler->need_keyframe && s->handler->need_keyframe(s->dynamic_protocol_context); missing_packets = find_missing_packets(s, &first_missing, &missing_mask); if (!need_keyframe && !missing_packets) return 0; /* Send new feedback if enough time has elapsed since the last * feedback packet. */ now = av_gettime(); if (s->last_feedback_time && (now - s->last_feedback_time) < MIN_FEEDBACK_INTERVAL) return 0; s->last_feedback_time = now; if (!fd) pb = avio; else if (avio_open_dyn_buf(&pb) < 0) return -1; if (need_keyframe) { avio_w8(pb, (RTP_VERSION << 6) | 1); /* PLI */ avio_w8(pb, RTCP_PSFB); avio_wb16(pb, 2); /* length in words - 1 */ // our own SSRC: we use the server's SSRC + 1 to avoid conflicts avio_wb32(pb, s->ssrc + 1); avio_wb32(pb, s->ssrc); // server SSRC } if (missing_packets) { avio_w8(pb, (RTP_VERSION << 6) | 1); /* NACK */ avio_w8(pb, RTCP_RTPFB); avio_wb16(pb, 3); /* length in words - 1 */ avio_wb32(pb, s->ssrc + 1); avio_wb32(pb, s->ssrc); // server SSRC avio_wb16(pb, first_missing); avio_wb16(pb, missing_mask); } avio_flush(pb); if (!fd) return 0; len = avio_close_dyn_buf(pb, &buf); if (len > 0 && buf) { ffurl_write(fd, buf, len); av_free(buf); } return 0; }
true
FFmpeg
8fbab7a6c84fd75de4f752b412cea8032604f75b
int ff_rtp_send_rtcp_feedback(RTPDemuxContext *s, URLContext *fd, AVIOContext *avio) { int len, need_keyframe, missing_packets; AVIOContext *pb; uint8_t *buf; int64_t now; uint16_t first_missing, missing_mask; if (!fd && !avio) return -1; need_keyframe = s->handler && s->handler->need_keyframe && s->handler->need_keyframe(s->dynamic_protocol_context); missing_packets = find_missing_packets(s, &first_missing, &missing_mask); if (!need_keyframe && !missing_packets) return 0; now = av_gettime(); if (s->last_feedback_time && (now - s->last_feedback_time) < MIN_FEEDBACK_INTERVAL) return 0; s->last_feedback_time = now; if (!fd) pb = avio; else if (avio_open_dyn_buf(&pb) < 0) return -1; if (need_keyframe) { avio_w8(pb, (RTP_VERSION << 6) | 1); avio_w8(pb, RTCP_PSFB); avio_wb16(pb, 2); avio_wb32(pb, s->ssrc + 1); avio_wb32(pb, s->ssrc); } if (missing_packets) { avio_w8(pb, (RTP_VERSION << 6) | 1); avio_w8(pb, RTCP_RTPFB); avio_wb16(pb, 3); avio_wb32(pb, s->ssrc + 1); avio_wb32(pb, s->ssrc); avio_wb16(pb, first_missing); avio_wb16(pb, missing_mask); } avio_flush(pb); if (!fd) return 0; len = avio_close_dyn_buf(pb, &buf); if (len > 0 && buf) { ffurl_write(fd, buf, len); av_free(buf); } return 0; }
{ "code": [ " uint16_t first_missing, missing_mask;" ], "line_no": [ 15 ] }
int FUNC_0(RTPDemuxContext *VAR_0, URLContext *VAR_1, AVIOContext *VAR_2) { int VAR_3, VAR_4, VAR_5; AVIOContext *pb; uint8_t *buf; int64_t now; uint16_t first_missing, missing_mask; if (!VAR_1 && !VAR_2) return -1; VAR_4 = VAR_0->handler && VAR_0->handler->VAR_4 && VAR_0->handler->VAR_4(VAR_0->dynamic_protocol_context); VAR_5 = find_missing_packets(VAR_0, &first_missing, &missing_mask); if (!VAR_4 && !VAR_5) return 0; now = av_gettime(); if (VAR_0->last_feedback_time && (now - VAR_0->last_feedback_time) < MIN_FEEDBACK_INTERVAL) return 0; VAR_0->last_feedback_time = now; if (!VAR_1) pb = VAR_2; else if (avio_open_dyn_buf(&pb) < 0) return -1; if (VAR_4) { avio_w8(pb, (RTP_VERSION << 6) | 1); avio_w8(pb, RTCP_PSFB); avio_wb16(pb, 2); avio_wb32(pb, VAR_0->ssrc + 1); avio_wb32(pb, VAR_0->ssrc); } if (VAR_5) { avio_w8(pb, (RTP_VERSION << 6) | 1); avio_w8(pb, RTCP_RTPFB); avio_wb16(pb, 3); avio_wb32(pb, VAR_0->ssrc + 1); avio_wb32(pb, VAR_0->ssrc); avio_wb16(pb, first_missing); avio_wb16(pb, missing_mask); } avio_flush(pb); if (!VAR_1) return 0; VAR_3 = avio_close_dyn_buf(pb, &buf); if (VAR_3 > 0 && buf) { ffurl_write(VAR_1, buf, VAR_3); av_free(buf); } return 0; }
[ "int FUNC_0(RTPDemuxContext *VAR_0, URLContext *VAR_1,\nAVIOContext *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5;", "AVIOContext *pb;", "uint8_t *buf;", "int64_t now;", "uint16_t first_missing, missing_mask;", "if (!VAR_1 && !VAR_2)\nreturn -1;", "VAR_4 = VAR_0->handler && VAR_0->handler->VAR_4 &&\nVAR_0->handler->VAR_4(VAR_0->dynamic_protocol_context);", "VAR_5 = find_missing_packets(VAR_0, &first_missing, &missing_mask);", "if (!VAR_4 && !VAR_5)\nreturn 0;", "now = av_gettime();", "if (VAR_0->last_feedback_time &&\n(now - VAR_0->last_feedback_time) < MIN_FEEDBACK_INTERVAL)\nreturn 0;", "VAR_0->last_feedback_time = now;", "if (!VAR_1)\npb = VAR_2;", "else if (avio_open_dyn_buf(&pb) < 0)\nreturn -1;", "if (VAR_4) {", "avio_w8(pb, (RTP_VERSION << 6) | 1);", "avio_w8(pb, RTCP_PSFB);", "avio_wb16(pb, 2);", "avio_wb32(pb, VAR_0->ssrc + 1);", "avio_wb32(pb, VAR_0->ssrc);", "}", "if (VAR_5) {", "avio_w8(pb, (RTP_VERSION << 6) | 1);", "avio_w8(pb, RTCP_RTPFB);", "avio_wb16(pb, 3);", "avio_wb32(pb, VAR_0->ssrc + 1);", "avio_wb32(pb, VAR_0->ssrc);", "avio_wb16(pb, first_missing);", "avio_wb16(pb, missing_mask);", "}", "avio_flush(pb);", "if (!VAR_1)\nreturn 0;", "VAR_3 = avio_close_dyn_buf(pb, &buf);", "if (VAR_3 > 0 && buf) {", "ffurl_write(VAR_1, buf, VAR_3);", "av_free(buf);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25, 27 ], [ 29 ], [ 33, 35 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 57, 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]
11,073
static struct pathelem *add_entry(struct pathelem *root, const char *name) { root->num_entries++; root = realloc(root, sizeof(*root) + sizeof(root->entries[0])*root->num_entries); root->entries[root->num_entries-1] = new_entry(root->pathname, root, name); root->entries[root->num_entries-1] = add_dir_maybe(root->entries[root->num_entries-1]); return root; }
true
qemu
2296f194dfde4c0a54f249d3fdb8c8ca21dc611b
static struct pathelem *add_entry(struct pathelem *root, const char *name) { root->num_entries++; root = realloc(root, sizeof(*root) + sizeof(root->entries[0])*root->num_entries); root->entries[root->num_entries-1] = new_entry(root->pathname, root, name); root->entries[root->num_entries-1] = add_dir_maybe(root->entries[root->num_entries-1]); return root; }
{ "code": [ "static struct pathelem *add_entry(struct pathelem *root, const char *name)", " root->entries[root->num_entries-1] = new_entry(root->pathname, root, name);", " root->entries[root->num_entries-1]", " = add_dir_maybe(root->entries[root->num_entries-1]);" ], "line_no": [ 1, 15, 17, 19 ] }
static struct pathelem *FUNC_0(struct pathelem *VAR_0, const char *VAR_1) { VAR_0->num_entries++; VAR_0 = realloc(VAR_0, sizeof(*VAR_0) + sizeof(VAR_0->entries[0])*VAR_0->num_entries); VAR_0->entries[VAR_0->num_entries-1] = new_entry(VAR_0->pathname, VAR_0, VAR_1); VAR_0->entries[VAR_0->num_entries-1] = add_dir_maybe(VAR_0->entries[VAR_0->num_entries-1]); return VAR_0; }
[ "static struct pathelem *FUNC_0(struct pathelem *VAR_0, const char *VAR_1)\n{", "VAR_0->num_entries++;", "VAR_0 = realloc(VAR_0, sizeof(*VAR_0)\n+ sizeof(VAR_0->entries[0])*VAR_0->num_entries);", "VAR_0->entries[VAR_0->num_entries-1] = new_entry(VAR_0->pathname, VAR_0, VAR_1);", "VAR_0->entries[VAR_0->num_entries-1]\n= add_dir_maybe(VAR_0->entries[VAR_0->num_entries-1]);", "return VAR_0;", "}" ]
[ 1, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ] ]
11,074
yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target, int hasAlpha) { const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], *abuf0 = hasAlpha ? abuf[0] : NULL, *abuf1 = hasAlpha ? abuf[1] : NULL; int yalpha1 = 4095 - yalpha; int uvalpha1 = 4095 - uvalpha; int i; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; int A1, A2; const void *r = c->table_rV[V], *g = (c->table_gU[U] + c->table_gV[V]), *b = c->table_bU[U]; if (hasAlpha) { A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19; A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } }
true
FFmpeg
9487fb4dea3498eb4711eb023f43199f68701b1e
yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target, int hasAlpha) { const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], *abuf0 = hasAlpha ? abuf[0] : NULL, *abuf1 = hasAlpha ? abuf[1] : NULL; int yalpha1 = 4095 - yalpha; int uvalpha1 = 4095 - uvalpha; int i; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; int A1, A2; const void *r = c->table_rV[V], *g = (c->table_gU[U] + c->table_gV[V]), *b = c->table_bU[U]; if (hasAlpha) { A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19; A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } }
{ "code": [], "line_no": [] }
FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2], const int16_t *VAR_2[2], const int16_t *VAR_3[2], const int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, enum PixelFormat VAR_10, int VAR_11) { const int16_t *VAR_12 = VAR_1[0], *buf1 = VAR_1[1], *ubuf0 = VAR_2[0], *ubuf1 = VAR_2[1], *vbuf0 = VAR_3[0], *vbuf1 = VAR_3[1], *abuf0 = VAR_11 ? VAR_4[0] : NULL, *abuf1 = VAR_11 ? VAR_4[1] : NULL; int VAR_13 = 4095 - VAR_7; int VAR_14 = 4095 - VAR_8; int VAR_15; for (VAR_15 = 0; VAR_15 < (VAR_6 >> 1); VAR_15++) { int VAR_16 = (VAR_12[VAR_15 * 2] * VAR_13 + buf1[VAR_15 * 2] * VAR_7) >> 19; int VAR_17 = (VAR_12[VAR_15 * 2 + 1] * VAR_13 + buf1[VAR_15 * 2 + 1] * VAR_7) >> 19; int VAR_18 = (ubuf0[VAR_15] * VAR_14 + ubuf1[VAR_15] * VAR_8) >> 19; int VAR_19 = (vbuf0[VAR_15] * VAR_14 + vbuf1[VAR_15] * VAR_8) >> 19; int VAR_20, VAR_21; const void *VAR_22 = VAR_0->table_rV[VAR_19], *VAR_23 = (VAR_0->table_gU[VAR_18] + VAR_0->table_gV[VAR_19]), *VAR_24 = VAR_0->table_bU[VAR_18]; if (VAR_11) { VAR_20 = (abuf0[VAR_15 * 2 ] * VAR_13 + abuf1[VAR_15 * 2 ] * VAR_7) >> 19; VAR_21 = (abuf0[VAR_15 * 2 + 1] * VAR_13 + abuf1[VAR_15 * 2 + 1] * VAR_7) >> 19; } yuv2rgb_write(VAR_5, VAR_15, VAR_16, VAR_17, VAR_11 ? VAR_20 : 0, VAR_11 ? VAR_21 : 0, VAR_22, VAR_23, VAR_24, VAR_9, VAR_10, VAR_11); } }
[ "FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2],\nconst int16_t *VAR_2[2], const int16_t *VAR_3[2],\nconst int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8, int VAR_9,\nenum PixelFormat VAR_10, int VAR_11)\n{", "const int16_t *VAR_12 = VAR_1[0], *buf1 = VAR_1[1],\n*ubuf0 = VAR_2[0], *ubuf1 = VAR_2[1],\n*vbuf0 = VAR_3[0], *vbuf1 = VAR_3[1],\n*abuf0 = VAR_11 ? VAR_4[0] : NULL,\n*abuf1 = VAR_11 ? VAR_4[1] : NULL;", "int VAR_13 = 4095 - VAR_7;", "int VAR_14 = 4095 - VAR_8;", "int VAR_15;", "for (VAR_15 = 0; VAR_15 < (VAR_6 >> 1); VAR_15++) {", "int VAR_16 = (VAR_12[VAR_15 * 2] * VAR_13 + buf1[VAR_15 * 2] * VAR_7) >> 19;", "int VAR_17 = (VAR_12[VAR_15 * 2 + 1] * VAR_13 + buf1[VAR_15 * 2 + 1] * VAR_7) >> 19;", "int VAR_18 = (ubuf0[VAR_15] * VAR_14 + ubuf1[VAR_15] * VAR_8) >> 19;", "int VAR_19 = (vbuf0[VAR_15] * VAR_14 + vbuf1[VAR_15] * VAR_8) >> 19;", "int VAR_20, VAR_21;", "const void *VAR_22 = VAR_0->table_rV[VAR_19],\n*VAR_23 = (VAR_0->table_gU[VAR_18] + VAR_0->table_gV[VAR_19]),\n*VAR_24 = VAR_0->table_bU[VAR_18];", "if (VAR_11) {", "VAR_20 = (abuf0[VAR_15 * 2 ] * VAR_13 + abuf1[VAR_15 * 2 ] * VAR_7) >> 19;", "VAR_21 = (abuf0[VAR_15 * 2 + 1] * VAR_13 + abuf1[VAR_15 * 2 + 1] * VAR_7) >> 19;", "}", "yuv2rgb_write(VAR_5, VAR_15, VAR_16, VAR_17, VAR_11 ? VAR_20 : 0, VAR_11 ? VAR_21 : 0,\nVAR_22, VAR_23, VAR_24, VAR_9, VAR_10, VAR_11);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4, 5, 6 ], [ 7, 8, 9, 10, 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22, 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28, 29 ], [ 30 ], [ 31 ] ]
11,076
static void nbd_recv_coroutines_enter_all(NbdClientSession *s) { int i; for (i = 0; i < MAX_NBD_REQUESTS; i++) { if (s->recv_coroutine[i]) { qemu_coroutine_enter(s->recv_coroutine[i], NULL); } } }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static void nbd_recv_coroutines_enter_all(NbdClientSession *s) { int i; for (i = 0; i < MAX_NBD_REQUESTS; i++) { if (s->recv_coroutine[i]) { qemu_coroutine_enter(s->recv_coroutine[i], NULL); } } }
{ "code": [ " qemu_coroutine_enter(s->recv_coroutine[i], NULL);" ], "line_no": [ 13 ] }
static void FUNC_0(NbdClientSession *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < MAX_NBD_REQUESTS; VAR_1++) { if (VAR_0->recv_coroutine[VAR_1]) { qemu_coroutine_enter(VAR_0->recv_coroutine[VAR_1], NULL); } } }
[ "static void FUNC_0(NbdClientSession *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < MAX_NBD_REQUESTS; VAR_1++) {", "if (VAR_0->recv_coroutine[VAR_1]) {", "qemu_coroutine_enter(VAR_0->recv_coroutine[VAR_1], NULL);", "}", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,077
static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band) { int i, j, idx; int32_t *datap = (int32_t *) &comp->data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]; for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) for (i = 0; i < (cblk->coord[0][1] - cblk->coord[0][0]); ++i) { idx = (comp->coord[0][1] - comp->coord[0][0]) * j + i; datap[idx] = ((int32_t)(t1->data[j][i]) * band->i_stepsize + (1 << 15)) >> 16; } }
true
FFmpeg
8bedbb82cee4463a43e60eb22674c8bf927280ef
static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk, Jpeg2000Component *comp, Jpeg2000T1Context *t1, Jpeg2000Band *band) { int i, j, idx; int32_t *datap = (int32_t *) &comp->data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]; for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) for (i = 0; i < (cblk->coord[0][1] - cblk->coord[0][0]); ++i) { idx = (comp->coord[0][1] - comp->coord[0][0]) * j + i; datap[idx] = ((int32_t)(t1->data[j][i]) * band->i_stepsize + (1 << 15)) >> 16; } }
{ "code": [ " int32_t *datap =", " (int32_t *) &comp->data[(comp->coord[0][1] - comp->coord[0][0]) * y + x];", " int32_t *datap =", " (int32_t *) &comp->data[(comp->coord[0][1] - comp->coord[0][0]) * y + x];" ], "line_no": [ 11, 13, 11, 13 ] }
static void FUNC_0(int VAR_0, int VAR_1, Jpeg2000Cblk *VAR_2, Jpeg2000Component *VAR_3, Jpeg2000T1Context *VAR_4, Jpeg2000Band *VAR_5) { int VAR_6, VAR_7, VAR_8; int32_t *datap = (int32_t *) &VAR_3->data[(VAR_3->coord[0][1] - VAR_3->coord[0][0]) * VAR_1 + VAR_0]; for (VAR_7 = 0; VAR_7 < (VAR_2->coord[1][1] - VAR_2->coord[1][0]); ++VAR_7) for (VAR_6 = 0; VAR_6 < (VAR_2->coord[0][1] - VAR_2->coord[0][0]); ++VAR_6) { VAR_8 = (VAR_3->coord[0][1] - VAR_3->coord[0][0]) * VAR_7 + VAR_6; datap[VAR_8] = ((int32_t)(VAR_4->data[VAR_7][VAR_6]) * VAR_5->i_stepsize + (1 << 15)) >> 16; } }
[ "static void FUNC_0(int VAR_0, int VAR_1, Jpeg2000Cblk *VAR_2,\nJpeg2000Component *VAR_3,\nJpeg2000T1Context *VAR_4, Jpeg2000Band *VAR_5)\n{", "int VAR_6, VAR_7, VAR_8;", "int32_t *datap =\n(int32_t *) &VAR_3->data[(VAR_3->coord[0][1] - VAR_3->coord[0][0]) * VAR_1 + VAR_0];", "for (VAR_7 = 0; VAR_7 < (VAR_2->coord[1][1] - VAR_2->coord[1][0]); ++VAR_7)", "for (VAR_6 = 0; VAR_6 < (VAR_2->coord[0][1] - VAR_2->coord[0][0]); ++VAR_6) {", "VAR_8 = (VAR_3->coord[0][1] - VAR_3->coord[0][0]) * VAR_7 + VAR_6;", "datap[VAR_8] =\n((int32_t)(VAR_4->data[VAR_7][VAR_6]) * VAR_5->i_stepsize + (1 << 15)) >> 16;", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ] ]
11,078
static void ehci_queues_rip_device(EHCIState *ehci, USBDevice *dev) { EHCIQueue *q, *tmp; QTAILQ_FOREACH_SAFE(q, &ehci->queues, next, tmp) { if (q->packet.owner == NULL || q->packet.owner->dev != dev) { continue; } ehci_free_queue(q); } }
true
qemu
f53c398aa603cea135ee58fd15249aeff7b9c7ea
static void ehci_queues_rip_device(EHCIState *ehci, USBDevice *dev) { EHCIQueue *q, *tmp; QTAILQ_FOREACH_SAFE(q, &ehci->queues, next, tmp) { if (q->packet.owner == NULL || q->packet.owner->dev != dev) { continue; } ehci_free_queue(q); } }
{ "code": [ " if (q->packet.owner == NULL ||", " q->packet.owner->dev != dev) {" ], "line_no": [ 11, 13 ] }
static void FUNC_0(EHCIState *VAR_0, USBDevice *VAR_1) { EHCIQueue *q, *tmp; QTAILQ_FOREACH_SAFE(q, &VAR_0->queues, next, tmp) { if (q->packet.owner == NULL || q->packet.owner->VAR_1 != VAR_1) { continue; } ehci_free_queue(q); } }
[ "static void FUNC_0(EHCIState *VAR_0, USBDevice *VAR_1)\n{", "EHCIQueue *q, *tmp;", "QTAILQ_FOREACH_SAFE(q, &VAR_0->queues, next, tmp) {", "if (q->packet.owner == NULL ||\nq->packet.owner->VAR_1 != VAR_1) {", "continue;", "}", "ehci_free_queue(q);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
11,079
static int vfio_add_std_cap(VFIODevice *vdev, uint8_t pos) { PCIDevice *pdev = &vdev->pdev; uint8_t cap_id, next, size; int ret; cap_id = pdev->config[pos]; next = pdev->config[pos + 1]; /* * If it becomes important to configure capabilities to their actual * size, use this as the default when it's something we don't recognize. * Since QEMU doesn't actually handle many of the config accesses, * exact size doesn't seem worthwhile. */ size = vfio_std_cap_max_size(pdev, pos); /* * pci_add_capability always inserts the new capability at the head * of the chain. Therefore to end up with a chain that matches the * physical device, we insert from the end by making this recursive. * This is also why we pre-caclulate size above as cached config space * will be changed as we unwind the stack. */ if (next) { ret = vfio_add_std_cap(vdev, next); if (ret) { return ret; } } else { pdev->config[PCI_CAPABILITY_LIST] = 0; /* Begin the rebuild */ } switch (cap_id) { case PCI_CAP_ID_MSI: ret = vfio_setup_msi(vdev, pos); break; case PCI_CAP_ID_MSIX: ret = vfio_setup_msix(vdev, pos); break; default: ret = pci_add_capability(pdev, cap_id, pos, size); break; } if (ret < 0) { error_report("vfio: %04x:%02x:%02x.%x Error adding PCI capability " "0x%x[0x%x]@0x%x: %d", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, cap_id, size, pos, ret); return ret; } return 0; }
true
qemu
96adc5c7c2178d02f0db2db368ba3e4aacef931a
static int vfio_add_std_cap(VFIODevice *vdev, uint8_t pos) { PCIDevice *pdev = &vdev->pdev; uint8_t cap_id, next, size; int ret; cap_id = pdev->config[pos]; next = pdev->config[pos + 1]; size = vfio_std_cap_max_size(pdev, pos); if (next) { ret = vfio_add_std_cap(vdev, next); if (ret) { return ret; } } else { pdev->config[PCI_CAPABILITY_LIST] = 0; } switch (cap_id) { case PCI_CAP_ID_MSI: ret = vfio_setup_msi(vdev, pos); break; case PCI_CAP_ID_MSIX: ret = vfio_setup_msix(vdev, pos); break; default: ret = pci_add_capability(pdev, cap_id, pos, size); break; } if (ret < 0) { error_report("vfio: %04x:%02x:%02x.%x Error adding PCI capability " "0x%x[0x%x]@0x%x: %d", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, cap_id, size, pos, ret); return ret; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VFIODevice *VAR_0, uint8_t VAR_1) { PCIDevice *pdev = &VAR_0->pdev; uint8_t cap_id, next, size; int VAR_2; cap_id = pdev->config[VAR_1]; next = pdev->config[VAR_1 + 1]; size = vfio_std_cap_max_size(pdev, VAR_1); if (next) { VAR_2 = FUNC_0(VAR_0, next); if (VAR_2) { return VAR_2; } } else { pdev->config[PCI_CAPABILITY_LIST] = 0; } switch (cap_id) { case PCI_CAP_ID_MSI: VAR_2 = vfio_setup_msi(VAR_0, VAR_1); break; case PCI_CAP_ID_MSIX: VAR_2 = vfio_setup_msix(VAR_0, VAR_1); break; default: VAR_2 = pci_add_capability(pdev, cap_id, VAR_1, size); break; } if (VAR_2 < 0) { error_report("vfio: %04x:%02x:%02x.%x Error adding PCI capability " "0x%x[0x%x]@0x%x: %d", VAR_0->host.domain, VAR_0->host.bus, VAR_0->host.slot, VAR_0->host.function, cap_id, size, VAR_1, VAR_2); return VAR_2; } return 0; }
[ "static int FUNC_0(VFIODevice *VAR_0, uint8_t VAR_1)\n{", "PCIDevice *pdev = &VAR_0->pdev;", "uint8_t cap_id, next, size;", "int VAR_2;", "cap_id = pdev->config[VAR_1];", "next = pdev->config[VAR_1 + 1];", "size = vfio_std_cap_max_size(pdev, VAR_1);", "if (next) {", "VAR_2 = FUNC_0(VAR_0, next);", "if (VAR_2) {", "return VAR_2;", "}", "} else {", "pdev->config[PCI_CAPABILITY_LIST] = 0;", "}", "switch (cap_id) {", "case PCI_CAP_ID_MSI:\nVAR_2 = vfio_setup_msi(VAR_0, VAR_1);", "break;", "case PCI_CAP_ID_MSIX:\nVAR_2 = vfio_setup_msix(VAR_0, VAR_1);", "break;", "default:\nVAR_2 = pci_add_capability(pdev, cap_id, VAR_1, size);", "break;", "}", "if (VAR_2 < 0) {", "error_report(\"vfio: %04x:%02x:%02x.%x Error adding PCI capability \"\n\"0x%x[0x%x]@0x%x: %d\", VAR_0->host.domain,\nVAR_0->host.bus, VAR_0->host.slot, VAR_0->host.function,\ncap_id, size, VAR_1, VAR_2);", "return VAR_2;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 31 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95, 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ] ]
11,081
void ff_xvmc_decode_mb(MpegEncContext *s) { XvMCMacroBlock *mv_block; struct xvmc_pix_fmt *render; int i, cbp, blocks_per_mb; const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; if (s->encoding) { av_log(s->avctx, AV_LOG_ERROR, "XVMC doesn't support encoding!!!\n"); return; } // from ff_mpv_decode_mb(), update DC predictors for P macroblocks if (!s->mb_intra) { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } // MC doesn't skip blocks s->mb_skipped = 0; // Do I need to export quant when I could not perform postprocessing? // Anyway, it doesn't hurt. s->current_picture.qscale_table[mb_xy] = s->qscale; // start of XVMC-specific code render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2]; assert(render); assert(render->xvmc_id == AV_XVMC_ID); assert(render->mv_blocks); // take the next free macroblock mv_block = &render->mv_blocks[render->start_mv_blocks_num + render->filled_mv_blocks_num]; mv_block->x = s->mb_x; mv_block->y = s->mb_y; mv_block->dct_type = s->interlaced_dct; // XVMC_DCT_TYPE_FRAME/FIELD; if (s->mb_intra) { mv_block->macroblock_type = XVMC_MB_TYPE_INTRA; // no MC, all done } else { mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN; if (s->mv_dir & MV_DIR_FORWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD; // PMV[n][dir][xy] = mv[dir][n][xy] mv_block->PMV[0][0][0] = s->mv[0][0][0]; mv_block->PMV[0][0][1] = s->mv[0][0][1]; mv_block->PMV[1][0][0] = s->mv[0][1][0]; mv_block->PMV[1][0][1] = s->mv[0][1][1]; } if (s->mv_dir & MV_DIR_BACKWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; mv_block->PMV[0][1][0] = s->mv[1][0][0]; mv_block->PMV[0][1][1] = s->mv[1][0][1]; mv_block->PMV[1][1][0] = s->mv[1][1][0]; mv_block->PMV[1][1][1] = s->mv[1][1][1]; } switch(s->mv_type) { case MV_TYPE_16X16: mv_block->motion_type = XVMC_PREDICTION_FRAME; break; case MV_TYPE_16X8: mv_block->motion_type = XVMC_PREDICTION_16x8; break; case MV_TYPE_FIELD: mv_block->motion_type = XVMC_PREDICTION_FIELD; if (s->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][1] <<= 1; mv_block->PMV[1][0][1] <<= 1; mv_block->PMV[0][1][1] <<= 1; mv_block->PMV[1][1][1] <<= 1; } break; case MV_TYPE_DMV: mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME; if (s->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][0] = s->mv[0][0][0]; // top from top mv_block->PMV[0][0][1] = s->mv[0][0][1] << 1; mv_block->PMV[0][1][0] = s->mv[0][0][0]; // bottom from bottom mv_block->PMV[0][1][1] = s->mv[0][0][1] << 1; mv_block->PMV[1][0][0] = s->mv[0][2][0]; // dmv00, top from bottom mv_block->PMV[1][0][1] = s->mv[0][2][1] << 1; // dmv01 mv_block->PMV[1][1][0] = s->mv[0][3][0]; // dmv10, bottom from top mv_block->PMV[1][1][1] = s->mv[0][3][1] << 1; // dmv11 } else { mv_block->PMV[0][1][0] = s->mv[0][2][0]; // dmv00 mv_block->PMV[0][1][1] = s->mv[0][2][1]; // dmv01 } break; default: assert(0); } mv_block->motion_vertical_field_select = 0; // set correct field references if (s->mv_type == MV_TYPE_FIELD || s->mv_type == MV_TYPE_16X8) { mv_block->motion_vertical_field_select |= s->field_select[0][0]; mv_block->motion_vertical_field_select |= s->field_select[1][0] << 1; mv_block->motion_vertical_field_select |= s->field_select[0][1] << 2; mv_block->motion_vertical_field_select |= s->field_select[1][1] << 3; } } // !intra // time to handle data blocks mv_block->index = render->next_free_data_block_num; blocks_per_mb = 6; if (s->chroma_format >= 2) { blocks_per_mb = 4 + (1 << s->chroma_format); } // calculate cbp cbp = 0; for (i = 0; i < blocks_per_mb; i++) { cbp += cbp; if (s->block_last_index[i] >= 0) cbp++; } if (s->avctx->flags & AV_CODEC_FLAG_GRAY) { if (s->mb_intra) { // intra frames are always full chroma blocks for (i = 4; i < blocks_per_mb; i++) { memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); // so we need to clear them if (!render->unsigned_intra) *s->pblocks[i][0] = 1 << 10; } } else { cbp &= 0xf << (blocks_per_mb - 4); blocks_per_mb = 4; // luminance blocks only } } mv_block->coded_block_pattern = cbp; if (cbp == 0) mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN; for (i = 0; i < blocks_per_mb; i++) { if (s->block_last_index[i] >= 0) { // I do not have unsigned_intra MOCO to test, hope it is OK. if (s->mb_intra && (render->idct || !render->unsigned_intra)) *s->pblocks[i][0] -= 1 << 10; if (!render->idct) { s->idsp.idct(*s->pblocks[i]); /* It is unclear if MC hardware requires pixel diff values to be * in the range [-255;255]. TODO: Clipping if such hardware is * ever found. As of now it would only be an unnecessary * slowdown. */ } // copy blocks only if the codec doesn't support pblocks reordering if (s->avctx->xvmc_acceleration == 1) { memcpy(&render->data_blocks[render->next_free_data_block_num*64], s->pblocks[i], sizeof(*s->pblocks[i])); } render->next_free_data_block_num++; } } render->filled_mv_blocks_num++; assert(render->filled_mv_blocks_num <= render->allocated_mv_blocks); assert(render->next_free_data_block_num <= render->allocated_data_blocks); /* The above conditions should not be able to fail as long as this function * is used and the following 'if ()' automatically calls a callback to free * blocks. */ if (render->filled_mv_blocks_num == render->allocated_mv_blocks) ff_mpeg_draw_horiz_band(s, 0, 0); }
false
FFmpeg
dcc39ee10e82833ce24aa57926c00ffeb1948198
void ff_xvmc_decode_mb(MpegEncContext *s) { XvMCMacroBlock *mv_block; struct xvmc_pix_fmt *render; int i, cbp, blocks_per_mb; const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; if (s->encoding) { av_log(s->avctx, AV_LOG_ERROR, "XVMC doesn't support encoding!!!\n"); return; } if (!s->mb_intra) { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } s->mb_skipped = 0; s->current_picture.qscale_table[mb_xy] = s->qscale; render = (struct xvmc_pix_fmt*)s->current_picture.f->data[2]; assert(render); assert(render->xvmc_id == AV_XVMC_ID); assert(render->mv_blocks); mv_block = &render->mv_blocks[render->start_mv_blocks_num + render->filled_mv_blocks_num]; mv_block->x = s->mb_x; mv_block->y = s->mb_y; mv_block->dct_type = s->interlaced_dct; if (s->mb_intra) { mv_block->macroblock_type = XVMC_MB_TYPE_INTRA; } else { mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN; if (s->mv_dir & MV_DIR_FORWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD; mv_block->PMV[0][0][0] = s->mv[0][0][0]; mv_block->PMV[0][0][1] = s->mv[0][0][1]; mv_block->PMV[1][0][0] = s->mv[0][1][0]; mv_block->PMV[1][0][1] = s->mv[0][1][1]; } if (s->mv_dir & MV_DIR_BACKWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; mv_block->PMV[0][1][0] = s->mv[1][0][0]; mv_block->PMV[0][1][1] = s->mv[1][0][1]; mv_block->PMV[1][1][0] = s->mv[1][1][0]; mv_block->PMV[1][1][1] = s->mv[1][1][1]; } switch(s->mv_type) { case MV_TYPE_16X16: mv_block->motion_type = XVMC_PREDICTION_FRAME; break; case MV_TYPE_16X8: mv_block->motion_type = XVMC_PREDICTION_16x8; break; case MV_TYPE_FIELD: mv_block->motion_type = XVMC_PREDICTION_FIELD; if (s->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][1] <<= 1; mv_block->PMV[1][0][1] <<= 1; mv_block->PMV[0][1][1] <<= 1; mv_block->PMV[1][1][1] <<= 1; } break; case MV_TYPE_DMV: mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME; if (s->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][0] = s->mv[0][0][0]; mv_block->PMV[0][0][1] = s->mv[0][0][1] << 1; mv_block->PMV[0][1][0] = s->mv[0][0][0]; mv_block->PMV[0][1][1] = s->mv[0][0][1] << 1; mv_block->PMV[1][0][0] = s->mv[0][2][0]; mv_block->PMV[1][0][1] = s->mv[0][2][1] << 1; mv_block->PMV[1][1][0] = s->mv[0][3][0]; mv_block->PMV[1][1][1] = s->mv[0][3][1] << 1; } else { mv_block->PMV[0][1][0] = s->mv[0][2][0]; mv_block->PMV[0][1][1] = s->mv[0][2][1]; } break; default: assert(0); } mv_block->motion_vertical_field_select = 0; if (s->mv_type == MV_TYPE_FIELD || s->mv_type == MV_TYPE_16X8) { mv_block->motion_vertical_field_select |= s->field_select[0][0]; mv_block->motion_vertical_field_select |= s->field_select[1][0] << 1; mv_block->motion_vertical_field_select |= s->field_select[0][1] << 2; mv_block->motion_vertical_field_select |= s->field_select[1][1] << 3; } } mv_block->index = render->next_free_data_block_num; blocks_per_mb = 6; if (s->chroma_format >= 2) { blocks_per_mb = 4 + (1 << s->chroma_format); } cbp = 0; for (i = 0; i < blocks_per_mb; i++) { cbp += cbp; if (s->block_last_index[i] >= 0) cbp++; } if (s->avctx->flags & AV_CODEC_FLAG_GRAY) { if (s->mb_intra) { for (i = 4; i < blocks_per_mb; i++) { memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); if (!render->unsigned_intra) *s->pblocks[i][0] = 1 << 10; } } else { cbp &= 0xf << (blocks_per_mb - 4); blocks_per_mb = 4; } } mv_block->coded_block_pattern = cbp; if (cbp == 0) mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN; for (i = 0; i < blocks_per_mb; i++) { if (s->block_last_index[i] >= 0) { if (s->mb_intra && (render->idct || !render->unsigned_intra)) *s->pblocks[i][0] -= 1 << 10; if (!render->idct) { s->idsp.idct(*s->pblocks[i]); } if (s->avctx->xvmc_acceleration == 1) { memcpy(&render->data_blocks[render->next_free_data_block_num*64], s->pblocks[i], sizeof(*s->pblocks[i])); } render->next_free_data_block_num++; } } render->filled_mv_blocks_num++; assert(render->filled_mv_blocks_num <= render->allocated_mv_blocks); assert(render->next_free_data_block_num <= render->allocated_data_blocks); if (render->filled_mv_blocks_num == render->allocated_mv_blocks) ff_mpeg_draw_horiz_band(s, 0, 0); }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0) { XvMCMacroBlock *mv_block; struct xvmc_pix_fmt *VAR_1; int VAR_2, VAR_3, VAR_4; const int VAR_5 = VAR_0->mb_y * VAR_0->mb_stride + VAR_0->mb_x; if (VAR_0->encoding) { av_log(VAR_0->avctx, AV_LOG_ERROR, "XVMC doesn't support encoding!!!\n"); return; } if (!VAR_0->mb_intra) { VAR_0->last_dc[0] = VAR_0->last_dc[1] = VAR_0->last_dc[2] = 128 << VAR_0->intra_dc_precision; } VAR_0->mb_skipped = 0; VAR_0->current_picture.qscale_table[VAR_5] = VAR_0->qscale; VAR_1 = (struct xvmc_pix_fmt*)VAR_0->current_picture.f->data[2]; assert(VAR_1); assert(VAR_1->xvmc_id == AV_XVMC_ID); assert(VAR_1->mv_blocks); mv_block = &VAR_1->mv_blocks[VAR_1->start_mv_blocks_num + VAR_1->filled_mv_blocks_num]; mv_block->x = VAR_0->mb_x; mv_block->y = VAR_0->mb_y; mv_block->dct_type = VAR_0->interlaced_dct; if (VAR_0->mb_intra) { mv_block->macroblock_type = XVMC_MB_TYPE_INTRA; } else { mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN; if (VAR_0->mv_dir & MV_DIR_FORWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD; mv_block->PMV[0][0][0] = VAR_0->mv[0][0][0]; mv_block->PMV[0][0][1] = VAR_0->mv[0][0][1]; mv_block->PMV[1][0][0] = VAR_0->mv[0][1][0]; mv_block->PMV[1][0][1] = VAR_0->mv[0][1][1]; } if (VAR_0->mv_dir & MV_DIR_BACKWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; mv_block->PMV[0][1][0] = VAR_0->mv[1][0][0]; mv_block->PMV[0][1][1] = VAR_0->mv[1][0][1]; mv_block->PMV[1][1][0] = VAR_0->mv[1][1][0]; mv_block->PMV[1][1][1] = VAR_0->mv[1][1][1]; } switch(VAR_0->mv_type) { case MV_TYPE_16X16: mv_block->motion_type = XVMC_PREDICTION_FRAME; break; case MV_TYPE_16X8: mv_block->motion_type = XVMC_PREDICTION_16x8; break; case MV_TYPE_FIELD: mv_block->motion_type = XVMC_PREDICTION_FIELD; if (VAR_0->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][1] <<= 1; mv_block->PMV[1][0][1] <<= 1; mv_block->PMV[0][1][1] <<= 1; mv_block->PMV[1][1][1] <<= 1; } break; case MV_TYPE_DMV: mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME; if (VAR_0->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][0] = VAR_0->mv[0][0][0]; mv_block->PMV[0][0][1] = VAR_0->mv[0][0][1] << 1; mv_block->PMV[0][1][0] = VAR_0->mv[0][0][0]; mv_block->PMV[0][1][1] = VAR_0->mv[0][0][1] << 1; mv_block->PMV[1][0][0] = VAR_0->mv[0][2][0]; mv_block->PMV[1][0][1] = VAR_0->mv[0][2][1] << 1; mv_block->PMV[1][1][0] = VAR_0->mv[0][3][0]; mv_block->PMV[1][1][1] = VAR_0->mv[0][3][1] << 1; } else { mv_block->PMV[0][1][0] = VAR_0->mv[0][2][0]; mv_block->PMV[0][1][1] = VAR_0->mv[0][2][1]; } break; default: assert(0); } mv_block->motion_vertical_field_select = 0; if (VAR_0->mv_type == MV_TYPE_FIELD || VAR_0->mv_type == MV_TYPE_16X8) { mv_block->motion_vertical_field_select |= VAR_0->field_select[0][0]; mv_block->motion_vertical_field_select |= VAR_0->field_select[1][0] << 1; mv_block->motion_vertical_field_select |= VAR_0->field_select[0][1] << 2; mv_block->motion_vertical_field_select |= VAR_0->field_select[1][1] << 3; } } mv_block->index = VAR_1->next_free_data_block_num; VAR_4 = 6; if (VAR_0->chroma_format >= 2) { VAR_4 = 4 + (1 << VAR_0->chroma_format); } VAR_3 = 0; for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) { VAR_3 += VAR_3; if (VAR_0->block_last_index[VAR_2] >= 0) VAR_3++; } if (VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY) { if (VAR_0->mb_intra) { for (VAR_2 = 4; VAR_2 < VAR_4; VAR_2++) { memset(VAR_0->pblocks[VAR_2], 0, sizeof(*VAR_0->pblocks[VAR_2])); if (!VAR_1->unsigned_intra) *VAR_0->pblocks[VAR_2][0] = 1 << 10; } } else { VAR_3 &= 0xf << (VAR_4 - 4); VAR_4 = 4; } } mv_block->coded_block_pattern = VAR_3; if (VAR_3 == 0) mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN; for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) { if (VAR_0->block_last_index[VAR_2] >= 0) { if (VAR_0->mb_intra && (VAR_1->idct || !VAR_1->unsigned_intra)) *VAR_0->pblocks[VAR_2][0] -= 1 << 10; if (!VAR_1->idct) { VAR_0->idsp.idct(*VAR_0->pblocks[VAR_2]); } if (VAR_0->avctx->xvmc_acceleration == 1) { memcpy(&VAR_1->data_blocks[VAR_1->next_free_data_block_num*64], VAR_0->pblocks[VAR_2], sizeof(*VAR_0->pblocks[VAR_2])); } VAR_1->next_free_data_block_num++; } } VAR_1->filled_mv_blocks_num++; assert(VAR_1->filled_mv_blocks_num <= VAR_1->allocated_mv_blocks); assert(VAR_1->next_free_data_block_num <= VAR_1->allocated_data_blocks); if (VAR_1->filled_mv_blocks_num == VAR_1->allocated_mv_blocks) ff_mpeg_draw_horiz_band(VAR_0, 0, 0); }
[ "void FUNC_0(MpegEncContext *VAR_0)\n{", "XvMCMacroBlock *mv_block;", "struct xvmc_pix_fmt *VAR_1;", "int VAR_2, VAR_3, VAR_4;", "const int VAR_5 = VAR_0->mb_y * VAR_0->mb_stride + VAR_0->mb_x;", "if (VAR_0->encoding) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"XVMC doesn't support encoding!!!\\n\");", "return;", "}", "if (!VAR_0->mb_intra) {", "VAR_0->last_dc[0] =\nVAR_0->last_dc[1] =\nVAR_0->last_dc[2] = 128 << VAR_0->intra_dc_precision;", "}", "VAR_0->mb_skipped = 0;", "VAR_0->current_picture.qscale_table[VAR_5] = VAR_0->qscale;", "VAR_1 = (struct xvmc_pix_fmt*)VAR_0->current_picture.f->data[2];", "assert(VAR_1);", "assert(VAR_1->xvmc_id == AV_XVMC_ID);", "assert(VAR_1->mv_blocks);", "mv_block = &VAR_1->mv_blocks[VAR_1->start_mv_blocks_num +\nVAR_1->filled_mv_blocks_num];", "mv_block->x = VAR_0->mb_x;", "mv_block->y = VAR_0->mb_y;", "mv_block->dct_type = VAR_0->interlaced_dct;", "if (VAR_0->mb_intra) {", "mv_block->macroblock_type = XVMC_MB_TYPE_INTRA;", "} else {", "mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;", "if (VAR_0->mv_dir & MV_DIR_FORWARD) {", "mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;", "mv_block->PMV[0][0][0] = VAR_0->mv[0][0][0];", "mv_block->PMV[0][0][1] = VAR_0->mv[0][0][1];", "mv_block->PMV[1][0][0] = VAR_0->mv[0][1][0];", "mv_block->PMV[1][0][1] = VAR_0->mv[0][1][1];", "}", "if (VAR_0->mv_dir & MV_DIR_BACKWARD) {", "mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;", "mv_block->PMV[0][1][0] = VAR_0->mv[1][0][0];", "mv_block->PMV[0][1][1] = VAR_0->mv[1][0][1];", "mv_block->PMV[1][1][0] = VAR_0->mv[1][1][0];", "mv_block->PMV[1][1][1] = VAR_0->mv[1][1][1];", "}", "switch(VAR_0->mv_type) {", "case MV_TYPE_16X16:\nmv_block->motion_type = XVMC_PREDICTION_FRAME;", "break;", "case MV_TYPE_16X8:\nmv_block->motion_type = XVMC_PREDICTION_16x8;", "break;", "case MV_TYPE_FIELD:\nmv_block->motion_type = XVMC_PREDICTION_FIELD;", "if (VAR_0->picture_structure == PICT_FRAME) {", "mv_block->PMV[0][0][1] <<= 1;", "mv_block->PMV[1][0][1] <<= 1;", "mv_block->PMV[0][1][1] <<= 1;", "mv_block->PMV[1][1][1] <<= 1;", "}", "break;", "case MV_TYPE_DMV:\nmv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;", "if (VAR_0->picture_structure == PICT_FRAME) {", "mv_block->PMV[0][0][0] = VAR_0->mv[0][0][0];", "mv_block->PMV[0][0][1] = VAR_0->mv[0][0][1] << 1;", "mv_block->PMV[0][1][0] = VAR_0->mv[0][0][0];", "mv_block->PMV[0][1][1] = VAR_0->mv[0][0][1] << 1;", "mv_block->PMV[1][0][0] = VAR_0->mv[0][2][0];", "mv_block->PMV[1][0][1] = VAR_0->mv[0][2][1] << 1;", "mv_block->PMV[1][1][0] = VAR_0->mv[0][3][0];", "mv_block->PMV[1][1][1] = VAR_0->mv[0][3][1] << 1;", "} else {", "mv_block->PMV[0][1][0] = VAR_0->mv[0][2][0];", "mv_block->PMV[0][1][1] = VAR_0->mv[0][2][1];", "}", "break;", "default:\nassert(0);", "}", "mv_block->motion_vertical_field_select = 0;", "if (VAR_0->mv_type == MV_TYPE_FIELD || VAR_0->mv_type == MV_TYPE_16X8) {", "mv_block->motion_vertical_field_select |= VAR_0->field_select[0][0];", "mv_block->motion_vertical_field_select |= VAR_0->field_select[1][0] << 1;", "mv_block->motion_vertical_field_select |= VAR_0->field_select[0][1] << 2;", "mv_block->motion_vertical_field_select |= VAR_0->field_select[1][1] << 3;", "}", "}", "mv_block->index = VAR_1->next_free_data_block_num;", "VAR_4 = 6;", "if (VAR_0->chroma_format >= 2) {", "VAR_4 = 4 + (1 << VAR_0->chroma_format);", "}", "VAR_3 = 0;", "for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) {", "VAR_3 += VAR_3;", "if (VAR_0->block_last_index[VAR_2] >= 0)\nVAR_3++;", "}", "if (VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY) {", "if (VAR_0->mb_intra) {", "for (VAR_2 = 4; VAR_2 < VAR_4; VAR_2++) {", "memset(VAR_0->pblocks[VAR_2], 0, sizeof(*VAR_0->pblocks[VAR_2]));", "if (!VAR_1->unsigned_intra)\n*VAR_0->pblocks[VAR_2][0] = 1 << 10;", "}", "} else {", "VAR_3 &= 0xf << (VAR_4 - 4);", "VAR_4 = 4;", "}", "}", "mv_block->coded_block_pattern = VAR_3;", "if (VAR_3 == 0)\nmv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;", "for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) {", "if (VAR_0->block_last_index[VAR_2] >= 0) {", "if (VAR_0->mb_intra && (VAR_1->idct || !VAR_1->unsigned_intra))\n*VAR_0->pblocks[VAR_2][0] -= 1 << 10;", "if (!VAR_1->idct) {", "VAR_0->idsp.idct(*VAR_0->pblocks[VAR_2]);", "}", "if (VAR_0->avctx->xvmc_acceleration == 1) {", "memcpy(&VAR_1->data_blocks[VAR_1->next_free_data_block_num*64],\nVAR_0->pblocks[VAR_2], sizeof(*VAR_0->pblocks[VAR_2]));", "}", "VAR_1->next_free_data_block_num++;", "}", "}", "VAR_1->filled_mv_blocks_num++;", "assert(VAR_1->filled_mv_blocks_num <= VAR_1->allocated_mv_blocks);", "assert(VAR_1->next_free_data_block_num <= VAR_1->allocated_data_blocks);", "if (VAR_1->filled_mv_blocks_num == VAR_1->allocated_mv_blocks)\nff_mpeg_draw_horiz_band(VAR_0, 0, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 45 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 209 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 293 ], [ 295 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 315 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 337 ], [ 339 ], [ 351, 353 ], [ 355 ] ]
11,082
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; int i, edit_count, version; if (c->fc->nb_streams < 1 || c->ignore_editlist) return 0; sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ edit_count = avio_rb32(pb); /* entries */ if (!edit_count) return 0; if (sc->elst_data) av_log(c->fc, AV_LOG_WARNING, "Duplicated ELST atom\n"); av_free(sc->elst_data); sc->elst_count = 0; sc->elst_data = av_malloc_array(edit_count, sizeof(*sc->elst_data)); if (!sc->elst_data) return AVERROR(ENOMEM); av_log(c->fc, AV_LOG_TRACE, "track[%u].edit_count = %i\n", c->fc->nb_streams - 1, edit_count); for (i = 0; i < edit_count && !pb->eof_reached; i++) { MOVElst *e = &sc->elst_data[i]; if (version == 1) { e->duration = avio_rb64(pb); e->time = avio_rb64(pb); } else { e->duration = avio_rb32(pb); /* segment duration */ e->time = (int32_t)avio_rb32(pb); /* media time */ } e->rate = avio_rb32(pb) / 65536.0; av_log(c->fc, AV_LOG_TRACE, "duration=%"PRId64" time=%"PRId64" rate=%f\n", e->duration, e->time, e->rate); if (e->time < 0 && e->time != -1 && c->fc->strict_std_compliance >= FF_COMPLIANCE_STRICT) { av_log(c->fc, AV_LOG_ERROR, "Track %d, edit %d: Invalid edit list media time=%"PRId64"\n", c->fc->nb_streams-1, i, e->time); return AVERROR_INVALIDDATA; } } sc->elst_count = i; return 0; }
false
FFmpeg
80137531139588774e048d6e1dae34ab5cbbbfa2
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; int i, edit_count, version; if (c->fc->nb_streams < 1 || c->ignore_editlist) return 0; sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; version = avio_r8(pb); avio_rb24(pb); edit_count = avio_rb32(pb); if (!edit_count) return 0; if (sc->elst_data) av_log(c->fc, AV_LOG_WARNING, "Duplicated ELST atom\n"); av_free(sc->elst_data); sc->elst_count = 0; sc->elst_data = av_malloc_array(edit_count, sizeof(*sc->elst_data)); if (!sc->elst_data) return AVERROR(ENOMEM); av_log(c->fc, AV_LOG_TRACE, "track[%u].edit_count = %i\n", c->fc->nb_streams - 1, edit_count); for (i = 0; i < edit_count && !pb->eof_reached; i++) { MOVElst *e = &sc->elst_data[i]; if (version == 1) { e->duration = avio_rb64(pb); e->time = avio_rb64(pb); } else { e->duration = avio_rb32(pb); e->time = (int32_t)avio_rb32(pb); } e->rate = avio_rb32(pb) / 65536.0; av_log(c->fc, AV_LOG_TRACE, "duration=%"PRId64" time=%"PRId64" rate=%f\n", e->duration, e->time, e->rate); if (e->time < 0 && e->time != -1 && c->fc->strict_std_compliance >= FF_COMPLIANCE_STRICT) { av_log(c->fc, AV_LOG_ERROR, "Track %d, edit %d: Invalid edit list media time=%"PRId64"\n", c->fc->nb_streams-1, i, e->time); return AVERROR_INVALIDDATA; } } sc->elst_count = i; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { MOVStreamContext *sc; int VAR_3, VAR_4, VAR_5; if (VAR_0->fc->nb_streams < 1 || VAR_0->ignore_editlist) return 0; sc = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]->priv_data; VAR_5 = avio_r8(VAR_1); avio_rb24(VAR_1); VAR_4 = avio_rb32(VAR_1); if (!VAR_4) return 0; if (sc->elst_data) av_log(VAR_0->fc, AV_LOG_WARNING, "Duplicated ELST VAR_2\n"); av_free(sc->elst_data); sc->elst_count = 0; sc->elst_data = av_malloc_array(VAR_4, sizeof(*sc->elst_data)); if (!sc->elst_data) return AVERROR(ENOMEM); av_log(VAR_0->fc, AV_LOG_TRACE, "track[%u].VAR_4 = %VAR_3\n", VAR_0->fc->nb_streams - 1, VAR_4); for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) { MOVElst *e = &sc->elst_data[VAR_3]; if (VAR_5 == 1) { e->duration = avio_rb64(VAR_1); e->time = avio_rb64(VAR_1); } else { e->duration = avio_rb32(VAR_1); e->time = (int32_t)avio_rb32(VAR_1); } e->rate = avio_rb32(VAR_1) / 65536.0; av_log(VAR_0->fc, AV_LOG_TRACE, "duration=%"PRId64" time=%"PRId64" rate=%f\n", e->duration, e->time, e->rate); if (e->time < 0 && e->time != -1 && VAR_0->fc->strict_std_compliance >= FF_COMPLIANCE_STRICT) { av_log(VAR_0->fc, AV_LOG_ERROR, "Track %d, edit %d: Invalid edit list media time=%"PRId64"\n", VAR_0->fc->nb_streams-1, VAR_3, e->time); return AVERROR_INVALIDDATA; } } sc->elst_count = VAR_3; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "MOVStreamContext *sc;", "int VAR_3, VAR_4, VAR_5;", "if (VAR_0->fc->nb_streams < 1 || VAR_0->ignore_editlist)\nreturn 0;", "sc = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]->priv_data;", "VAR_5 = avio_r8(VAR_1);", "avio_rb24(VAR_1);", "VAR_4 = avio_rb32(VAR_1);", "if (!VAR_4)\nreturn 0;", "if (sc->elst_data)\nav_log(VAR_0->fc, AV_LOG_WARNING, \"Duplicated ELST VAR_2\\n\");", "av_free(sc->elst_data);", "sc->elst_count = 0;", "sc->elst_data = av_malloc_array(VAR_4, sizeof(*sc->elst_data));", "if (!sc->elst_data)\nreturn AVERROR(ENOMEM);", "av_log(VAR_0->fc, AV_LOG_TRACE, \"track[%u].VAR_4 = %VAR_3\\n\", VAR_0->fc->nb_streams - 1, VAR_4);", "for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) {", "MOVElst *e = &sc->elst_data[VAR_3];", "if (VAR_5 == 1) {", "e->duration = avio_rb64(VAR_1);", "e->time = avio_rb64(VAR_1);", "} else {", "e->duration = avio_rb32(VAR_1);", "e->time = (int32_t)avio_rb32(VAR_1);", "}", "e->rate = avio_rb32(VAR_1) / 65536.0;", "av_log(VAR_0->fc, AV_LOG_TRACE, \"duration=%\"PRId64\" time=%\"PRId64\" rate=%f\\n\",\ne->duration, e->time, e->rate);", "if (e->time < 0 && e->time != -1 &&\nVAR_0->fc->strict_std_compliance >= FF_COMPLIANCE_STRICT) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Track %d, edit %d: Invalid edit list media time=%\"PRId64\"\\n\",\nVAR_0->fc->nb_streams-1, VAR_3, e->time);", "return AVERROR_INVALIDDATA;", "}", "}", "sc->elst_count = VAR_3;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ] ]