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
26,253
long do_sigreturn(CPUAlphaState *env) { struct target_sigcontext *sc; abi_ulong sc_addr = env->ir[IR_A0]; target_sigset_t target_set; sigset_t set; if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1)) { goto badframe; } target_sigemptyset(&target_set); __get_user(target_set.sig[0], &sc->sc_mask); target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); restore_sigcontext(env, sc); unlock_user_struct(sc, sc_addr, 0); return env->ir[IR_V0]; badframe: force_sig(TARGET_SIGSEGV); }
false
qemu
338c858c946017cd3ec8c2be06d817e001d94bc3
long do_sigreturn(CPUAlphaState *env) { struct target_sigcontext *sc; abi_ulong sc_addr = env->ir[IR_A0]; target_sigset_t target_set; sigset_t set; if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1)) { goto badframe; } target_sigemptyset(&target_set); __get_user(target_set.sig[0], &sc->sc_mask); target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); restore_sigcontext(env, sc); unlock_user_struct(sc, sc_addr, 0); return env->ir[IR_V0]; badframe: force_sig(TARGET_SIGSEGV); }
{ "code": [], "line_no": [] }
long FUNC_0(CPUAlphaState *VAR_0) { struct target_sigcontext *VAR_1; abi_ulong sc_addr = VAR_0->ir[IR_A0]; target_sigset_t target_set; sigset_t set; if (!lock_user_struct(VERIFY_READ, VAR_1, sc_addr, 1)) { goto badframe; } target_sigemptyset(&target_set); __get_user(target_set.sig[0], &VAR_1->sc_mask); target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); restore_sigcontext(VAR_0, VAR_1); unlock_user_struct(VAR_1, sc_addr, 0); return VAR_0->ir[IR_V0]; badframe: force_sig(TARGET_SIGSEGV); }
[ "long FUNC_0(CPUAlphaState *VAR_0)\n{", "struct target_sigcontext *VAR_1;", "abi_ulong sc_addr = VAR_0->ir[IR_A0];", "target_sigset_t target_set;", "sigset_t set;", "if (!lock_user_struct(VERIFY_READ, VAR_1, sc_addr, 1)) {", "goto badframe;", "}", "target_sigemptyset(&target_set);", "__get_user(ta...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47 ] ]
26,254
static bool ide_sect_range_ok(IDEState *s, uint64_t sector, uint64_t nb_sectors) { uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); if (sector > total_sectors || nb_sectors > total_sectors - sector) { return false; } return true; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static bool ide_sect_range_ok(IDEState *s, uint64_t sector, uint64_t nb_sectors) { uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); if (sector > total_sectors || nb_sectors > total_sectors - sector) { return false; } return true; }
{ "code": [], "line_no": [] }
static bool FUNC_0(IDEState *s, uint64_t sector, uint64_t nb_sectors) { uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); if (sector > total_sectors || nb_sectors > total_sectors - sector) { return false; } return true; }
[ "static bool FUNC_0(IDEState *s,\nuint64_t sector, uint64_t nb_sectors)\n{", "uint64_t total_sectors;", "bdrv_get_geometry(s->bs, &total_sectors);", "if (sector > total_sectors || nb_sectors > total_sectors - sector) {", "return false;", "}", "return true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,255
int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, unsigned int n) { int ret = -EINPROGRESS; async_context_push(); qed_write_l1_table(s, index, n, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { qemu_aio_wait(); } async_context_pop(); return ret; }
false
qemu
384acbf46b70edf0d2c1648aa1a92a90bcf7057d
int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index, unsigned int n) { int ret = -EINPROGRESS; async_context_push(); qed_write_l1_table(s, index, n, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { qemu_aio_wait(); } async_context_pop(); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BDRVQEDState *VAR_0, unsigned int VAR_1, unsigned int VAR_2) { int VAR_3 = -EINPROGRESS; async_context_push(); qed_write_l1_table(VAR_0, VAR_1, VAR_2, qed_sync_cb, &VAR_3); while (VAR_3 == -EINPROGRESS) { qemu_aio_wait(); } async_context_pop(); return VAR_3; }
[ "int FUNC_0(BDRVQEDState *VAR_0, unsigned int VAR_1,\nunsigned int VAR_2)\n{", "int VAR_3 = -EINPROGRESS;", "async_context_push();", "qed_write_l1_table(VAR_0, VAR_1, VAR_2, qed_sync_cb, &VAR_3);", "while (VAR_3 == -EINPROGRESS) {", "qemu_aio_wait();", "}", "async_context_pop();", "return VAR_3;", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ] ]
26,256
bool memory_region_get_dirty(MemoryRegion *mr, hwaddr addr, hwaddr size, unsigned client) { assert(mr->terminates); return cpu_physical_memory_get_dirty(mr->ram_addr + addr, size, client); }
false
qemu
ec05ec26f940564b1e07bf88857035ec27e21dd8
bool memory_region_get_dirty(MemoryRegion *mr, hwaddr addr, hwaddr size, unsigned client) { assert(mr->terminates); return cpu_physical_memory_get_dirty(mr->ram_addr + addr, size, client); }
{ "code": [], "line_no": [] }
bool FUNC_0(MemoryRegion *mr, hwaddr addr, hwaddr size, unsigned client) { assert(mr->terminates); return cpu_physical_memory_get_dirty(mr->ram_addr + addr, size, client); }
[ "bool FUNC_0(MemoryRegion *mr, hwaddr addr,\nhwaddr size, unsigned client)\n{", "assert(mr->terminates);", "return cpu_physical_memory_get_dirty(mr->ram_addr + addr, size, client);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
26,258
static void filter_mirror_setup(NetFilterState *nf, Error **errp) { MirrorState *s = FILTER_MIRROR(nf); if (!s->outdev) { error_setg(errp, "filter filter mirror needs 'outdev' " "property set"); return; } s->chr_out = qemu_chr_find(s->outdev); if (s->chr_out == NULL) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", s->outdev); return; } if (qemu_chr_fe_claim(s->chr_out) != 0) { error_setg(errp, QERR_DEVICE_IN_USE, s->outdev); return; } }
false
qemu
52cfcb464255b4da5115408e2a6ce3327bbcb9df
static void filter_mirror_setup(NetFilterState *nf, Error **errp) { MirrorState *s = FILTER_MIRROR(nf); if (!s->outdev) { error_setg(errp, "filter filter mirror needs 'outdev' " "property set"); return; } s->chr_out = qemu_chr_find(s->outdev); if (s->chr_out == NULL) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", s->outdev); return; } if (qemu_chr_fe_claim(s->chr_out) != 0) { error_setg(errp, QERR_DEVICE_IN_USE, s->outdev); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(NetFilterState *VAR_0, Error **VAR_1) { MirrorState *s = FILTER_MIRROR(VAR_0); if (!s->outdev) { error_setg(VAR_1, "filter filter mirror needs 'outdev' " "property set"); return; } s->chr_out = qemu_chr_find(s->outdev); if (s->chr_out == NULL) { error_set(VAR_1, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", s->outdev); return; } if (qemu_chr_fe_claim(s->chr_out) != 0) { error_setg(VAR_1, QERR_DEVICE_IN_USE, s->outdev); return; } }
[ "static void FUNC_0(NetFilterState *VAR_0, Error **VAR_1)\n{", "MirrorState *s = FILTER_MIRROR(VAR_0);", "if (!s->outdev) {", "error_setg(VAR_1, \"filter filter mirror needs 'outdev' \"\n\"property set\");", "return;", "}", "s->chr_out = qemu_chr_find(s->outdev);", "if (s->chr_out == NULL) {", "erro...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
26,260
static void generate_eeprom_spd(uint8_t *eeprom, ram_addr_t ram_size) { enum { SDR = 0x4, DDR2 = 0x8 } type; uint8_t *spd = spd_eeprom.contents; uint8_t nbanks = 0; uint16_t density = 0; int i; /* work in terms of MB */ ram_size >>= 20; while ((ram_size >= 4) && (nbanks <= 2)) { int sz_log2 = MIN(31 - clz32(ram_size), 14); nbanks++; density |= 1 << (sz_log2 - 2); ram_size -= 1 << sz_log2; } /* split to 2 banks if possible */ if ((nbanks == 1) && (density > 1)) { nbanks++; density >>= 1; } if (density & 0xff00) { density = (density & 0xe0) | ((density >> 8) & 0x1f); type = DDR2; } else if (!(density & 0x1f)) { type = DDR2; } else { type = SDR; } if (ram_size) { fprintf(stderr, "Warning: SPD cannot represent final %dMB" " of SDRAM\n", (int)ram_size); } /* fill in SPD memory information */ spd[2] = type; spd[5] = nbanks; spd[31] = density; /* checksum */ spd[63] = 0; for (i = 0; i < 63; i++) { spd[63] += spd[i]; } /* copy for SMBUS */ memcpy(eeprom, spd, sizeof(spd_eeprom.contents)); }
false
qemu
8297be80f7cf71e09617669a8bd8b2836dcfd4c3
static void generate_eeprom_spd(uint8_t *eeprom, ram_addr_t ram_size) { enum { SDR = 0x4, DDR2 = 0x8 } type; uint8_t *spd = spd_eeprom.contents; uint8_t nbanks = 0; uint16_t density = 0; int i; ram_size >>= 20; while ((ram_size >= 4) && (nbanks <= 2)) { int sz_log2 = MIN(31 - clz32(ram_size), 14); nbanks++; density |= 1 << (sz_log2 - 2); ram_size -= 1 << sz_log2; } if ((nbanks == 1) && (density > 1)) { nbanks++; density >>= 1; } if (density & 0xff00) { density = (density & 0xe0) | ((density >> 8) & 0x1f); type = DDR2; } else if (!(density & 0x1f)) { type = DDR2; } else { type = SDR; } if (ram_size) { fprintf(stderr, "Warning: SPD cannot represent final %dMB" " of SDRAM\n", (int)ram_size); } spd[2] = type; spd[5] = nbanks; spd[31] = density; spd[63] = 0; for (i = 0; i < 63; i++) { spd[63] += spd[i]; } memcpy(eeprom, spd, sizeof(spd_eeprom.contents)); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, ram_addr_t VAR_1) { enum { SDR = 0x4, DDR2 = 0x8 } VAR_2; uint8_t *spd = spd_eeprom.contents; uint8_t nbanks = 0; uint16_t density = 0; int VAR_3; VAR_1 >>= 20; while ((VAR_1 >= 4) && (nbanks <= 2)) { int VAR_4 = MIN(31 - clz32(VAR_1), 14); nbanks++; density |= 1 << (VAR_4 - 2); VAR_1 -= 1 << VAR_4; } if ((nbanks == 1) && (density > 1)) { nbanks++; density >>= 1; } if (density & 0xff00) { density = (density & 0xe0) | ((density >> 8) & 0x1f); VAR_2 = DDR2; } else if (!(density & 0x1f)) { VAR_2 = DDR2; } else { VAR_2 = SDR; } if (VAR_1) { fprintf(stderr, "Warning: SPD cannot represent final %dMB" " of SDRAM\n", (int)VAR_1); } spd[2] = VAR_2; spd[5] = nbanks; spd[31] = density; spd[63] = 0; for (VAR_3 = 0; VAR_3 < 63; VAR_3++) { spd[63] += spd[VAR_3]; } memcpy(VAR_0, spd, sizeof(spd_eeprom.contents)); }
[ "static void FUNC_0(uint8_t *VAR_0, ram_addr_t VAR_1)\n{", "enum { SDR = 0x4, DDR2 = 0x8 } VAR_2;", "uint8_t *spd = spd_eeprom.contents;", "uint8_t nbanks = 0;", "uint16_t density = 0;", "int VAR_3;", "VAR_1 >>= 20;", "while ((VAR_1 >= 4) && (nbanks <= 2)) {", "int VAR_4 = MIN(31 - clz32(VAR_1), 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ...
26,261
static GenericList *next_list(Visitor *v, GenericList *tail, size_t size) { StringInputVisitor *siv = to_siv(v); Range *r; if (!siv->ranges || !siv->cur_range) { return NULL; } r = siv->cur_range->data; if (!r) { return NULL; } if (siv->cur < r->begin || siv->cur >= r->end) { siv->cur_range = g_list_next(siv->cur_range); if (!siv->cur_range) { return NULL; } r = siv->cur_range->data; if (!r) { return NULL; } siv->cur = r->begin; } tail->next = g_malloc0(size); return tail->next; }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static GenericList *next_list(Visitor *v, GenericList *tail, size_t size) { StringInputVisitor *siv = to_siv(v); Range *r; if (!siv->ranges || !siv->cur_range) { return NULL; } r = siv->cur_range->data; if (!r) { return NULL; } if (siv->cur < r->begin || siv->cur >= r->end) { siv->cur_range = g_list_next(siv->cur_range); if (!siv->cur_range) { return NULL; } r = siv->cur_range->data; if (!r) { return NULL; } siv->cur = r->begin; } tail->next = g_malloc0(size); return tail->next; }
{ "code": [], "line_no": [] }
static GenericList *FUNC_0(Visitor *v, GenericList *tail, size_t size) { StringInputVisitor *siv = to_siv(v); Range *r; if (!siv->ranges || !siv->cur_range) { return NULL; } r = siv->cur_range->data; if (!r) { return NULL; } if (siv->cur < r->begin || siv->cur >= r->end) { siv->cur_range = g_list_next(siv->cur_range); if (!siv->cur_range) { return NULL; } r = siv->cur_range->data; if (!r) { return NULL; } siv->cur = r->begin; } tail->next = g_malloc0(size); return tail->next; }
[ "static GenericList *FUNC_0(Visitor *v, GenericList *tail, size_t size)\n{", "StringInputVisitor *siv = to_siv(v);", "Range *r;", "if (!siv->ranges || !siv->cur_range) {", "return NULL;", "}", "r = siv->cur_range->data;", "if (!r) {", "return NULL;", "}", "if (siv->cur < r->begin || siv->cur >= ...
[ 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 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47...
26,262
static int link_filter_inouts(AVFilterContext *filt_ctx, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, void *log_ctx) { int pad, ret; for (pad = 0; pad < filt_ctx->input_count; pad++) { AVFilterInOut *p = *curr_inputs; if (p) *curr_inputs = (*curr_inputs)->next; else if (!(p = av_mallocz(sizeof(*p)))) return AVERROR(ENOMEM); if (p->filter_ctx) { if ((ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx)) < 0) return ret; av_free(p->name); av_free(p); } else { p->filter_ctx = filt_ctx; p->pad_idx = pad; append_inout(open_inputs, &p); } } if (*curr_inputs) { av_log(log_ctx, AV_LOG_ERROR, "Too many inputs specified for the \"%s\" filter.\n", filt_ctx->filter->name); return AVERROR(EINVAL); } pad = filt_ctx->output_count; while (pad--) { AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut)); if (!currlinkn) return AVERROR(ENOMEM); currlinkn->filter_ctx = filt_ctx; currlinkn->pad_idx = pad; insert_inout(curr_inputs, currlinkn); } return 0; }
false
FFmpeg
aff01de6415f1ba022f1a58e354ad6e4d0796e97
static int link_filter_inouts(AVFilterContext *filt_ctx, AVFilterInOut **curr_inputs, AVFilterInOut **open_inputs, void *log_ctx) { int pad, ret; for (pad = 0; pad < filt_ctx->input_count; pad++) { AVFilterInOut *p = *curr_inputs; if (p) *curr_inputs = (*curr_inputs)->next; else if (!(p = av_mallocz(sizeof(*p)))) return AVERROR(ENOMEM); if (p->filter_ctx) { if ((ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx)) < 0) return ret; av_free(p->name); av_free(p); } else { p->filter_ctx = filt_ctx; p->pad_idx = pad; append_inout(open_inputs, &p); } } if (*curr_inputs) { av_log(log_ctx, AV_LOG_ERROR, "Too many inputs specified for the \"%s\" filter.\n", filt_ctx->filter->name); return AVERROR(EINVAL); } pad = filt_ctx->output_count; while (pad--) { AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut)); if (!currlinkn) return AVERROR(ENOMEM); currlinkn->filter_ctx = filt_ctx; currlinkn->pad_idx = pad; insert_inout(curr_inputs, currlinkn); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0, AVFilterInOut **VAR_1, AVFilterInOut **VAR_2, void *VAR_3) { int VAR_4, VAR_5; for (VAR_4 = 0; VAR_4 < VAR_0->input_count; VAR_4++) { AVFilterInOut *p = *VAR_1; if (p) *VAR_1 = (*VAR_1)->next; else if (!(p = av_mallocz(sizeof(*p)))) return AVERROR(ENOMEM); if (p->filter_ctx) { if ((VAR_5 = link_filter(p->filter_ctx, p->pad_idx, VAR_0, VAR_4, VAR_3)) < 0) return VAR_5; av_free(p->name); av_free(p); } else { p->filter_ctx = VAR_0; p->pad_idx = VAR_4; append_inout(VAR_2, &p); } } if (*VAR_1) { av_log(VAR_3, AV_LOG_ERROR, "Too many inputs specified for the \"%s\" filter.\n", VAR_0->filter->name); return AVERROR(EINVAL); } VAR_4 = VAR_0->output_count; while (VAR_4--) { AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut)); if (!currlinkn) return AVERROR(ENOMEM); currlinkn->filter_ctx = VAR_0; currlinkn->pad_idx = VAR_4; insert_inout(VAR_1, currlinkn); } return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0,\nAVFilterInOut **VAR_1,\nAVFilterInOut **VAR_2, void *VAR_3)\n{", "int VAR_4, VAR_5;", "for (VAR_4 = 0; VAR_4 < VAR_0->input_count; VAR_4++) {", "AVFilterInOut *p = *VAR_1;", "if (p)\n*VAR_1 = (*VAR_1)->next;", "else if (!(p = av_mallocz(sizeof(*p))))\nreturn AVE...
[ 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [...
26,263
static void invalidate_and_set_dirty(hwaddr addr, hwaddr length) { if (cpu_physical_memory_range_includes_clean(addr, length)) { tb_invalidate_phys_range(addr, addr + length, 0); cpu_physical_memory_set_dirty_range_nocode(addr, length); } xen_modified_memory(addr, length); }
false
qemu
49dfcec40349245ad365964468b67e132c3cedc7
static void invalidate_and_set_dirty(hwaddr addr, hwaddr length) { if (cpu_physical_memory_range_includes_clean(addr, length)) { tb_invalidate_phys_range(addr, addr + length, 0); cpu_physical_memory_set_dirty_range_nocode(addr, length); } xen_modified_memory(addr, length); }
{ "code": [], "line_no": [] }
static void FUNC_0(hwaddr VAR_0, hwaddr VAR_1) { if (cpu_physical_memory_range_includes_clean(VAR_0, VAR_1)) { tb_invalidate_phys_range(VAR_0, VAR_0 + VAR_1, 0); cpu_physical_memory_set_dirty_range_nocode(VAR_0, VAR_1); } xen_modified_memory(VAR_0, VAR_1); }
[ "static void FUNC_0(hwaddr VAR_0,\nhwaddr VAR_1)\n{", "if (cpu_physical_memory_range_includes_clean(VAR_0, VAR_1)) {", "tb_invalidate_phys_range(VAR_0, VAR_0 + VAR_1, 0);", "cpu_physical_memory_set_dirty_range_nocode(VAR_0, VAR_1);", "}", "xen_modified_memory(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
26,264
static int proxy_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; V9fsString fullname; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name); ret = proxy_remove(ctx, fullname.data); v9fs_string_free(&fullname); return ret; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; V9fsString fullname; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name); ret = proxy_remove(ctx, fullname.data); v9fs_string_free(&fullname); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2, int VAR_3) { int VAR_4; V9fsString fullname; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2); VAR_4 = proxy_remove(VAR_0, fullname.data); v9fs_string_free(&fullname); return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nconst char *VAR_2, int VAR_3)\n{", "int VAR_4;", "V9fsString fullname;", "v9fs_string_init(&fullname);", "v9fs_string_sprintf(&fullname, \"%s/%s\", VAR_1->data, VAR_2);", "VAR_4 = proxy_remove(VAR_0, fullname.data);", "v9fs_string_free(&fullname);",...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
26,265
void virtio_scsi_common_realize(DeviceState *dev, Error **errp, VirtIOHandleOutput ctrl, VirtIOHandleOutput evt, VirtIOHandleOutput cmd) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev); int i; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues == 0 || s->conf.num_queues > VIRTIO_QUEUE_MAX - 2) { error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_QUEUE_MAX - 2); virtio_cleanup(vdev); return; } s->cmd_vqs = g_new0(VirtQueue *, s->conf.num_queues); s->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_DEFAULT_SIZE; s->ctrl_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); s->event_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, evt); for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, cmd); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
false
qemu
ad07cd69ecaffbaa015459a46975ab32e50df805
void virtio_scsi_common_realize(DeviceState *dev, Error **errp, VirtIOHandleOutput ctrl, VirtIOHandleOutput evt, VirtIOHandleOutput cmd) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev); int i; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues == 0 || s->conf.num_queues > VIRTIO_QUEUE_MAX - 2) { error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_QUEUE_MAX - 2); virtio_cleanup(vdev); return; } s->cmd_vqs = g_new0(VirtQueue *, s->conf.num_queues); s->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_DEFAULT_SIZE; s->ctrl_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, ctrl); s->event_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, evt); for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, cmd); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, Error **VAR_1, VirtIOHandleOutput VAR_2, VirtIOHandleOutput VAR_3, VirtIOHandleOutput VAR_4) { VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(VAR_0); int VAR_5; virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); if (s->conf.num_queues == 0 || s->conf.num_queues > VIRTIO_QUEUE_MAX - 2) { error_setg(VAR_1, "Invalid number of queues (= %" PRIu32 "), " "must be a positive integer less than %d.", s->conf.num_queues, VIRTIO_QUEUE_MAX - 2); virtio_cleanup(vdev); return; } s->cmd_vqs = g_new0(VirtQueue *, s->conf.num_queues); s->sense_size = VIRTIO_SCSI_SENSE_DEFAULT_SIZE; s->cdb_size = VIRTIO_SCSI_CDB_DEFAULT_SIZE; s->ctrl_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, VAR_2); s->event_vq = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, VAR_3); for (VAR_5 = 0; VAR_5 < s->conf.num_queues; VAR_5++) { s->cmd_vqs[VAR_5] = virtio_add_queue_aio(vdev, VIRTIO_SCSI_VQ_SIZE, VAR_4); } if (s->conf.iothread) { virtio_scsi_set_iothread(VIRTIO_SCSI(s), s->conf.iothread); } }
[ "void FUNC_0(DeviceState *VAR_0, Error **VAR_1,\nVirtIOHandleOutput VAR_2,\nVirtIOHandleOutput VAR_3,\nVirtIOHandleOutput VAR_4)\n{", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(VAR_0);", "int VAR_5;", "virtio_init(vdev, \"virtio-scsi\", VIRTIO_ID_SCSI,\nsizeof(Vi...
[ 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, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [...
26,266
static inline void gen_intermediate_code_internal(SPARCCPU *cpu, TranslationBlock *tb, bool spc) { CPUState *cs = CPU(cpu); CPUSPARCState *env = &cpu->env; target_ulong pc_start, last_pc; uint16_t *gen_opc_end; DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; int j, lj = -1; int num_insns; int max_insns; unsigned int insn; memset(dc, 0, sizeof(DisasContext)); dc->tb = tb; pc_start = tb->pc; dc->pc = pc_start; last_pc = dc->pc; dc->npc = (target_ulong) tb->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = cpu_mmu_index(env); dc->def = env->def; dc->fpu_enabled = tb_fpu_enabled(tb->flags); dc->address_mask_32bit = tb_am_enabled(tb->flags); dc->singlestep = (cs->singlestep_enabled || singlestep); gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_tb_start(); do { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == dc->pc) { if (dc->pc != pc_start) save_state(dc); gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); dc->is_br = 1; goto exit_gen_loop; } } } if (spc) { qemu_log("Search PC...\n"); j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) tcg_ctx.gen_opc_instr_start[lj++] = 0; tcg_ctx.gen_opc_pc[lj] = dc->pc; gen_opc_npc[lj] = dc->npc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); last_pc = dc->pc; insn = cpu_ldl_code(env, dc->pc); disas_sparc_insn(dc, insn); num_insns++; if (dc->is_br) break; /* if the next PC is different, we abort now */ if (dc->pc != (last_pc + 4)) break; /* if we reach a page boundary, we stop generation so that the PC of a TT_TFAULT exception is always in the right page */ if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0) break; /* if single step mode, we generate only one instruction and generate an exception */ if (dc->singlestep) { break; } } while ((tcg_ctx.gen_opc_ptr < gen_opc_end) && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) && num_insns < max_insns); exit_gen_loop: if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { /* static PC and NPC: we can use direct chaining */ gen_goto_tb(dc, 0, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) { tcg_gen_movi_tl(cpu_pc, dc->pc); } save_npc(dc); tcg_gen_exit_tb(0); } } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (spc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) tcg_ctx.gen_opc_instr_start[lj++] = 0; #if 0 log_page_dump(); #endif gen_opc_jump_pc[0] = dc->jump_pc[0]; gen_opc_jump_pc[1] = dc->jump_pc[1]; } else { tb->size = last_pc + 4 - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("--------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, last_pc + 4 - pc_start, 0); qemu_log("\n"); } #endif }
false
qemu
cd42d5b23691ad73edfd6dbcfc935a960a9c5a65
static inline void gen_intermediate_code_internal(SPARCCPU *cpu, TranslationBlock *tb, bool spc) { CPUState *cs = CPU(cpu); CPUSPARCState *env = &cpu->env; target_ulong pc_start, last_pc; uint16_t *gen_opc_end; DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; int j, lj = -1; int num_insns; int max_insns; unsigned int insn; memset(dc, 0, sizeof(DisasContext)); dc->tb = tb; pc_start = tb->pc; dc->pc = pc_start; last_pc = dc->pc; dc->npc = (target_ulong) tb->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = cpu_mmu_index(env); dc->def = env->def; dc->fpu_enabled = tb_fpu_enabled(tb->flags); dc->address_mask_32bit = tb_am_enabled(tb->flags); dc->singlestep = (cs->singlestep_enabled || singlestep); gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_tb_start(); do { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == dc->pc) { if (dc->pc != pc_start) save_state(dc); gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); dc->is_br = 1; goto exit_gen_loop; } } } if (spc) { qemu_log("Search PC...\n"); j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) tcg_ctx.gen_opc_instr_start[lj++] = 0; tcg_ctx.gen_opc_pc[lj] = dc->pc; gen_opc_npc[lj] = dc->npc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); last_pc = dc->pc; insn = cpu_ldl_code(env, dc->pc); disas_sparc_insn(dc, insn); num_insns++; if (dc->is_br) break; if (dc->pc != (last_pc + 4)) break; if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (dc->singlestep) { break; } } while ((tcg_ctx.gen_opc_ptr < gen_opc_end) && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) && num_insns < max_insns); exit_gen_loop: if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { gen_goto_tb(dc, 0, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) { tcg_gen_movi_tl(cpu_pc, dc->pc); } save_npc(dc); tcg_gen_exit_tb(0); } } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (spc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) tcg_ctx.gen_opc_instr_start[lj++] = 0; #if 0 log_page_dump(); #endif gen_opc_jump_pc[0] = dc->jump_pc[0]; gen_opc_jump_pc[1] = dc->jump_pc[1]; } else { tb->size = last_pc + 4 - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("--------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, last_pc + 4 - pc_start, 0); qemu_log("\n"); } #endif }
{ "code": [], "line_no": [] }
static inline void FUNC_0(SPARCCPU *VAR_0, TranslationBlock *VAR_1, bool VAR_2) { CPUState *cs = CPU(VAR_0); CPUSPARCState *env = &VAR_0->env; target_ulong pc_start, last_pc; uint16_t *gen_opc_end; DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; int VAR_3, VAR_4 = -1; int VAR_5; int VAR_6; unsigned int VAR_7; memset(dc, 0, sizeof(DisasContext)); dc->VAR_1 = VAR_1; pc_start = VAR_1->pc; dc->pc = pc_start; last_pc = dc->pc; dc->npc = (target_ulong) VAR_1->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = cpu_mmu_index(env); dc->def = env->def; dc->fpu_enabled = tb_fpu_enabled(VAR_1->flags); dc->address_mask_32bit = tb_am_enabled(VAR_1->flags); dc->singlestep = (cs->singlestep_enabled || singlestep); gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; VAR_5 = 0; VAR_6 = VAR_1->cflags & CF_COUNT_MASK; if (VAR_6 == 0) VAR_6 = CF_COUNT_MASK; gen_tb_start(); do { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == dc->pc) { if (dc->pc != pc_start) save_state(dc); gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); dc->is_br = 1; goto exit_gen_loop; } } } if (VAR_2) { qemu_log("Search PC...\n"); VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (VAR_4 < VAR_3) { VAR_4++; while (VAR_4 < VAR_3) tcg_ctx.gen_opc_instr_start[VAR_4++] = 0; tcg_ctx.gen_opc_pc[VAR_4] = dc->pc; gen_opc_npc[VAR_4] = dc->npc; tcg_ctx.gen_opc_instr_start[VAR_4] = 1; tcg_ctx.gen_opc_icount[VAR_4] = VAR_5; } } if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) gen_io_start(); last_pc = dc->pc; VAR_7 = cpu_ldl_code(env, dc->pc); disas_sparc_insn(dc, VAR_7); VAR_5++; if (dc->is_br) break; if (dc->pc != (last_pc + 4)) break; if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (dc->singlestep) { break; } } while ((tcg_ctx.gen_opc_ptr < gen_opc_end) && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) && VAR_5 < VAR_6); exit_gen_loop: if (VAR_1->cflags & CF_LAST_IO) { gen_io_end(); } if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { gen_goto_tb(dc, 0, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) { tcg_gen_movi_tl(cpu_pc, dc->pc); } save_npc(dc); tcg_gen_exit_tb(0); } } gen_tb_end(VAR_1, VAR_5); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (VAR_2) { VAR_3 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; VAR_4++; while (VAR_4 <= VAR_3) tcg_ctx.gen_opc_instr_start[VAR_4++] = 0; #if 0 log_page_dump(); #endif gen_opc_jump_pc[0] = dc->jump_pc[0]; gen_opc_jump_pc[1] = dc->jump_pc[1]; } else { VAR_1->size = last_pc + 4 - pc_start; VAR_1->icount = VAR_5; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("--------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, last_pc + 4 - pc_start, 0); qemu_log("\n"); } #endif }
[ "static inline void FUNC_0(SPARCCPU *VAR_0,\nTranslationBlock *VAR_1,\nbool VAR_2)\n{", "CPUState *cs = CPU(VAR_0);", "CPUSPARCState *env = &VAR_0->env;", "target_ulong pc_start, last_pc;", "uint16_t *gen_opc_end;", "DisasContext dc1, *dc = &dc1;", "CPUBreakpoint *bp;", "int VAR_3, VAR_4 = -1;", "in...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43 ], [ 45 ...
26,267
static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, int *is_linux, uint8_t image_type, uint64_t (*translate_fn)(void *, uint64_t), void *translate_opaque) { int fd; int size; hwaddr address; uboot_image_header_t h; uboot_image_header_t *hdr = &h; uint8_t *data = NULL; int ret = -1; int do_uncompress = 0; fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) return -1; size = read(fd, hdr, sizeof(uboot_image_header_t)); if (size < 0) goto out; bswap_uboot_header(hdr); if (hdr->ih_magic != IH_MAGIC) goto out; if (hdr->ih_type != image_type) { fprintf(stderr, "Wrong image type %d, expected %d\n", hdr->ih_type, image_type); goto out; } /* TODO: Implement other image types. */ switch (hdr->ih_type) { case IH_TYPE_KERNEL: address = hdr->ih_load; if (translate_fn) { address = translate_fn(translate_opaque, address); } if (loadaddr) { *loadaddr = hdr->ih_load; } switch (hdr->ih_comp) { case IH_COMP_NONE: break; case IH_COMP_GZIP: do_uncompress = 1; break; default: fprintf(stderr, "Unable to load u-boot images with compression type %d\n", hdr->ih_comp); goto out; } if (ep) { *ep = hdr->ih_ep; } /* TODO: Check CPU type. */ if (is_linux) { if (hdr->ih_os == IH_OS_LINUX) { *is_linux = 1; } else { *is_linux = 0; } } break; case IH_TYPE_RAMDISK: address = *loadaddr; break; default: fprintf(stderr, "Unsupported u-boot image type %d\n", hdr->ih_type); goto out; } data = g_malloc(hdr->ih_size); if (read(fd, data, hdr->ih_size) != hdr->ih_size) { fprintf(stderr, "Error reading file\n"); goto out; } if (do_uncompress) { uint8_t *compressed_data; size_t max_bytes; ssize_t bytes; compressed_data = data; max_bytes = UBOOT_MAX_GUNZIP_BYTES; data = g_malloc(max_bytes); bytes = gunzip(data, max_bytes, compressed_data, hdr->ih_size); g_free(compressed_data); if (bytes < 0) { fprintf(stderr, "Unable to decompress gzipped image!\n"); goto out; } hdr->ih_size = bytes; } rom_add_blob_fixed(filename, data, hdr->ih_size, address); ret = hdr->ih_size; out: if (data) g_free(data); close(fd); return ret; }
false
qemu
ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374
static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr, int *is_linux, uint8_t image_type, uint64_t (*translate_fn)(void *, uint64_t), void *translate_opaque) { int fd; int size; hwaddr address; uboot_image_header_t h; uboot_image_header_t *hdr = &h; uint8_t *data = NULL; int ret = -1; int do_uncompress = 0; fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) return -1; size = read(fd, hdr, sizeof(uboot_image_header_t)); if (size < 0) goto out; bswap_uboot_header(hdr); if (hdr->ih_magic != IH_MAGIC) goto out; if (hdr->ih_type != image_type) { fprintf(stderr, "Wrong image type %d, expected %d\n", hdr->ih_type, image_type); goto out; } switch (hdr->ih_type) { case IH_TYPE_KERNEL: address = hdr->ih_load; if (translate_fn) { address = translate_fn(translate_opaque, address); } if (loadaddr) { *loadaddr = hdr->ih_load; } switch (hdr->ih_comp) { case IH_COMP_NONE: break; case IH_COMP_GZIP: do_uncompress = 1; break; default: fprintf(stderr, "Unable to load u-boot images with compression type %d\n", hdr->ih_comp); goto out; } if (ep) { *ep = hdr->ih_ep; } if (is_linux) { if (hdr->ih_os == IH_OS_LINUX) { *is_linux = 1; } else { *is_linux = 0; } } break; case IH_TYPE_RAMDISK: address = *loadaddr; break; default: fprintf(stderr, "Unsupported u-boot image type %d\n", hdr->ih_type); goto out; } data = g_malloc(hdr->ih_size); if (read(fd, data, hdr->ih_size) != hdr->ih_size) { fprintf(stderr, "Error reading file\n"); goto out; } if (do_uncompress) { uint8_t *compressed_data; size_t max_bytes; ssize_t bytes; compressed_data = data; max_bytes = UBOOT_MAX_GUNZIP_BYTES; data = g_malloc(max_bytes); bytes = gunzip(data, max_bytes, compressed_data, hdr->ih_size); g_free(compressed_data); if (bytes < 0) { fprintf(stderr, "Unable to decompress gzipped image!\n"); goto out; } hdr->ih_size = bytes; } rom_add_blob_fixed(filename, data, hdr->ih_size, address); ret = hdr->ih_size; out: if (data) g_free(data); close(fd); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, hwaddr *VAR_1, hwaddr *VAR_2, int *VAR_3, uint8_t VAR_4, VAR_5 (*translate_fn)(void *, VAR_5), void *VAR_6) { int VAR_7; int VAR_8; hwaddr address; uboot_image_header_t h; uboot_image_header_t *hdr = &h; uint8_t *data = NULL; int VAR_9 = -1; int VAR_10 = 0; VAR_7 = open(VAR_0, O_RDONLY | O_BINARY); if (VAR_7 < 0) return -1; VAR_8 = read(VAR_7, hdr, sizeof(uboot_image_header_t)); if (VAR_8 < 0) goto out; bswap_uboot_header(hdr); if (hdr->ih_magic != IH_MAGIC) goto out; if (hdr->ih_type != VAR_4) { fprintf(stderr, "Wrong image type %d, expected %d\n", hdr->ih_type, VAR_4); goto out; } switch (hdr->ih_type) { case IH_TYPE_KERNEL: address = hdr->ih_load; if (translate_fn) { address = translate_fn(VAR_6, address); } if (VAR_2) { *VAR_2 = hdr->ih_load; } switch (hdr->ih_comp) { case IH_COMP_NONE: break; case IH_COMP_GZIP: VAR_10 = 1; break; default: fprintf(stderr, "Unable to load u-boot images with compression type %d\n", hdr->ih_comp); goto out; } if (VAR_1) { *VAR_1 = hdr->ih_ep; } if (VAR_3) { if (hdr->ih_os == IH_OS_LINUX) { *VAR_3 = 1; } else { *VAR_3 = 0; } } break; case IH_TYPE_RAMDISK: address = *VAR_2; break; default: fprintf(stderr, "Unsupported u-boot image type %d\n", hdr->ih_type); goto out; } data = g_malloc(hdr->ih_size); if (read(VAR_7, data, hdr->ih_size) != hdr->ih_size) { fprintf(stderr, "Error reading file\n"); goto out; } if (VAR_10) { uint8_t *compressed_data; size_t max_bytes; ssize_t bytes; compressed_data = data; max_bytes = UBOOT_MAX_GUNZIP_BYTES; data = g_malloc(max_bytes); bytes = gunzip(data, max_bytes, compressed_data, hdr->ih_size); g_free(compressed_data); if (bytes < 0) { fprintf(stderr, "Unable to decompress gzipped image!\n"); goto out; } hdr->ih_size = bytes; } rom_add_blob_fixed(VAR_0, data, hdr->ih_size, address); VAR_9 = hdr->ih_size; out: if (data) g_free(data); close(VAR_7); return VAR_9; }
[ "static int FUNC_0(const char *VAR_0, hwaddr *VAR_1, hwaddr *VAR_2,\nint *VAR_3, uint8_t VAR_4,\nVAR_5 (*translate_fn)(void *, VAR_5),\nvoid *VAR_6)\n{", "int VAR_7;", "int VAR_8;", "hwaddr address;", "uboot_image_header_t h;", "uboot_image_header_t *hdr = &h;", "uint8_t *data = NULL;", "int VAR_9 = -...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 57,...
26,268
static void stellaris_init(const char *kernel_filename, const char *cpu_model, DisplayState *ds, stellaris_board_info *board) { static const int uart_irq[] = {5, 6, 33, 34}; static const int timer_irq[] = {19, 21, 23, 35}; static const uint32_t gpio_addr[7] = { 0x40004000, 0x40005000, 0x40006000, 0x40007000, 0x40024000, 0x40025000, 0x40026000}; static const int gpio_irq[7] = {0, 1, 2, 3, 4, 30, 31}; qemu_irq *pic; qemu_irq *gpio_in[7]; qemu_irq *gpio_out[7]; qemu_irq adc; int sram_size; int flash_size; i2c_bus *i2c; int i; flash_size = ((board->dc0 & 0xffff) + 1) << 1; sram_size = (board->dc0 >> 18) + 1; pic = armv7m_init(flash_size, sram_size, kernel_filename, cpu_model); if (board->dc1 & (1 << 16)) { adc = stellaris_adc_init(0x40038000, pic[14]); } else { adc = NULL; } for (i = 0; i < 4; i++) { if (board->dc2 & (0x10000 << i)) { stellaris_gptm_init(0x40030000 + i * 0x1000, pic[timer_irq[i]], adc); } } stellaris_sys_init(0x400fe000, pic[28], board, nd_table[0].macaddr); for (i = 0; i < 7; i++) { if (board->dc4 & (1 << i)) { gpio_in[i] = pl061_init(gpio_addr[i], pic[gpio_irq[i]], &gpio_out[i]); } } if (board->dc2 & (1 << 12)) { i2c = i2c_init_bus(); stellaris_i2c_init(0x40020000, pic[8], i2c); if (board->peripherals & BP_OLED_I2C) { ssd0303_init(ds, i2c, 0x3d); } } for (i = 0; i < 4; i++) { if (board->dc2 & (1 << i)) { pl011_init(0x4000c000 + i * 0x1000, pic[uart_irq[i]], serial_hds[i], PL011_LUMINARY); } } if (board->dc2 & (1 << 4)) { if (board->peripherals & BP_OLED_SSI) { void * oled; void * sd; void *ssi_bus; int index; oled = ssd0323_init(ds, &gpio_out[GPIO_C][7]); index = drive_get_index(IF_SD, 0, 0); sd = ssi_sd_init(drives_table[index].bdrv); ssi_bus = stellaris_ssi_bus_init(&gpio_out[GPIO_D][0], ssi_sd_xfer, sd, ssd0323_xfer_ssi, oled); pl022_init(0x40008000, pic[7], stellaris_ssi_bus_xfer, ssi_bus); /* Make sure the select pin is high. */ qemu_irq_raise(gpio_out[GPIO_D][0]); } else { pl022_init(0x40008000, pic[7], NULL, NULL); } } if (board->dc4 & (1 << 28)) { /* FIXME: Obey network model. */ stellaris_enet_init(&nd_table[0], 0x40048000, pic[42]); } if (board->peripherals & BP_GAMEPAD) { qemu_irq gpad_irq[5]; static const int gpad_keycode[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; gpad_irq[0] = qemu_irq_invert(gpio_in[GPIO_E][0]); /* up */ gpad_irq[1] = qemu_irq_invert(gpio_in[GPIO_E][1]); /* down */ gpad_irq[2] = qemu_irq_invert(gpio_in[GPIO_E][2]); /* left */ gpad_irq[3] = qemu_irq_invert(gpio_in[GPIO_E][3]); /* right */ gpad_irq[4] = qemu_irq_invert(gpio_in[GPIO_F][1]); /* select */ stellaris_gamepad_init(5, gpad_irq, gpad_keycode); } }
false
qemu
0ae18ceeaaa2c1749e742c4b112f6c3bf0896408
static void stellaris_init(const char *kernel_filename, const char *cpu_model, DisplayState *ds, stellaris_board_info *board) { static const int uart_irq[] = {5, 6, 33, 34}; static const int timer_irq[] = {19, 21, 23, 35}; static const uint32_t gpio_addr[7] = { 0x40004000, 0x40005000, 0x40006000, 0x40007000, 0x40024000, 0x40025000, 0x40026000}; static const int gpio_irq[7] = {0, 1, 2, 3, 4, 30, 31}; qemu_irq *pic; qemu_irq *gpio_in[7]; qemu_irq *gpio_out[7]; qemu_irq adc; int sram_size; int flash_size; i2c_bus *i2c; int i; flash_size = ((board->dc0 & 0xffff) + 1) << 1; sram_size = (board->dc0 >> 18) + 1; pic = armv7m_init(flash_size, sram_size, kernel_filename, cpu_model); if (board->dc1 & (1 << 16)) { adc = stellaris_adc_init(0x40038000, pic[14]); } else { adc = NULL; } for (i = 0; i < 4; i++) { if (board->dc2 & (0x10000 << i)) { stellaris_gptm_init(0x40030000 + i * 0x1000, pic[timer_irq[i]], adc); } } stellaris_sys_init(0x400fe000, pic[28], board, nd_table[0].macaddr); for (i = 0; i < 7; i++) { if (board->dc4 & (1 << i)) { gpio_in[i] = pl061_init(gpio_addr[i], pic[gpio_irq[i]], &gpio_out[i]); } } if (board->dc2 & (1 << 12)) { i2c = i2c_init_bus(); stellaris_i2c_init(0x40020000, pic[8], i2c); if (board->peripherals & BP_OLED_I2C) { ssd0303_init(ds, i2c, 0x3d); } } for (i = 0; i < 4; i++) { if (board->dc2 & (1 << i)) { pl011_init(0x4000c000 + i * 0x1000, pic[uart_irq[i]], serial_hds[i], PL011_LUMINARY); } } if (board->dc2 & (1 << 4)) { if (board->peripherals & BP_OLED_SSI) { void * oled; void * sd; void *ssi_bus; int index; oled = ssd0323_init(ds, &gpio_out[GPIO_C][7]); index = drive_get_index(IF_SD, 0, 0); sd = ssi_sd_init(drives_table[index].bdrv); ssi_bus = stellaris_ssi_bus_init(&gpio_out[GPIO_D][0], ssi_sd_xfer, sd, ssd0323_xfer_ssi, oled); pl022_init(0x40008000, pic[7], stellaris_ssi_bus_xfer, ssi_bus); qemu_irq_raise(gpio_out[GPIO_D][0]); } else { pl022_init(0x40008000, pic[7], NULL, NULL); } } if (board->dc4 & (1 << 28)) { stellaris_enet_init(&nd_table[0], 0x40048000, pic[42]); } if (board->peripherals & BP_GAMEPAD) { qemu_irq gpad_irq[5]; static const int gpad_keycode[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; gpad_irq[0] = qemu_irq_invert(gpio_in[GPIO_E][0]); gpad_irq[1] = qemu_irq_invert(gpio_in[GPIO_E][1]); gpad_irq[2] = qemu_irq_invert(gpio_in[GPIO_E][2]); gpad_irq[3] = qemu_irq_invert(gpio_in[GPIO_E][3]); gpad_irq[4] = qemu_irq_invert(gpio_in[GPIO_F][1]); stellaris_gamepad_init(5, gpad_irq, gpad_keycode); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0, const char *VAR_1, DisplayState *VAR_2, stellaris_board_info *VAR_3) { static const int VAR_4[] = {5, 6, 33, 34}; static const int VAR_5[] = {19, 21, 23, 35}; static const uint32_t VAR_6[7] = { 0x40004000, 0x40005000, 0x40006000, 0x40007000, 0x40024000, 0x40025000, 0x40026000}; static const int VAR_7[7] = {0, 1, 2, 3, 4, 30, 31}; qemu_irq *pic; qemu_irq *gpio_in[7]; qemu_irq *gpio_out[7]; qemu_irq adc; int VAR_8; int VAR_9; i2c_bus *i2c; int VAR_10; VAR_9 = ((VAR_3->dc0 & 0xffff) + 1) << 1; VAR_8 = (VAR_3->dc0 >> 18) + 1; pic = armv7m_init(VAR_9, VAR_8, VAR_0, VAR_1); if (VAR_3->dc1 & (1 << 16)) { adc = stellaris_adc_init(0x40038000, pic[14]); } else { adc = NULL; } for (VAR_10 = 0; VAR_10 < 4; VAR_10++) { if (VAR_3->dc2 & (0x10000 << VAR_10)) { stellaris_gptm_init(0x40030000 + VAR_10 * 0x1000, pic[VAR_5[VAR_10]], adc); } } stellaris_sys_init(0x400fe000, pic[28], VAR_3, nd_table[0].macaddr); for (VAR_10 = 0; VAR_10 < 7; VAR_10++) { if (VAR_3->dc4 & (1 << VAR_10)) { gpio_in[VAR_10] = pl061_init(VAR_6[VAR_10], pic[VAR_7[VAR_10]], &gpio_out[VAR_10]); } } if (VAR_3->dc2 & (1 << 12)) { i2c = i2c_init_bus(); stellaris_i2c_init(0x40020000, pic[8], i2c); if (VAR_3->peripherals & BP_OLED_I2C) { ssd0303_init(VAR_2, i2c, 0x3d); } } for (VAR_10 = 0; VAR_10 < 4; VAR_10++) { if (VAR_3->dc2 & (1 << VAR_10)) { pl011_init(0x4000c000 + VAR_10 * 0x1000, pic[VAR_4[VAR_10]], serial_hds[VAR_10], PL011_LUMINARY); } } if (VAR_3->dc2 & (1 << 4)) { if (VAR_3->peripherals & BP_OLED_SSI) { void * VAR_11; void * VAR_12; void *VAR_13; int VAR_14; VAR_11 = ssd0323_init(VAR_2, &gpio_out[GPIO_C][7]); VAR_14 = drive_get_index(IF_SD, 0, 0); VAR_12 = ssi_sd_init(drives_table[VAR_14].bdrv); VAR_13 = stellaris_ssi_bus_init(&gpio_out[GPIO_D][0], ssi_sd_xfer, VAR_12, ssd0323_xfer_ssi, VAR_11); pl022_init(0x40008000, pic[7], stellaris_ssi_bus_xfer, VAR_13); qemu_irq_raise(gpio_out[GPIO_D][0]); } else { pl022_init(0x40008000, pic[7], NULL, NULL); } } if (VAR_3->dc4 & (1 << 28)) { stellaris_enet_init(&nd_table[0], 0x40048000, pic[42]); } if (VAR_3->peripherals & BP_GAMEPAD) { qemu_irq gpad_irq[5]; static const int VAR_15[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; gpad_irq[0] = qemu_irq_invert(gpio_in[GPIO_E][0]); gpad_irq[1] = qemu_irq_invert(gpio_in[GPIO_E][1]); gpad_irq[2] = qemu_irq_invert(gpio_in[GPIO_E][2]); gpad_irq[3] = qemu_irq_invert(gpio_in[GPIO_E][3]); gpad_irq[4] = qemu_irq_invert(gpio_in[GPIO_F][1]); stellaris_gamepad_init(5, gpad_irq, VAR_15); } }
[ "static void FUNC_0(const char *VAR_0, const char *VAR_1,\nDisplayState *VAR_2, stellaris_board_info *VAR_3)\n{", "static const int VAR_4[] = {5, 6, 33, 34};", "static const int VAR_5[] = {19, 21, 23, 35};", "static const uint32_t VAR_6[7] =\n{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,", "0x40024000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ...
26,269
static int pcnet_can_receive(void *opaque) { PCNetState *s = opaque; if (CSR_STOP(s) || CSR_SPND(s)) return 0; if (s->recv_pos > 0) return 0; return sizeof(s->buffer)-16; }
false
qemu
e3f5ec2b5e92706e3b807059f79b1fb5d936e567
static int pcnet_can_receive(void *opaque) { PCNetState *s = opaque; if (CSR_STOP(s) || CSR_SPND(s)) return 0; if (s->recv_pos > 0) return 0; return sizeof(s->buffer)-16; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { PCNetState *s = VAR_0; if (CSR_STOP(s) || CSR_SPND(s)) return 0; if (s->recv_pos > 0) return 0; return sizeof(s->buffer)-16; }
[ "static int FUNC_0(void *VAR_0)\n{", "PCNetState *s = VAR_0;", "if (CSR_STOP(s) || CSR_SPND(s))\nreturn 0;", "if (s->recv_pos > 0)\nreturn 0;", "return sizeof(s->buffer)-16;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13, 15 ], [ 19 ], [ 21 ] ]
26,270
static int write_object(int fd, char *buf, uint64_t oid, int copies, unsigned int datalen, uint64_t offset, bool create, bool cache) { return read_write_object(fd, buf, oid, copies, datalen, offset, true, create, cache); }
false
qemu
0e7106d8b5f7ef4f9df10baf1dfb3db482bcd046
static int write_object(int fd, char *buf, uint64_t oid, int copies, unsigned int datalen, uint64_t offset, bool create, bool cache) { return read_write_object(fd, buf, oid, copies, datalen, offset, true, create, cache); }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, char *VAR_1, uint64_t VAR_2, int VAR_3, unsigned int VAR_4, uint64_t VAR_5, bool VAR_6, bool VAR_7) { return read_write_object(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, true, VAR_6, VAR_7); }
[ "static int FUNC_0(int VAR_0, char *VAR_1, uint64_t VAR_2, int VAR_3,\nunsigned int VAR_4, uint64_t VAR_5, bool VAR_6,\nbool VAR_7)\n{", "return read_write_object(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, true,\nVAR_6, VAR_7);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ] ]
26,271
static uint32_t cuda_readw (void *opaque, target_phys_addr_t addr) { return 0; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint32_t cuda_readw (void *opaque, target_phys_addr_t addr) { return 0; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0 (void *opaque, target_phys_addr_t addr) { return 0; }
[ "static uint32_t FUNC_0 (void *opaque, target_phys_addr_t addr)\n{", "return 0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,272
void helper_iret_protected(int shift, int next_eip) { int tss_selector, type; uint32_t e1, e2; /* specific case for TSS */ if (env->eflags & NT_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) raise_exception_err(EXCP0D_GPF, 0); #endif tss_selector = lduw_kernel(env->tr.base + 0); if (tss_selector & 4) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); if (load_segment(&e1, &e2, tss_selector) != 0) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); type = (e2 >> DESC_TYPE_SHIFT) & 0x17; /* NOTE: we check both segment and busy TSS */ if (type != 3) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); switch_tss(tss_selector, e1, e2, SWITCH_TSS_IRET, next_eip); } else { helper_ret_protected(shift, 1, 0); } env->hflags2 &= ~HF2_NMI_MASK; #ifdef CONFIG_KQEMU if (kqemu_is_ok(env)) { CC_OP = CC_OP_EFLAGS; env->exception_index = -1; cpu_loop_exit(); } #endif }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
void helper_iret_protected(int shift, int next_eip) { int tss_selector, type; uint32_t e1, e2; if (env->eflags & NT_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) raise_exception_err(EXCP0D_GPF, 0); #endif tss_selector = lduw_kernel(env->tr.base + 0); if (tss_selector & 4) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); if (load_segment(&e1, &e2, tss_selector) != 0) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); type = (e2 >> DESC_TYPE_SHIFT) & 0x17; if (type != 3) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); switch_tss(tss_selector, e1, e2, SWITCH_TSS_IRET, next_eip); } else { helper_ret_protected(shift, 1, 0); } env->hflags2 &= ~HF2_NMI_MASK; #ifdef CONFIG_KQEMU if (kqemu_is_ok(env)) { CC_OP = CC_OP_EFLAGS; env->exception_index = -1; cpu_loop_exit(); } #endif }
{ "code": [], "line_no": [] }
void FUNC_0(int VAR_0, int VAR_1) { int VAR_2, VAR_3; uint32_t e1, e2; if (env->eflags & NT_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) raise_exception_err(EXCP0D_GPF, 0); #endif VAR_2 = lduw_kernel(env->tr.base + 0); if (VAR_2 & 4) raise_exception_err(EXCP0A_TSS, VAR_2 & 0xfffc); if (load_segment(&e1, &e2, VAR_2) != 0) raise_exception_err(EXCP0A_TSS, VAR_2 & 0xfffc); VAR_3 = (e2 >> DESC_TYPE_SHIFT) & 0x17; if (VAR_3 != 3) raise_exception_err(EXCP0A_TSS, VAR_2 & 0xfffc); switch_tss(VAR_2, e1, e2, SWITCH_TSS_IRET, VAR_1); } else { helper_ret_protected(VAR_0, 1, 0); } env->hflags2 &= ~HF2_NMI_MASK; #ifdef CONFIG_KQEMU if (kqemu_is_ok(env)) { CC_OP = CC_OP_EFLAGS; env->exception_index = -1; cpu_loop_exit(); } #endif }
[ "void FUNC_0(int VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3;", "uint32_t e1, e2;", "if (env->eflags & NT_MASK) {", "#ifdef TARGET_X86_64\nif (env->hflags & HF_LMA_MASK)\nraise_exception_err(EXCP0D_GPF, 0);", "#endif\nVAR_2 = lduw_kernel(env->tr.base + 0);", "if (VAR_2 & 4)\nraise_exception_err(EXCP0A_TSS,...
[ 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 ], [ 13 ], [ 15, 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], ...
26,273
static void blend_image_rgba(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y) { blend_image_packed_rgb(ctx, dst, src, 1, x, y, 0); }
false
FFmpeg
6260ab60a80fd8baebf79f9ce9299b0db72333b5
static void blend_image_rgba(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, int x, int y) { blend_image_packed_rgb(ctx, dst, src, 1, x, y, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1, const AVFrame *VAR_2, int VAR_3, int VAR_4) { blend_image_packed_rgb(VAR_0, VAR_1, VAR_2, 1, VAR_3, VAR_4, 0); }
[ "static void FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1, const AVFrame *VAR_2, int VAR_3, int VAR_4)\n{", "blend_image_packed_rgb(VAR_0, VAR_1, VAR_2, 1, VAR_3, VAR_4, 0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,274
static void bonito_spciconf_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) { PCIBonitoState *s = opaque; PCIDevice *d = PCI_DEVICE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost); uint32_t pciaddr; uint16_t status; DPRINTF("bonito_spciconf_writeb "TARGET_FMT_plx" val %x\n", addr, val); pciaddr = bonito_sbridge_pciaddr(s, addr); if (pciaddr == 0xffffffff) { return; } /* set the pci address in s->config_reg */ phb->config_reg = (pciaddr) | (1u << 31); pci_data_write(phb->bus, phb->config_reg, val & 0xff, 1); /* clear PCI_STATUS_REC_MASTER_ABORT and PCI_STATUS_REC_TARGET_ABORT */ status = pci_get_word(d->config + PCI_STATUS); status &= ~(PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT); pci_set_word(d->config + PCI_STATUS, status); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void bonito_spciconf_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) { PCIBonitoState *s = opaque; PCIDevice *d = PCI_DEVICE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost); uint32_t pciaddr; uint16_t status; DPRINTF("bonito_spciconf_writeb "TARGET_FMT_plx" val %x\n", addr, val); pciaddr = bonito_sbridge_pciaddr(s, addr); if (pciaddr == 0xffffffff) { return; } phb->config_reg = (pciaddr) | (1u << 31); pci_data_write(phb->bus, phb->config_reg, val & 0xff, 1); status = pci_get_word(d->config + PCI_STATUS); status &= ~(PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT); pci_set_word(d->config + PCI_STATUS, status); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { PCIBonitoState *s = VAR_0; PCIDevice *d = PCI_DEVICE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost); uint32_t pciaddr; uint16_t status; DPRINTF("FUNC_0 "TARGET_FMT_plx" VAR_2 %x\n", VAR_1, VAR_2); pciaddr = bonito_sbridge_pciaddr(s, VAR_1); if (pciaddr == 0xffffffff) { return; } phb->config_reg = (pciaddr) | (1u << 31); pci_data_write(phb->bus, phb->config_reg, VAR_2 & 0xff, 1); status = pci_get_word(d->config + PCI_STATUS); status &= ~(PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT); pci_set_word(d->config + PCI_STATUS, status); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "PCIBonitoState *s = VAR_0;", "PCIDevice *d = PCI_DEVICE(s);", "PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);", "uint32_t pciaddr;", "uint16_t status;", "DPRINTF(\"FUNC_0 \"TARGET_FMT_plx\" VAR_2 %x\\n\", VAR_1, VAR_2);"...
[ 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 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
26,276
pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid) { PVSCSIRequest *pvscsi_req = req->hba_private; PVSCSIState *s = pvscsi_req->dev; if (!pvscsi_req) { trace_pvscsi_command_complete_not_found(req->tag); return; } if (resid) { /* Short transfer. */ trace_pvscsi_command_complete_data_run(); pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN; } pvscsi_req->cmp.scsiStatus = status; if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) { uint8_t sense[SCSI_SENSE_BUF_SIZE]; int sense_len = scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense)); trace_pvscsi_command_complete_sense_len(sense_len); pvscsi_write_sense(pvscsi_req, sense, sense_len); } qemu_sglist_destroy(&pvscsi_req->sgl); pvscsi_complete_request(s, pvscsi_req); }
false
qemu
b0f49d138777fb6609aa2ea96d2c59fb872d2c2d
pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid) { PVSCSIRequest *pvscsi_req = req->hba_private; PVSCSIState *s = pvscsi_req->dev; if (!pvscsi_req) { trace_pvscsi_command_complete_not_found(req->tag); return; } if (resid) { trace_pvscsi_command_complete_data_run(); pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN; } pvscsi_req->cmp.scsiStatus = status; if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) { uint8_t sense[SCSI_SENSE_BUF_SIZE]; int sense_len = scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense)); trace_pvscsi_command_complete_sense_len(sense_len); pvscsi_write_sense(pvscsi_req, sense, sense_len); } qemu_sglist_destroy(&pvscsi_req->sgl); pvscsi_complete_request(s, pvscsi_req); }
{ "code": [], "line_no": [] }
FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1, size_t VAR_2) { PVSCSIRequest *pvscsi_req = VAR_0->hba_private; PVSCSIState *s = pvscsi_req->dev; if (!pvscsi_req) { trace_pvscsi_command_complete_not_found(VAR_0->tag); return; } if (VAR_2) { trace_pvscsi_command_complete_data_run(); pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN; } pvscsi_req->cmp.scsiStatus = VAR_1; if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) { uint8_t sense[SCSI_SENSE_BUF_SIZE]; int VAR_3 = scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense)); trace_pvscsi_command_complete_sense_len(VAR_3); pvscsi_write_sense(pvscsi_req, sense, VAR_3); } qemu_sglist_destroy(&pvscsi_req->sgl); pvscsi_complete_request(s, pvscsi_req); }
[ "FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1, size_t VAR_2)\n{", "PVSCSIRequest *pvscsi_req = VAR_0->hba_private;", "PVSCSIState *s = pvscsi_req->dev;", "if (!pvscsi_req) {", "trace_pvscsi_command_complete_not_found(VAR_0->tag);", "return;", "}", "if (VAR_2) {", "trace_pvscsi_command_complete_data_run...
[ 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 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], ...
26,277
static int proxy_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { fs->fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, flags); if (fs->fd < 0) { errno = -fs->fd; fs->fd = -1; } return fs->fd; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { fs->fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, flags); if (fs->fd < 0) { errno = -fs->fd; fs->fd = -1; } return fs->fd; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, int VAR_2, V9fsFidOpenState *VAR_3) { VAR_3->fd = v9fs_request(VAR_0->private, T_OPEN, NULL, "sd", VAR_1, VAR_2); if (VAR_3->fd < 0) { errno = -VAR_3->fd; VAR_3->fd = -1; } return VAR_3->fd; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nint VAR_2, V9fsFidOpenState *VAR_3)\n{", "VAR_3->fd = v9fs_request(VAR_0->private, T_OPEN, NULL, \"sd\", VAR_1, VAR_2);", "if (VAR_3->fd < 0) {", "errno = -VAR_3->fd;", "VAR_3->fd = -1;", "}", "return VAR_3->fd;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
26,278
void mips_r4k_init (ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { char buf[1024]; unsigned long bios_offset; int bios_size; CPUState *env; RTCState *rtc_state; int i; qemu_irq *i8259; int index; BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; /* init CPUs */ if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "R4000"; #else cpu_model = "24Kf"; #endif } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } qemu_register_reset(main_cpu_reset, env); /* allocate RAM */ cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); if (!mips_qemu_iomemtype) { mips_qemu_iomemtype = cpu_register_io_memory(0, mips_qemu_read, mips_qemu_write, NULL); } cpu_register_physical_memory(0x1fbf0000, 0x10000, mips_qemu_iomemtype); /* Try to load a BIOS image. If this fails, we continue regardless, but initialize the hardware ourselves. When a kernel gets preloaded we also initialize the hardware, since the BIOS wasn't run. */ bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = load_image(buf, phys_ram_base + bios_offset); if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { cpu_register_physical_memory(0x1fc00000, BIOS_SIZE, bios_offset | IO_MEM_ROM); } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) { uint32_t mips_rom = 0x00400000; cpu_register_physical_memory(0x1fc00000, mips_rom, qemu_ram_alloc(mips_rom) | IO_MEM_ROM); if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom), drives_table[index].bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else { /* not fatal */ fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", buf); } if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; load_kernel (env); } /* Init CPU internal devices */ cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); /* The PIC is attached to the MIPS CPU INT0 pin */ i8259 = i8259_init(env->irq[2]); rtc_state = rtc_init(0x70, i8259[8]); /* Register 64 KB of ISA IO space at 0x14000000 */ isa_mmio_init(0x14000000, 0x00010000); isa_mem_base = 0x10000000; pit = pit_init(0x40, i8259[0]); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_init(serial_io[i], i8259[serial_irq[i]], 115200, serial_hds[i]); } } isa_vga_init(ds, phys_ram_base + ram_size, ram_size, vga_ram_size); if (nd_table[0].vlan) { if (nd_table[i].model == NULL) { nd_table[i].model = "ne2k_isa"; } if (strcmp(nd_table[0].model, "ne2k_isa") == 0) { isa_ne2000_init(0x300, i8259[9], &nd_table[0]); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: ne2k_isa\n"); exit (1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); exit (1); } } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); if (index != -1) hd[i] = drives_table[index].bdrv; else hd[i] = NULL; } for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); i8042_init(i8259[1], i8259[12], 0x60); }
false
qemu
0ae18ceeaaa2c1749e742c4b112f6c3bf0896408
void mips_r4k_init (ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { char buf[1024]; unsigned long bios_offset; int bios_size; CPUState *env; RTCState *rtc_state; int i; qemu_irq *i8259; int index; BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "R4000"; #else cpu_model = "24Kf"; #endif } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } qemu_register_reset(main_cpu_reset, env); cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); if (!mips_qemu_iomemtype) { mips_qemu_iomemtype = cpu_register_io_memory(0, mips_qemu_read, mips_qemu_write, NULL); } cpu_register_physical_memory(0x1fbf0000, 0x10000, mips_qemu_iomemtype); bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = load_image(buf, phys_ram_base + bios_offset); if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { cpu_register_physical_memory(0x1fc00000, BIOS_SIZE, bios_offset | IO_MEM_ROM); } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) { uint32_t mips_rom = 0x00400000; cpu_register_physical_memory(0x1fc00000, mips_rom, qemu_ram_alloc(mips_rom) | IO_MEM_ROM); if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom), drives_table[index].bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", buf); } if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; load_kernel (env); } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); i8259 = i8259_init(env->irq[2]); rtc_state = rtc_init(0x70, i8259[8]); isa_mmio_init(0x14000000, 0x00010000); isa_mem_base = 0x10000000; pit = pit_init(0x40, i8259[0]); for(i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_init(serial_io[i], i8259[serial_irq[i]], 115200, serial_hds[i]); } } isa_vga_init(ds, phys_ram_base + ram_size, ram_size, vga_ram_size); if (nd_table[0].vlan) { if (nd_table[i].model == NULL) { nd_table[i].model = "ne2k_isa"; } if (strcmp(nd_table[0].model, "ne2k_isa") == 0) { isa_ne2000_init(0x300, i8259[9], &nd_table[0]); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: ne2k_isa\n"); exit (1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); exit (1); } } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); if (index != -1) hd[i] = drives_table[index].bdrv; else hd[i] = NULL; } for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); i8042_init(i8259[1], i8259[12], 0x60); }
{ "code": [], "line_no": [] }
void FUNC_0 (ram_addr_t VAR_0, int VAR_1, const char *VAR_2, DisplayState *VAR_3, const char *VAR_4, const char *VAR_5, const char *VAR_6, const char *VAR_7) { char VAR_8[1024]; unsigned long VAR_9; int VAR_10; CPUState *env; RTCState *rtc_state; int VAR_11; qemu_irq *i8259; int VAR_12; BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; if (VAR_7 == NULL) { #ifdef TARGET_MIPS64 VAR_7 = "R4000"; #else VAR_7 = "24Kf"; #endif } env = cpu_init(VAR_7); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } qemu_register_reset(main_cpu_reset, env); cpu_register_physical_memory(0, VAR_0, IO_MEM_RAM); if (!mips_qemu_iomemtype) { mips_qemu_iomemtype = cpu_register_io_memory(0, mips_qemu_read, mips_qemu_write, NULL); } cpu_register_physical_memory(0x1fbf0000, 0x10000, mips_qemu_iomemtype); VAR_9 = VAR_0 + VAR_1; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(VAR_8, sizeof(VAR_8), "%s/%s", bios_dir, bios_name); VAR_10 = load_image(VAR_8, phys_ram_base + VAR_9); if ((VAR_10 > 0) && (VAR_10 <= BIOS_SIZE)) { cpu_register_physical_memory(0x1fc00000, BIOS_SIZE, VAR_9 | IO_MEM_ROM); } else if ((VAR_12 = drive_get_index(IF_PFLASH, 0, 0)) > -1) { uint32_t mips_rom = 0x00400000; cpu_register_physical_memory(0x1fc00000, mips_rom, qemu_ram_alloc(mips_rom) | IO_MEM_ROM); if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom), drives_table[VAR_12].bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", VAR_8); } if (VAR_4) { loaderparams.VAR_0 = VAR_0; loaderparams.VAR_4 = VAR_4; loaderparams.VAR_5 = VAR_5; loaderparams.VAR_6 = VAR_6; load_kernel (env); } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); i8259 = i8259_init(env->irq[2]); rtc_state = rtc_init(0x70, i8259[8]); isa_mmio_init(0x14000000, 0x00010000); isa_mem_base = 0x10000000; pit = pit_init(0x40, i8259[0]); for(VAR_11 = 0; VAR_11 < MAX_SERIAL_PORTS; VAR_11++) { if (serial_hds[VAR_11]) { serial_init(serial_io[VAR_11], i8259[serial_irq[VAR_11]], 115200, serial_hds[VAR_11]); } } isa_vga_init(VAR_3, phys_ram_base + VAR_0, VAR_0, VAR_1); if (nd_table[0].vlan) { if (nd_table[VAR_11].model == NULL) { nd_table[VAR_11].model = "ne2k_isa"; } if (strcmp(nd_table[0].model, "ne2k_isa") == 0) { isa_ne2000_init(0x300, i8259[9], &nd_table[0]); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: ne2k_isa\n"); exit (1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); exit (1); } } if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(VAR_11 = 0; VAR_11 < MAX_IDE_BUS * MAX_IDE_DEVS; VAR_11++) { VAR_12 = drive_get_index(IF_IDE, VAR_11 / MAX_IDE_DEVS, VAR_11 % MAX_IDE_DEVS); if (VAR_12 != -1) hd[VAR_11] = drives_table[VAR_12].bdrv; else hd[VAR_11] = NULL; } for(VAR_11 = 0; VAR_11 < MAX_IDE_BUS; VAR_11++) isa_ide_init(ide_iobase[VAR_11], ide_iobase2[VAR_11], i8259[ide_irq[VAR_11]], hd[MAX_IDE_DEVS * VAR_11], hd[MAX_IDE_DEVS * VAR_11 + 1]); i8042_init(i8259[1], i8259[12], 0x60); }
[ "void FUNC_0 (ram_addr_t VAR_0, int VAR_1,\nconst char *VAR_2, DisplayState *VAR_3,\nconst char *VAR_4, const char *VAR_5,\nconst char *VAR_6, const char *VAR_7)\n{", "char VAR_8[1024];", "unsigned long VAR_9;", "int VAR_10;", "CPUState *env;", "RTCState *rtc_state;", "int VAR_11;", "qemu_irq *i8259;"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ...
26,279
static bool spapr_drc_needed(void *opaque) { sPAPRDRConnector *drc = (sPAPRDRConnector *)opaque; sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); bool rc = false; sPAPRDREntitySense value = drck->dr_entity_sense(drc); /* If no dev is plugged in there is no need to migrate the DRC state */ if (value != SPAPR_DR_ENTITY_SENSE_PRESENT) { return false; } /* * If there is dev plugged in, we need to migrate the DRC state when * it is different from cold-plugged state */ switch (spapr_drc_type(drc)) { case SPAPR_DR_CONNECTOR_TYPE_PCI: case SPAPR_DR_CONNECTOR_TYPE_CPU: case SPAPR_DR_CONNECTOR_TYPE_LMB: rc = !((drc->isolation_state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) && (drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE) && drc->configured && !drc->awaiting_release); break; case SPAPR_DR_CONNECTOR_TYPE_PHB: case SPAPR_DR_CONNECTOR_TYPE_VIO: default: g_assert_not_reached(); } return rc; }
false
qemu
f1c52354e5bdab6983d13a4c174759c585e834b3
static bool spapr_drc_needed(void *opaque) { sPAPRDRConnector *drc = (sPAPRDRConnector *)opaque; sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); bool rc = false; sPAPRDREntitySense value = drck->dr_entity_sense(drc); if (value != SPAPR_DR_ENTITY_SENSE_PRESENT) { return false; } switch (spapr_drc_type(drc)) { case SPAPR_DR_CONNECTOR_TYPE_PCI: case SPAPR_DR_CONNECTOR_TYPE_CPU: case SPAPR_DR_CONNECTOR_TYPE_LMB: rc = !((drc->isolation_state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) && (drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE) && drc->configured && !drc->awaiting_release); break; case SPAPR_DR_CONNECTOR_TYPE_PHB: case SPAPR_DR_CONNECTOR_TYPE_VIO: default: g_assert_not_reached(); } return rc; }
{ "code": [], "line_no": [] }
static bool FUNC_0(void *opaque) { sPAPRDRConnector *drc = (sPAPRDRConnector *)opaque; sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); bool rc = false; sPAPRDREntitySense value = drck->dr_entity_sense(drc); if (value != SPAPR_DR_ENTITY_SENSE_PRESENT) { return false; } switch (spapr_drc_type(drc)) { case SPAPR_DR_CONNECTOR_TYPE_PCI: case SPAPR_DR_CONNECTOR_TYPE_CPU: case SPAPR_DR_CONNECTOR_TYPE_LMB: rc = !((drc->isolation_state == SPAPR_DR_ISOLATION_STATE_UNISOLATED) && (drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE) && drc->configured && !drc->awaiting_release); break; case SPAPR_DR_CONNECTOR_TYPE_PHB: case SPAPR_DR_CONNECTOR_TYPE_VIO: default: g_assert_not_reached(); } return rc; }
[ "static bool FUNC_0(void *opaque)\n{", "sPAPRDRConnector *drc = (sPAPRDRConnector *)opaque;", "sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);", "bool rc = false;", "sPAPRDREntitySense value = drck->dr_entity_sense(drc);", "if (value != SPAPR_DR_ENTITY_SENSE_PRESENT) {", "return false;"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 33 ], [ 35, 37, 39, 41, 43, 45 ], [ 47 ], [ 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ] ]
26,280
static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrUSrc, const int16_t *chrVSrc, const int16_t *alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { int p= 4; const uint8_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW }; uint8_t *dst[4]= { aDest, dest, uDest, vDest }; x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW }; while (p--) { if (dst[p]) { __asm__ volatile( "mov %2, %%"REG_a" \n\t" ".p2align 4 \n\t" /* FIXME Unroll? */ "1: \n\t" "movq (%0, %%"REG_a", 2), %%mm0 \n\t" "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t" "psraw $7, %%mm0 \n\t" "psraw $7, %%mm1 \n\t" "packuswb %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%1, %%REGa)) "add $8, %%"REG_a" \n\t" "jnc 1b \n\t" :: "r" (src[p]), "r" (dst[p] + counter[p]), "g" (-counter[p]) : "%"REG_a ); } } }
false
FFmpeg
9bcbb250e23959075765edd3cb4c1fcb46736d7d
static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrUSrc, const int16_t *chrVSrc, const int16_t *alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { int p= 4; const uint8_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW }; uint8_t *dst[4]= { aDest, dest, uDest, vDest }; x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW }; while (p--) { if (dst[p]) { __asm__ volatile( "mov %2, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" "movq (%0, %%"REG_a", 2), %%mm0 \n\t" "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t" "psraw $7, %%mm0 \n\t" "psraw $7, %%mm1 \n\t" "packuswb %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%1, %%REGa)) "add $8, %%"REG_a" \n\t" "jnc 1b \n\t" :: "r" (src[p]), "r" (dst[p] + counter[p]), "g" (-counter[p]) : "%"REG_a ); } } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrUSrc, const int16_t *chrVSrc, const int16_t *alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { int VAR_0= 4; const uint8_t *VAR_1[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW }; uint8_t *dst[4]= { aDest, dest, uDest, vDest }; x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW }; while (VAR_0--) { if (dst[VAR_0]) { __asm__ volatile( "mov %2, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" "movq (%0, %%"REG_a", 2), %%mm0 \n\t" "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t" "psraw $7, %%mm0 \n\t" "psraw $7, %%mm1 \n\t" "packuswb %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%1, %%REGa)) "add $8, %%"REG_a" \n\t" "jnc 1b \n\t" :: "r" (VAR_1[VAR_0]), "r" (dst[VAR_0] + counter[VAR_0]), "g" (-counter[VAR_0]) : "%"REG_a ); } } }
[ "static inline void FUNC_0(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc,\nconst int16_t *chrUSrc, const int16_t *chrVSrc,\nconst int16_t *alpSrc,\nuint8_t *dest, uint8_t *uDest, uint8_t *vDest,\nuint8_t *aDest, int dstW, int chrDstW)\n{", "int VAR_0= 4;", "const uint8_t *VAR_1[4]= { alpSrc + dstW, lumSrc + ds...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57 ], [ 59 ], [ 61 ], [...
26,281
static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size) { register const uint8_t* s=src; register uint8_t* d=dst; register const uint8_t *end; const uint8_t *mm_end; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*s)); __asm__ volatile("movq %0, %%mm4"::"m"(mask15s)); mm_end = end - 15; while (s<mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq 8%1, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm2 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm2, 8%0" :"=m"(*d) :"m"(*s) ); d+=16; s+=16; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif mm_end = end - 3; while (s < mm_end) { register unsigned x= *((const uint32_t *)s); *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0); d+=4; s+=4; } if (s < end) { register unsigned short x= *((const uint16_t *)s); *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0); } }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size) { register const uint8_t* s=src; register uint8_t* d=dst; register const uint8_t *end; const uint8_t *mm_end; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*s)); __asm__ volatile("movq %0, %%mm4"::"m"(mask15s)); mm_end = end - 15; while (s<mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq 8%1, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm2 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm2, 8%0" :"=m"(*d) :"m"(*s) ); d+=16; s+=16; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif mm_end = end - 3; while (s < mm_end) { register unsigned x= *((const uint32_t *)s); *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0); d+=4; s+=4; } if (s < end) { register unsigned short x= *((const uint16_t *)s); *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size) { register const uint8_t* VAR_0=src; register uint8_t* VAR_1=dst; register const uint8_t *VAR_2; const uint8_t *VAR_3; VAR_2 = VAR_0 + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*VAR_0)); __asm__ volatile("movq %0, %%mm4"::"m"(mask15s)); VAR_3 = VAR_2 - 15; while (VAR_0<VAR_3) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movq %1, %%mm0 \n\t" "movq 8%1, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm2 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm3, %%mm2 \n\t" MOVNTQ" %%mm0, %0 \n\t" MOVNTQ" %%mm2, 8%0" :"=m"(*VAR_1) :"m"(*VAR_0) ); VAR_1+=16; VAR_0+=16; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif VAR_3 = VAR_2 - 3; while (VAR_0 < VAR_3) { register unsigned VAR_5= *((const uint32_t *)VAR_0); *((uint32_t *)VAR_1) = (VAR_5&0x7FFF7FFF) + (VAR_5&0x7FE07FE0); VAR_1+=4; VAR_0+=4; } if (VAR_0 < VAR_2) { register unsigned short VAR_5= *((const uint16_t *)VAR_0); *((uint16_t *)VAR_1) = (VAR_5&0x7FFF) + (VAR_5&0x7FE0); } }
[ "static inline void FUNC_0(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size)\n{", "register const uint8_t* VAR_0=src;", "register uint8_t* VAR_1=dst;", "register const uint8_t *VAR_2;", "const uint8_t *VAR_3;", "VAR_2 = VAR_0 + src_size;", "#if COMPILE_TEMPLATE_MMX\n__asm__ volatile(PREFETCH\"...
[ 0, 0, 0, 0, 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 ], [...
26,282
PowerPCCPU *ppc4xx_init(const char *cpu_model, clk_setup_t *cpu_clk, clk_setup_t *tb_clk, uint32_t sysclk) { PowerPCCPU *cpu; CPUPPCState *env; /* init CPUs */ cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC %s CPU definition\n", cpu_model); exit(1); } env = &cpu->env; cpu_clk->cb = NULL; /* We don't care about CPU clock frequency changes */ cpu_clk->opaque = env; /* Set time-base frequency to sysclk */ tb_clk->cb = ppc_40x_timers_init(env, sysclk, PPC_INTERRUPT_PIT); tb_clk->opaque = env; ppc_dcr_init(env, NULL, NULL); /* Register qemu callbacks */ qemu_register_reset(ppc4xx_reset, cpu); return cpu; }
true
qemu
4482e05cbbb7e50e476f6a9500cf0b38913bd939
PowerPCCPU *ppc4xx_init(const char *cpu_model, clk_setup_t *cpu_clk, clk_setup_t *tb_clk, uint32_t sysclk) { PowerPCCPU *cpu; CPUPPCState *env; cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC %s CPU definition\n", cpu_model); exit(1); } env = &cpu->env; cpu_clk->cb = NULL; cpu_clk->opaque = env; tb_clk->cb = ppc_40x_timers_init(env, sysclk, PPC_INTERRUPT_PIT); tb_clk->opaque = env; ppc_dcr_init(env, NULL, NULL); qemu_register_reset(ppc4xx_reset, cpu); return cpu; }
{ "code": [ " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " exit(1);", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " fprintf(stderr, \"Unable to find PowerPC %s CPU definition\\n\",", " cpu_model);", " exit(1);", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " if (cpu == NULL) {", " exit(1);", " exit(1);", " exit(1);" ], "line_no": [ 25, 25, 25, 25, 25, 25, 25, 19, 25, 19, 25, 19, 25, 25, 25, 19, 25, 19, 25, 19, 25, 19, 25, 25, 19, 25, 19, 21, 23, 25, 25, 19, 25, 19, 25, 19, 25, 19, 25, 19, 25, 19, 25, 25, 25 ] }
PowerPCCPU *FUNC_0(const char *cpu_model, clk_setup_t *cpu_clk, clk_setup_t *tb_clk, uint32_t sysclk) { PowerPCCPU *cpu; CPUPPCState *env; cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC %s CPU definition\n", cpu_model); exit(1); } env = &cpu->env; cpu_clk->cb = NULL; cpu_clk->opaque = env; tb_clk->cb = ppc_40x_timers_init(env, sysclk, PPC_INTERRUPT_PIT); tb_clk->opaque = env; ppc_dcr_init(env, NULL, NULL); qemu_register_reset(ppc4xx_reset, cpu); return cpu; }
[ "PowerPCCPU *FUNC_0(const char *cpu_model,\nclk_setup_t *cpu_clk, clk_setup_t *tb_clk,\nuint32_t sysclk)\n{", "PowerPCCPU *cpu;", "CPUPPCState *env;", "cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find PowerPC %s CPU definition\\n\"...
[ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ] ]
26,283
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, int buf_size, int slice_count) { struct vdpau_render_state *render, *last, *next; int i; render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; assert(render); /* fill VdpPictureInfoMPEG1Or2 struct */ render->info.mpeg.picture_structure = s->picture_structure; render->info.mpeg.picture_coding_type = s->pict_type; render->info.mpeg.intra_dc_precision = s->intra_dc_precision; render->info.mpeg.frame_pred_frame_dct = s->frame_pred_frame_dct; render->info.mpeg.concealment_motion_vectors = s->concealment_motion_vectors; render->info.mpeg.intra_vlc_format = s->intra_vlc_format; render->info.mpeg.alternate_scan = s->alternate_scan; render->info.mpeg.q_scale_type = s->q_scale_type; render->info.mpeg.top_field_first = s->top_field_first; render->info.mpeg.full_pel_forward_vector = s->full_pel[0]; // MPEG-1 only. Set 0 for MPEG-2 render->info.mpeg.full_pel_backward_vector = s->full_pel[1]; // MPEG-1 only. Set 0 for MPEG-2 render->info.mpeg.f_code[0][0] = s->mpeg_f_code[0][0]; // For MPEG-1 fill both horiz. & vert. render->info.mpeg.f_code[0][1] = s->mpeg_f_code[0][1]; render->info.mpeg.f_code[1][0] = s->mpeg_f_code[1][0]; render->info.mpeg.f_code[1][1] = s->mpeg_f_code[1][1]; for (i = 0; i < 64; ++i) { render->info.mpeg.intra_quantizer_matrix[i] = s->intra_matrix[i]; render->info.mpeg.non_intra_quantizer_matrix[i] = s->inter_matrix[i]; } render->info.mpeg.forward_reference = VDP_INVALID_HANDLE; render->info.mpeg.backward_reference = VDP_INVALID_HANDLE; switch(s->pict_type){ case FF_B_TYPE: next = (struct vdpau_render_state *)s->next_picture.data[0]; assert(next); render->info.mpeg.backward_reference = next->surface; // no return here, going to set forward prediction case FF_P_TYPE: last = (struct vdpau_render_state *)s->last_picture.data[0]; if (!last) // FIXME: Does this test make sense? last = render; // predict second field from the first render->info.mpeg.forward_reference = last->surface; } ff_vdpau_add_data_chunk(s, buf, buf_size); render->info.mpeg.slice_count = slice_count; if (slice_count) ff_draw_horiz_band(s, 0, s->avctx->height); render->bitstream_buffers_used = 0; }
true
FFmpeg
9bbf1a5c232cffb64e5f8cf071d1626cc0d033e1
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, int buf_size, int slice_count) { struct vdpau_render_state *render, *last, *next; int i; render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; assert(render); render->info.mpeg.picture_structure = s->picture_structure; render->info.mpeg.picture_coding_type = s->pict_type; render->info.mpeg.intra_dc_precision = s->intra_dc_precision; render->info.mpeg.frame_pred_frame_dct = s->frame_pred_frame_dct; render->info.mpeg.concealment_motion_vectors = s->concealment_motion_vectors; render->info.mpeg.intra_vlc_format = s->intra_vlc_format; render->info.mpeg.alternate_scan = s->alternate_scan; render->info.mpeg.q_scale_type = s->q_scale_type; render->info.mpeg.top_field_first = s->top_field_first; render->info.mpeg.full_pel_forward_vector = s->full_pel[0]; render->info.mpeg.full_pel_backward_vector = s->full_pel[1]; render->info.mpeg.f_code[0][0] = s->mpeg_f_code[0][0]; render->info.mpeg.f_code[0][1] = s->mpeg_f_code[0][1]; render->info.mpeg.f_code[1][0] = s->mpeg_f_code[1][0]; render->info.mpeg.f_code[1][1] = s->mpeg_f_code[1][1]; for (i = 0; i < 64; ++i) { render->info.mpeg.intra_quantizer_matrix[i] = s->intra_matrix[i]; render->info.mpeg.non_intra_quantizer_matrix[i] = s->inter_matrix[i]; } render->info.mpeg.forward_reference = VDP_INVALID_HANDLE; render->info.mpeg.backward_reference = VDP_INVALID_HANDLE; switch(s->pict_type){ case FF_B_TYPE: next = (struct vdpau_render_state *)s->next_picture.data[0]; assert(next); render->info.mpeg.backward_reference = next->surface; case FF_P_TYPE: last = (struct vdpau_render_state *)s->last_picture.data[0]; if (!last) last = render; render->info.mpeg.forward_reference = last->surface; } ff_vdpau_add_data_chunk(s, buf, buf_size); render->info.mpeg.slice_count = slice_count; if (slice_count) ff_draw_horiz_band(s, 0, s->avctx->height); render->bitstream_buffers_used = 0; }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { struct vdpau_render_state *VAR_4, *VAR_5, *VAR_6; int VAR_7; VAR_4 = (struct vdpau_render_state *)VAR_0->current_picture_ptr->data[0]; assert(VAR_4); VAR_4->info.mpeg.picture_structure = VAR_0->picture_structure; VAR_4->info.mpeg.picture_coding_type = VAR_0->pict_type; VAR_4->info.mpeg.intra_dc_precision = VAR_0->intra_dc_precision; VAR_4->info.mpeg.frame_pred_frame_dct = VAR_0->frame_pred_frame_dct; VAR_4->info.mpeg.concealment_motion_vectors = VAR_0->concealment_motion_vectors; VAR_4->info.mpeg.intra_vlc_format = VAR_0->intra_vlc_format; VAR_4->info.mpeg.alternate_scan = VAR_0->alternate_scan; VAR_4->info.mpeg.q_scale_type = VAR_0->q_scale_type; VAR_4->info.mpeg.top_field_first = VAR_0->top_field_first; VAR_4->info.mpeg.full_pel_forward_vector = VAR_0->full_pel[0]; VAR_4->info.mpeg.full_pel_backward_vector = VAR_0->full_pel[1]; VAR_4->info.mpeg.f_code[0][0] = VAR_0->mpeg_f_code[0][0]; VAR_4->info.mpeg.f_code[0][1] = VAR_0->mpeg_f_code[0][1]; VAR_4->info.mpeg.f_code[1][0] = VAR_0->mpeg_f_code[1][0]; VAR_4->info.mpeg.f_code[1][1] = VAR_0->mpeg_f_code[1][1]; for (VAR_7 = 0; VAR_7 < 64; ++VAR_7) { VAR_4->info.mpeg.intra_quantizer_matrix[VAR_7] = VAR_0->intra_matrix[VAR_7]; VAR_4->info.mpeg.non_intra_quantizer_matrix[VAR_7] = VAR_0->inter_matrix[VAR_7]; } VAR_4->info.mpeg.forward_reference = VDP_INVALID_HANDLE; VAR_4->info.mpeg.backward_reference = VDP_INVALID_HANDLE; switch(VAR_0->pict_type){ case FF_B_TYPE: VAR_6 = (struct vdpau_render_state *)VAR_0->next_picture.data[0]; assert(VAR_6); VAR_4->info.mpeg.backward_reference = VAR_6->surface; case FF_P_TYPE: VAR_5 = (struct vdpau_render_state *)VAR_0->last_picture.data[0]; if (!VAR_5) VAR_5 = VAR_4; VAR_4->info.mpeg.forward_reference = VAR_5->surface; } ff_vdpau_add_data_chunk(VAR_0, VAR_1, VAR_2); VAR_4->info.mpeg.VAR_3 = VAR_3; if (VAR_3) ff_draw_horiz_band(VAR_0, 0, VAR_0->avctx->height); VAR_4->bitstream_buffers_used = 0; }
[ "void FUNC_0(MpegEncContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2, int VAR_3)\n{", "struct vdpau_render_state *VAR_4, *VAR_5, *VAR_6;", "int VAR_7;", "VAR_4 = (struct vdpau_render_state *)VAR_0->current_picture_ptr->data[0];", "assert(VAR_4);", "VAR_4->info.mpeg.picture_structure = VAR_0->pict...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ ...
26,284
static int open_input_stream(HTTPContext *c, const char *info) { char buf[128]; char input_filename[1024]; AVFormatContext *s = NULL; int buf_size, i, ret; int64_t stream_pos; /* find file name */ if (c->stream->feed) { strcpy(input_filename, c->stream->feed->feed_filename); buf_size = FFM_PACKET_SIZE; /* compute position (absolute time) */ if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) { http_log("Invalid date specification '%s' for stream\n", buf); return ret; } } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; } else stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000; } else { strcpy(input_filename, c->stream->feed_filename); buf_size = 0; /* compute position (relative time) */ if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) { http_log("Invalid date specification '%s' for stream\n", buf); return ret; } } else stream_pos = 0; } if (!input_filename[0]) { http_log("No filename was specified for stream\n"); return AVERROR(EINVAL); } /* open stream */ ret = avformat_open_input(&s, input_filename, c->stream->ifmt, &c->stream->in_opts); if (ret < 0) { http_log("Could not open input '%s': %s\n", input_filename, av_err2str(ret)); return ret; } /* set buffer size */ if (buf_size > 0) { ret = ffio_set_buf_size(s->pb, buf_size); if (ret < 0) { http_log("Failed to set buffer size\n"); return ret; } } s->flags |= AVFMT_FLAG_GENPTS; c->fmt_in = s; if (strcmp(s->iformat->name, "ffm") && (ret = avformat_find_stream_info(c->fmt_in, NULL)) < 0) { http_log("Could not find stream info for input '%s'\n", input_filename); avformat_close_input(&s); return ret; } /* choose stream as clock source (we favor the video stream if * present) for packet sending */ c->pts_stream_index = 0; for(i=0;i<c->stream->nb_streams;i++) { if (c->pts_stream_index == 0 && c->stream->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->pts_stream_index = i; } } if (c->fmt_in->iformat->read_seek) av_seek_frame(c->fmt_in, -1, stream_pos, 0); /* set the start time (needed for maxtime and RTP packet timing) */ c->start_time = cur_time; c->first_pts = AV_NOPTS_VALUE; return 0; }
true
FFmpeg
bc9eb0467a52828d6be48de5e60f042bf3b62d1f
static int open_input_stream(HTTPContext *c, const char *info) { char buf[128]; char input_filename[1024]; AVFormatContext *s = NULL; int buf_size, i, ret; int64_t stream_pos; if (c->stream->feed) { strcpy(input_filename, c->stream->feed->feed_filename); buf_size = FFM_PACKET_SIZE; if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) { http_log("Invalid date specification '%s' for stream\n", buf); return ret; } } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; } else stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000; } else { strcpy(input_filename, c->stream->feed_filename); buf_size = 0; if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) { http_log("Invalid date specification '%s' for stream\n", buf); return ret; } } else stream_pos = 0; } if (!input_filename[0]) { http_log("No filename was specified for stream\n"); return AVERROR(EINVAL); } ret = avformat_open_input(&s, input_filename, c->stream->ifmt, &c->stream->in_opts); if (ret < 0) { http_log("Could not open input '%s': %s\n", input_filename, av_err2str(ret)); return ret; } if (buf_size > 0) { ret = ffio_set_buf_size(s->pb, buf_size); if (ret < 0) { http_log("Failed to set buffer size\n"); return ret; } } s->flags |= AVFMT_FLAG_GENPTS; c->fmt_in = s; if (strcmp(s->iformat->name, "ffm") && (ret = avformat_find_stream_info(c->fmt_in, NULL)) < 0) { http_log("Could not find stream info for input '%s'\n", input_filename); avformat_close_input(&s); return ret; } c->pts_stream_index = 0; for(i=0;i<c->stream->nb_streams;i++) { if (c->pts_stream_index == 0 && c->stream->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->pts_stream_index = i; } } if (c->fmt_in->iformat->read_seek) av_seek_frame(c->fmt_in, -1, stream_pos, 0); c->start_time = cur_time; c->first_pts = AV_NOPTS_VALUE; return 0; }
{ "code": [ " c->stream->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {" ], "line_no": [ 145 ] }
static int FUNC_0(HTTPContext *VAR_0, const char *VAR_1) { char VAR_2[128]; char VAR_3[1024]; AVFormatContext *s = NULL; int VAR_4, VAR_5, VAR_6; int64_t stream_pos; if (VAR_0->stream->feed) { strcpy(VAR_3, VAR_0->stream->feed->feed_filename); VAR_4 = FFM_PACKET_SIZE; if (av_find_info_tag(VAR_2, sizeof(VAR_2), "date", VAR_1)) { if ((VAR_6 = av_parse_time(&stream_pos, VAR_2, 0)) < 0) { http_log("Invalid date specification '%s' for stream\n", VAR_2); return VAR_6; } } else if (av_find_info_tag(VAR_2, sizeof(VAR_2), "buffer", VAR_1)) { int VAR_7 = strtol(VAR_2, 0, 10); stream_pos = av_gettime() - VAR_7 * (int64_t)1000000; } else stream_pos = av_gettime() - VAR_0->stream->VAR_7 * (int64_t)1000; } else { strcpy(VAR_3, VAR_0->stream->feed_filename); VAR_4 = 0; if (av_find_info_tag(VAR_2, sizeof(VAR_2), "date", VAR_1)) { if ((VAR_6 = av_parse_time(&stream_pos, VAR_2, 1)) < 0) { http_log("Invalid date specification '%s' for stream\n", VAR_2); return VAR_6; } } else stream_pos = 0; } if (!VAR_3[0]) { http_log("No filename was specified for stream\n"); return AVERROR(EINVAL); } VAR_6 = avformat_open_input(&s, VAR_3, VAR_0->stream->ifmt, &VAR_0->stream->in_opts); if (VAR_6 < 0) { http_log("Could not open input '%s': %s\n", VAR_3, av_err2str(VAR_6)); return VAR_6; } if (VAR_4 > 0) { VAR_6 = ffio_set_buf_size(s->pb, VAR_4); if (VAR_6 < 0) { http_log("Failed to set buffer size\n"); return VAR_6; } } s->flags |= AVFMT_FLAG_GENPTS; VAR_0->fmt_in = s; if (strcmp(s->iformat->name, "ffm") && (VAR_6 = avformat_find_stream_info(VAR_0->fmt_in, NULL)) < 0) { http_log("Could not find stream VAR_1 for input '%s'\n", VAR_3); avformat_close_input(&s); return VAR_6; } VAR_0->pts_stream_index = 0; for(VAR_5=0;VAR_5<VAR_0->stream->nb_streams;VAR_5++) { if (VAR_0->pts_stream_index == 0 && VAR_0->stream->streams[VAR_5]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_0->pts_stream_index = VAR_5; } } if (VAR_0->fmt_in->iformat->read_seek) av_seek_frame(VAR_0->fmt_in, -1, stream_pos, 0); VAR_0->start_time = cur_time; VAR_0->first_pts = AV_NOPTS_VALUE; return 0; }
[ "static int FUNC_0(HTTPContext *VAR_0, const char *VAR_1)\n{", "char VAR_2[128];", "char VAR_3[1024];", "AVFormatContext *s = NULL;", "int VAR_4, VAR_5, VAR_6;", "int64_t stream_pos;", "if (VAR_0->stream->feed) {", "strcpy(VAR_3, VAR_0->stream->feed->feed_filename);", "VAR_4 = FFM_PACKET_SIZE;", "...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ...
26,285
static int close_f(int argc, char **argv) { bdrv_close(bs); bs = NULL; return 0; }
true
qemu
b46578555c4bce64e3daba4591334aba2d12c156
static int close_f(int argc, char **argv) { bdrv_close(bs); bs = NULL; return 0; }
{ "code": [ " bdrv_close(bs);" ], "line_no": [ 5 ] }
static int FUNC_0(int VAR_0, char **VAR_1) { bdrv_close(bs); bs = NULL; return 0; }
[ "static int FUNC_0(int VAR_0, char **VAR_1)\n{", "bdrv_close(bs);", "bs = NULL;", "return 0;", "}" ]
[ 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
26,286
static void pty_chr_state(CharDriverState *chr, int connected) { PtyCharDriver *s = chr->opaque; if (!connected) { if (s->fd_tag) { io_remove_watch_poll(s->fd_tag); s->fd_tag = 0; } s->connected = 0; /* (re-)connect poll interval for idle guests: once per second. * We check more frequently in case the guests sends data to * the virtual device linked to our pty. */ pty_chr_rearm_timer(chr, 1000); } else { if (s->timer_tag) { g_source_remove(s->timer_tag); s->timer_tag = 0; } if (!s->connected) { qemu_chr_be_generic_open(chr); s->connected = 1; s->fd_tag = io_add_watch_poll(s->fd, pty_chr_read_poll, pty_chr_read, chr); } } }
true
qemu
3a3567d337d3ee6fb2e2fcc1d27cd045ed97ae9b
static void pty_chr_state(CharDriverState *chr, int connected) { PtyCharDriver *s = chr->opaque; if (!connected) { if (s->fd_tag) { io_remove_watch_poll(s->fd_tag); s->fd_tag = 0; } s->connected = 0; pty_chr_rearm_timer(chr, 1000); } else { if (s->timer_tag) { g_source_remove(s->timer_tag); s->timer_tag = 0; } if (!s->connected) { qemu_chr_be_generic_open(chr); s->connected = 1; s->fd_tag = io_add_watch_poll(s->fd, pty_chr_read_poll, pty_chr_read, chr); } } }
{ "code": [ " qemu_chr_be_generic_open(chr);" ], "line_no": [ 41 ] }
static void FUNC_0(CharDriverState *VAR_0, int VAR_1) { PtyCharDriver *s = VAR_0->opaque; if (!VAR_1) { if (s->fd_tag) { io_remove_watch_poll(s->fd_tag); s->fd_tag = 0; } s->VAR_1 = 0; pty_chr_rearm_timer(VAR_0, 1000); } else { if (s->timer_tag) { g_source_remove(s->timer_tag); s->timer_tag = 0; } if (!s->VAR_1) { qemu_chr_be_generic_open(VAR_0); s->VAR_1 = 1; s->fd_tag = io_add_watch_poll(s->fd, pty_chr_read_poll, pty_chr_read, VAR_0); } } }
[ "static void FUNC_0(CharDriverState *VAR_0, int VAR_1)\n{", "PtyCharDriver *s = VAR_0->opaque;", "if (!VAR_1) {", "if (s->fd_tag) {", "io_remove_watch_poll(s->fd_tag);", "s->fd_tag = 0;", "}", "s->VAR_1 = 0;", "pty_chr_rearm_timer(VAR_0, 1000);", "} else {", "if (s->timer_tag) {", "g_source_re...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49...
26,287
static void zynq_xadc_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) { ZynqXADCState *s = (ZynqXADCState *)opaque; int reg = offset / 4; int xadc_reg; int xadc_cmd; int xadc_data; if (!zynq_xadc_check_offset(reg, false)) { qemu_log_mask(LOG_GUEST_ERROR, "zynq_xadc: Invalid write access " "to addr %" HWADDR_PRIx "\n", offset); return; } switch (reg) { case CFG: s->regs[CFG] = val; break; case INT_STS: s->regs[INT_STS] &= ~val; break; case INT_MASK: s->regs[INT_MASK] = val & INT_ALL; break; case CMDFIFO: xadc_cmd = extract32(val, 26, 4); xadc_reg = extract32(val, 16, 10); xadc_data = extract32(val, 0, 16); if (s->regs[MCTL] & MCTL_RESET) { qemu_log_mask(LOG_GUEST_ERROR, "zynq_xadc: Sending command " "while comm channel held in reset: %" PRIx32 "\n", (uint32_t) val); break; } if (xadc_reg > ZYNQ_XADC_NUM_ADC_REGS && xadc_cmd != CMD_NOP) { qemu_log_mask(LOG_GUEST_ERROR, "read/write op to invalid xadc " "reg 0x%x\n", xadc_reg); break; } switch (xadc_cmd) { case CMD_READ: xadc_push_dfifo(s, s->xadc_regs[xadc_reg]); break; case CMD_WRITE: s->xadc_regs[xadc_reg] = xadc_data; /* fallthrough */ case CMD_NOP: xadc_push_dfifo(s, 0); break; } break; case MCTL: s->regs[MCTL] = val & 0x00fffeff; break; } zynq_xadc_update_ints(s); }
true
qemu
4a94fc9bf2dac5965acb8e264d55a356737a2aa6
static void zynq_xadc_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) { ZynqXADCState *s = (ZynqXADCState *)opaque; int reg = offset / 4; int xadc_reg; int xadc_cmd; int xadc_data; if (!zynq_xadc_check_offset(reg, false)) { qemu_log_mask(LOG_GUEST_ERROR, "zynq_xadc: Invalid write access " "to addr %" HWADDR_PRIx "\n", offset); return; } switch (reg) { case CFG: s->regs[CFG] = val; break; case INT_STS: s->regs[INT_STS] &= ~val; break; case INT_MASK: s->regs[INT_MASK] = val & INT_ALL; break; case CMDFIFO: xadc_cmd = extract32(val, 26, 4); xadc_reg = extract32(val, 16, 10); xadc_data = extract32(val, 0, 16); if (s->regs[MCTL] & MCTL_RESET) { qemu_log_mask(LOG_GUEST_ERROR, "zynq_xadc: Sending command " "while comm channel held in reset: %" PRIx32 "\n", (uint32_t) val); break; } if (xadc_reg > ZYNQ_XADC_NUM_ADC_REGS && xadc_cmd != CMD_NOP) { qemu_log_mask(LOG_GUEST_ERROR, "read/write op to invalid xadc " "reg 0x%x\n", xadc_reg); break; } switch (xadc_cmd) { case CMD_READ: xadc_push_dfifo(s, s->xadc_regs[xadc_reg]); break; case CMD_WRITE: s->xadc_regs[xadc_reg] = xadc_data; case CMD_NOP: xadc_push_dfifo(s, 0); break; } break; case MCTL: s->regs[MCTL] = val & 0x00fffeff; break; } zynq_xadc_update_ints(s); }
{ "code": [ " if (xadc_reg > ZYNQ_XADC_NUM_ADC_REGS && xadc_cmd != CMD_NOP) {" ], "line_no": [ 75 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { ZynqXADCState *s = (ZynqXADCState *)VAR_0; int VAR_4 = VAR_1 / 4; int VAR_5; int VAR_6; int VAR_7; if (!zynq_xadc_check_offset(VAR_4, false)) { qemu_log_mask(LOG_GUEST_ERROR, "zynq_xadc: Invalid write access " "to addr %" HWADDR_PRIx "\n", VAR_1); return; } switch (VAR_4) { case CFG: s->regs[CFG] = VAR_2; break; case INT_STS: s->regs[INT_STS] &= ~VAR_2; break; case INT_MASK: s->regs[INT_MASK] = VAR_2 & INT_ALL; break; case CMDFIFO: VAR_6 = extract32(VAR_2, 26, 4); VAR_5 = extract32(VAR_2, 16, 10); VAR_7 = extract32(VAR_2, 0, 16); if (s->regs[MCTL] & MCTL_RESET) { qemu_log_mask(LOG_GUEST_ERROR, "zynq_xadc: Sending command " "while comm channel held in reset: %" PRIx32 "\n", (uint32_t) VAR_2); break; } if (VAR_5 > ZYNQ_XADC_NUM_ADC_REGS && VAR_6 != CMD_NOP) { qemu_log_mask(LOG_GUEST_ERROR, "read/write op to invalid xadc " "VAR_4 0x%x\n", VAR_5); break; } switch (VAR_6) { case CMD_READ: xadc_push_dfifo(s, s->xadc_regs[VAR_5]); break; case CMD_WRITE: s->xadc_regs[VAR_5] = VAR_7; case CMD_NOP: xadc_push_dfifo(s, 0); break; } break; case MCTL: s->regs[MCTL] = VAR_2 & 0x00fffeff; break; } zynq_xadc_update_ints(s); }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{", "ZynqXADCState *s = (ZynqXADCState *)VAR_0;", "int VAR_4 = VAR_1 / 4;", "int VAR_5;", "int VAR_6;", "int VAR_7;", "if (!zynq_xadc_check_offset(VAR_4, false)) {", "qemu_log_mask(LOG_GUEST_ERROR, \"zynq_xadc: Invalid wr...
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [...
26,288
static inline void gen_set_Rc0 (DisasContext *ctx) { gen_op_cmpi(0); gen_op_set_Rc0(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
static inline void gen_set_Rc0 (DisasContext *ctx) { gen_op_cmpi(0); gen_op_set_Rc0(); }
{ "code": [ " gen_op_cmpi(0);" ], "line_no": [ 5 ] }
static inline void FUNC_0 (DisasContext *VAR_0) { gen_op_cmpi(0); gen_op_set_Rc0(); }
[ "static inline void FUNC_0 (DisasContext *VAR_0)\n{", "gen_op_cmpi(0);", "gen_op_set_Rc0();", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,289
static int kvm_log_start(CPUPhysMemoryClient *client, target_phys_addr_t phys_addr, ram_addr_t size) { return kvm_dirty_pages_log_change(phys_addr, size, true); }
true
qemu
a01672d3968cf91208666d371784110bfde9d4f8
static int kvm_log_start(CPUPhysMemoryClient *client, target_phys_addr_t phys_addr, ram_addr_t size) { return kvm_dirty_pages_log_change(phys_addr, size, true); }
{ "code": [ "static int kvm_log_start(CPUPhysMemoryClient *client,", " target_phys_addr_t phys_addr, ram_addr_t size)", " return kvm_dirty_pages_log_change(phys_addr, size, true);" ], "line_no": [ 1, 3, 7 ] }
static int FUNC_0(CPUPhysMemoryClient *VAR_0, target_phys_addr_t VAR_1, ram_addr_t VAR_2) { return kvm_dirty_pages_log_change(VAR_1, VAR_2, true); }
[ "static int FUNC_0(CPUPhysMemoryClient *VAR_0,\ntarget_phys_addr_t VAR_1, ram_addr_t VAR_2)\n{", "return kvm_dirty_pages_log_change(VAR_1, VAR_2, true);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,290
static int megasas_scsi_init(PCIDevice *dev) { DeviceState *d = DEVICE(dev); MegasasState *s = MEGASAS(dev); MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s); uint8_t *pci_conf; int i, bar_type; Error *err = NULL; pci_conf = dev->config; /* PCI latency timer = 0 */ pci_conf[PCI_LATENCY_TIMER] = 0; /* Interrupt pin 1 */ pci_conf[PCI_INTERRUPT_PIN] = 0x01; memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s, "megasas-mmio", 0x4000); memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s, "megasas-io", 256); memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s, "megasas-queue", 0x40000); if (megasas_use_msi(s) && msi_init(dev, 0x50, 1, true, false)) { s->flags &= ~MEGASAS_MASK_USE_MSI; } if (megasas_use_msix(s) && msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000, &s->mmio_io, b->mmio_bar, 0x3800, 0x68)) { s->flags &= ~MEGASAS_MASK_USE_MSIX; } if (pci_is_express(dev)) { pcie_endpoint_cap_init(dev, 0xa0); } bar_type = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64; pci_register_bar(dev, b->ioport_bar, PCI_BASE_ADDRESS_SPACE_IO, &s->port_io); pci_register_bar(dev, b->mmio_bar, bar_type, &s->mmio_io); pci_register_bar(dev, 3, bar_type, &s->queue_io); if (megasas_use_msix(s)) { msix_vector_use(dev, 0); } s->fw_state = MFI_FWSTATE_READY; if (!s->sas_addr) { s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) | IEEE_COMPANY_LOCALLY_ASSIGNED) << 36; s->sas_addr |= (pci_bus_num(dev->bus) << 16); s->sas_addr |= (PCI_SLOT(dev->devfn) << 8); s->sas_addr |= PCI_FUNC(dev->devfn); } if (!s->hba_serial) { s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL); } if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) { s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE; } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) { s->fw_sge = 128 - MFI_PASS_FRAME_SIZE; } else { s->fw_sge = 64 - MFI_PASS_FRAME_SIZE; } if (s->fw_cmds > MEGASAS_MAX_FRAMES) { s->fw_cmds = MEGASAS_MAX_FRAMES; } trace_megasas_init(s->fw_sge, s->fw_cmds, megasas_is_jbod(s) ? "jbod" : "raid"); if (megasas_is_jbod(s)) { s->fw_luns = MFI_MAX_SYS_PDS; } else { s->fw_luns = MFI_MAX_LD; } s->producer_pa = 0; s->consumer_pa = 0; for (i = 0; i < s->fw_cmds; i++) { s->frames[i].index = i; s->frames[i].context = -1; s->frames[i].pa = 0; s->frames[i].state = s; } scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), &megasas_scsi_info, NULL); if (!d->hotplugged) { scsi_bus_legacy_handle_cmdline(&s->bus, &err); if (err != NULL) { error_free(err); return -1; } } return 0; }
true
qemu
fa617181839741727d0067ea68807133f498f29b
static int megasas_scsi_init(PCIDevice *dev) { DeviceState *d = DEVICE(dev); MegasasState *s = MEGASAS(dev); MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s); uint8_t *pci_conf; int i, bar_type; Error *err = NULL; pci_conf = dev->config; pci_conf[PCI_LATENCY_TIMER] = 0; pci_conf[PCI_INTERRUPT_PIN] = 0x01; memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s, "megasas-mmio", 0x4000); memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s, "megasas-io", 256); memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s, "megasas-queue", 0x40000); if (megasas_use_msi(s) && msi_init(dev, 0x50, 1, true, false)) { s->flags &= ~MEGASAS_MASK_USE_MSI; } if (megasas_use_msix(s) && msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000, &s->mmio_io, b->mmio_bar, 0x3800, 0x68)) { s->flags &= ~MEGASAS_MASK_USE_MSIX; } if (pci_is_express(dev)) { pcie_endpoint_cap_init(dev, 0xa0); } bar_type = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64; pci_register_bar(dev, b->ioport_bar, PCI_BASE_ADDRESS_SPACE_IO, &s->port_io); pci_register_bar(dev, b->mmio_bar, bar_type, &s->mmio_io); pci_register_bar(dev, 3, bar_type, &s->queue_io); if (megasas_use_msix(s)) { msix_vector_use(dev, 0); } s->fw_state = MFI_FWSTATE_READY; if (!s->sas_addr) { s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) | IEEE_COMPANY_LOCALLY_ASSIGNED) << 36; s->sas_addr |= (pci_bus_num(dev->bus) << 16); s->sas_addr |= (PCI_SLOT(dev->devfn) << 8); s->sas_addr |= PCI_FUNC(dev->devfn); } if (!s->hba_serial) { s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL); } if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) { s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE; } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) { s->fw_sge = 128 - MFI_PASS_FRAME_SIZE; } else { s->fw_sge = 64 - MFI_PASS_FRAME_SIZE; } if (s->fw_cmds > MEGASAS_MAX_FRAMES) { s->fw_cmds = MEGASAS_MAX_FRAMES; } trace_megasas_init(s->fw_sge, s->fw_cmds, megasas_is_jbod(s) ? "jbod" : "raid"); if (megasas_is_jbod(s)) { s->fw_luns = MFI_MAX_SYS_PDS; } else { s->fw_luns = MFI_MAX_LD; } s->producer_pa = 0; s->consumer_pa = 0; for (i = 0; i < s->fw_cmds; i++) { s->frames[i].index = i; s->frames[i].context = -1; s->frames[i].pa = 0; s->frames[i].state = s; } scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), &megasas_scsi_info, NULL); if (!d->hotplugged) { scsi_bus_legacy_handle_cmdline(&s->bus, &err); if (err != NULL) { error_free(err); return -1; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { DeviceState *d = DEVICE(VAR_0); MegasasState *s = MEGASAS(VAR_0); MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s); uint8_t *pci_conf; int VAR_1, VAR_2; Error *err = NULL; pci_conf = VAR_0->config; pci_conf[PCI_LATENCY_TIMER] = 0; pci_conf[PCI_INTERRUPT_PIN] = 0x01; memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s, "megasas-mmio", 0x4000); memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s, "megasas-io", 256); memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s, "megasas-queue", 0x40000); if (megasas_use_msi(s) && msi_init(VAR_0, 0x50, 1, true, false)) { s->flags &= ~MEGASAS_MASK_USE_MSI; } if (megasas_use_msix(s) && msix_init(VAR_0, 15, &s->mmio_io, b->mmio_bar, 0x2000, &s->mmio_io, b->mmio_bar, 0x3800, 0x68)) { s->flags &= ~MEGASAS_MASK_USE_MSIX; } if (pci_is_express(VAR_0)) { pcie_endpoint_cap_init(VAR_0, 0xa0); } VAR_2 = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64; pci_register_bar(VAR_0, b->ioport_bar, PCI_BASE_ADDRESS_SPACE_IO, &s->port_io); pci_register_bar(VAR_0, b->mmio_bar, VAR_2, &s->mmio_io); pci_register_bar(VAR_0, 3, VAR_2, &s->queue_io); if (megasas_use_msix(s)) { msix_vector_use(VAR_0, 0); } s->fw_state = MFI_FWSTATE_READY; if (!s->sas_addr) { s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) | IEEE_COMPANY_LOCALLY_ASSIGNED) << 36; s->sas_addr |= (pci_bus_num(VAR_0->bus) << 16); s->sas_addr |= (PCI_SLOT(VAR_0->devfn) << 8); s->sas_addr |= PCI_FUNC(VAR_0->devfn); } if (!s->hba_serial) { s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL); } if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) { s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE; } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) { s->fw_sge = 128 - MFI_PASS_FRAME_SIZE; } else { s->fw_sge = 64 - MFI_PASS_FRAME_SIZE; } if (s->fw_cmds > MEGASAS_MAX_FRAMES) { s->fw_cmds = MEGASAS_MAX_FRAMES; } trace_megasas_init(s->fw_sge, s->fw_cmds, megasas_is_jbod(s) ? "jbod" : "raid"); if (megasas_is_jbod(s)) { s->fw_luns = MFI_MAX_SYS_PDS; } else { s->fw_luns = MFI_MAX_LD; } s->producer_pa = 0; s->consumer_pa = 0; for (VAR_1 = 0; VAR_1 < s->fw_cmds; VAR_1++) { s->frames[VAR_1].index = VAR_1; s->frames[VAR_1].context = -1; s->frames[VAR_1].pa = 0; s->frames[VAR_1].state = s; } scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(VAR_0), &megasas_scsi_info, NULL); if (!d->hotplugged) { scsi_bus_legacy_handle_cmdline(&s->bus, &err); if (err != NULL) { error_free(err); return -1; } } return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "DeviceState *d = DEVICE(VAR_0);", "MegasasState *s = MEGASAS(VAR_0);", "MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);", "uint8_t *pci_conf;", "int VAR_1, VAR_2;", "Error *err = NULL;", "pci_conf = VAR_0->config;", "pci_conf[PCI_LATENCY_TIMER] = 0;", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 29 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ...
26,292
VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf) { VirtIOBlock *s; int cylinders, heads, secs; static int virtio_blk_id; DriveInfo *dinfo; if (!conf->bs) { error_report("virtio-blk-pci: drive property not set"); s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config), sizeof(VirtIOBlock)); s->vdev.get_config = virtio_blk_update_config; s->vdev.get_features = virtio_blk_get_features; s->vdev.reset = virtio_blk_reset; s->bs = conf->bs; s->conf = conf; s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); /* NB: per existing s/n string convention the string is terminated * by '\0' only when less than sizeof (s->sn) */ dinfo = drive_get_by_blockdev(s->bs); strncpy(s->sn, dinfo->serial, sizeof (s->sn)); s->vq = virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output); qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(dev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_removable(s->bs, 0); return &s->vdev;
true
qemu
98f28ad7a7d26e5e77c5cb37b262d76d6ccd963d
VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf) { VirtIOBlock *s; int cylinders, heads, secs; static int virtio_blk_id; DriveInfo *dinfo; if (!conf->bs) { error_report("virtio-blk-pci: drive property not set"); s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config), sizeof(VirtIOBlock)); s->vdev.get_config = virtio_blk_update_config; s->vdev.get_features = virtio_blk_get_features; s->vdev.reset = virtio_blk_reset; s->bs = conf->bs; s->conf = conf; s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); dinfo = drive_get_by_blockdev(s->bs); strncpy(s->sn, dinfo->serial, sizeof (s->sn)); s->vq = virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output); qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(dev, "virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_removable(s->bs, 0); return &s->vdev;
{ "code": [], "line_no": [] }
VirtIODevice *FUNC_0(DeviceState *dev, BlockConf *conf) { VirtIOBlock *s; int VAR_0, VAR_1, VAR_2; static int VAR_3; DriveInfo *dinfo; if (!conf->bs) { error_report("virtio-blk-pci: drive property not set"); s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config), sizeof(VirtIOBlock)); s->vdev.get_config = virtio_blk_update_config; s->vdev.get_features = virtio_blk_get_features; s->vdev.reset = virtio_blk_reset; s->bs = conf->bs; s->conf = conf; s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; bdrv_guess_geometry(s->bs, &VAR_0, &VAR_1, &VAR_2); dinfo = drive_get_by_blockdev(s->bs); strncpy(s->sn, dinfo->serial, sizeof (s->sn)); s->vq = virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output); qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm(dev, "virtio-blk", VAR_3++, 2, virtio_blk_save, virtio_blk_load, s); bdrv_set_removable(s->bs, 0); return &s->vdev;
[ "VirtIODevice *FUNC_0(DeviceState *dev, BlockConf *conf)\n{", "VirtIOBlock *s;", "int VAR_0, VAR_1, VAR_2;", "static int VAR_3;", "DriveInfo *dinfo;", "if (!conf->bs) {", "error_report(\"virtio-blk-pci: drive property not set\");", "s = (VirtIOBlock *)virtio_common_init(\"virtio-blk\", VIRTIO_ID_BLOCK...
[ 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 ], [ 27, 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 59 ], [ 61 ], [ 65 ...
26,293
int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { BDRVQcowState *s = bs->opaque; QEMUSnapshotInfo *sn_tab, *sn_info; QCowSnapshot *sn; int i; if (!s->nb_snapshots) { *psn_tab = NULL; return s->nb_snapshots; } sn_tab = g_malloc0(s->nb_snapshots * sizeof(QEMUSnapshotInfo)); for(i = 0; i < s->nb_snapshots; i++) { sn_info = sn_tab + i; sn = s->snapshots + i; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), sn->id_str); pstrcpy(sn_info->name, sizeof(sn_info->name), sn->name); sn_info->vm_state_size = sn->vm_state_size; sn_info->date_sec = sn->date_sec; sn_info->date_nsec = sn->date_nsec; sn_info->vm_clock_nsec = sn->vm_clock_nsec; } *psn_tab = sn_tab; return s->nb_snapshots; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { BDRVQcowState *s = bs->opaque; QEMUSnapshotInfo *sn_tab, *sn_info; QCowSnapshot *sn; int i; if (!s->nb_snapshots) { *psn_tab = NULL; return s->nb_snapshots; } sn_tab = g_malloc0(s->nb_snapshots * sizeof(QEMUSnapshotInfo)); for(i = 0; i < s->nb_snapshots; i++) { sn_info = sn_tab + i; sn = s->snapshots + i; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), sn->id_str); pstrcpy(sn_info->name, sizeof(sn_info->name), sn->name); sn_info->vm_state_size = sn->vm_state_size; sn_info->date_sec = sn->date_sec; sn_info->date_nsec = sn->date_nsec; sn_info->vm_clock_nsec = sn->vm_clock_nsec; } *psn_tab = sn_tab; return s->nb_snapshots; }
{ "code": [ " sn_tab = g_malloc0(s->nb_snapshots * sizeof(QEMUSnapshotInfo));" ], "line_no": [ 25 ] }
int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo **VAR_1) { BDRVQcowState *s = VAR_0->opaque; QEMUSnapshotInfo *sn_tab, *sn_info; QCowSnapshot *sn; int VAR_2; if (!s->nb_snapshots) { *VAR_1 = NULL; return s->nb_snapshots; } sn_tab = g_malloc0(s->nb_snapshots * sizeof(QEMUSnapshotInfo)); for(VAR_2 = 0; VAR_2 < s->nb_snapshots; VAR_2++) { sn_info = sn_tab + VAR_2; sn = s->snapshots + VAR_2; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), sn->id_str); pstrcpy(sn_info->name, sizeof(sn_info->name), sn->name); sn_info->vm_state_size = sn->vm_state_size; sn_info->date_sec = sn->date_sec; sn_info->date_nsec = sn->date_nsec; sn_info->vm_clock_nsec = sn->vm_clock_nsec; } *VAR_1 = sn_tab; return s->nb_snapshots; }
[ "int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo **VAR_1)\n{", "BDRVQcowState *s = VAR_0->opaque;", "QEMUSnapshotInfo *sn_tab, *sn_info;", "QCowSnapshot *sn;", "int VAR_2;", "if (!s->nb_snapshots) {", "*VAR_1 = NULL;", "return s->nb_snapshots;", "}", "sn_tab = g_malloc0(s->nb_snapshots * size...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ...
26,295
static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; register int t1,t2,t3,t4,t5,t6,t7,t8; DCTELEM *src, *dst; const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; src = block; dst = block; for(i = 0; i < 8; i++){ t1 = 17 * (src[0] + src[2]) + 4; t2 = 17 * (src[0] - src[2]) + 4; t3 = 22 * src[1] + 10 * src[3]; t4 = 22 * src[3] - 10 * src[1]; dst[0] = (t1 + t3) >> 3; dst[1] = (t2 - t4) >> 3; dst[2] = (t2 + t4) >> 3; dst[3] = (t1 - t3) >> 3; src += 8; dst += 8; } src = block; for(i = 0; i < 4; i++){ t1 = 12 * (src[ 0] + src[32]) + 64; t2 = 12 * (src[ 0] - src[32]) + 64; t3 = 16 * src[16] + 6 * src[48]; t4 = 6 * src[16] - 16 * src[48]; t5 = t1 + t3; t6 = t2 + t4; t7 = t2 - t4; t8 = t1 - t3; t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; dest[0*linesize] = cm[dest[0*linesize] + ((t5 + t1) >> 7)]; dest[1*linesize] = cm[dest[1*linesize] + ((t6 + t2) >> 7)]; dest[2*linesize] = cm[dest[2*linesize] + ((t7 + t3) >> 7)]; dest[3*linesize] = cm[dest[3*linesize] + ((t8 + t4) >> 7)]; dest[4*linesize] = cm[dest[4*linesize] + ((t8 - t4 + 1) >> 7)]; dest[5*linesize] = cm[dest[5*linesize] + ((t7 - t3 + 1) >> 7)]; dest[6*linesize] = cm[dest[6*linesize] + ((t6 - t2 + 1) >> 7)]; dest[7*linesize] = cm[dest[7*linesize] + ((t5 - t1 + 1) >> 7)]; src ++; dest++; } }
true
FFmpeg
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; register int t1,t2,t3,t4,t5,t6,t7,t8; DCTELEM *src, *dst; const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; src = block; dst = block; for(i = 0; i < 8; i++){ t1 = 17 * (src[0] + src[2]) + 4; t2 = 17 * (src[0] - src[2]) + 4; t3 = 22 * src[1] + 10 * src[3]; t4 = 22 * src[3] - 10 * src[1]; dst[0] = (t1 + t3) >> 3; dst[1] = (t2 - t4) >> 3; dst[2] = (t2 + t4) >> 3; dst[3] = (t1 - t3) >> 3; src += 8; dst += 8; } src = block; for(i = 0; i < 4; i++){ t1 = 12 * (src[ 0] + src[32]) + 64; t2 = 12 * (src[ 0] - src[32]) + 64; t3 = 16 * src[16] + 6 * src[48]; t4 = 6 * src[16] - 16 * src[48]; t5 = t1 + t3; t6 = t2 + t4; t7 = t2 - t4; t8 = t1 - t3; t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; dest[0*linesize] = cm[dest[0*linesize] + ((t5 + t1) >> 7)]; dest[1*linesize] = cm[dest[1*linesize] + ((t6 + t2) >> 7)]; dest[2*linesize] = cm[dest[2*linesize] + ((t7 + t3) >> 7)]; dest[3*linesize] = cm[dest[3*linesize] + ((t8 + t4) >> 7)]; dest[4*linesize] = cm[dest[4*linesize] + ((t8 - t4 + 1) >> 7)]; dest[5*linesize] = cm[dest[5*linesize] + ((t7 - t3 + 1) >> 7)]; dest[6*linesize] = cm[dest[6*linesize] + ((t6 - t2 + 1) >> 7)]; dest[7*linesize] = cm[dest[7*linesize] + ((t5 - t1 + 1) >> 7)]; src ++; dest++; } }
{ "code": [ " const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " dest[0*linesize] = cm[dest[0*linesize] + ((t5 + t1) >> 7)];", " dest[1*linesize] = cm[dest[1*linesize] + ((t6 + t2) >> 7)];", " dest[2*linesize] = cm[dest[2*linesize] + ((t7 + t3) >> 7)];", " dest[3*linesize] = cm[dest[3*linesize] + ((t8 + t4) >> 7)];", " dest[4*linesize] = cm[dest[4*linesize] + ((t8 - t4 + 1) >> 7)];", " dest[5*linesize] = cm[dest[5*linesize] + ((t7 - t3 + 1) >> 7)];", " dest[6*linesize] = cm[dest[6*linesize] + ((t6 - t2 + 1) >> 7)];", " dest[7*linesize] = cm[dest[7*linesize] + ((t5 - t1 + 1) >> 7)];", " const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;" ], "line_no": [ 11, 11, 11, 11, 11, 83, 85, 87, 89, 91, 93, 95, 97, 11 ] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, DCTELEM *VAR_2) { int VAR_3; register int VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9,VAR_10,VAR_11; DCTELEM *src, *dst; const uint8_t *VAR_12 = ff_cropTbl + MAX_NEG_CROP; src = VAR_2; dst = VAR_2; for(VAR_3 = 0; VAR_3 < 8; VAR_3++){ VAR_4 = 17 * (src[0] + src[2]) + 4; VAR_5 = 17 * (src[0] - src[2]) + 4; VAR_6 = 22 * src[1] + 10 * src[3]; VAR_7 = 22 * src[3] - 10 * src[1]; dst[0] = (VAR_4 + VAR_6) >> 3; dst[1] = (VAR_5 - VAR_7) >> 3; dst[2] = (VAR_5 + VAR_7) >> 3; dst[3] = (VAR_4 - VAR_6) >> 3; src += 8; dst += 8; } src = VAR_2; for(VAR_3 = 0; VAR_3 < 4; VAR_3++){ VAR_4 = 12 * (src[ 0] + src[32]) + 64; VAR_5 = 12 * (src[ 0] - src[32]) + 64; VAR_6 = 16 * src[16] + 6 * src[48]; VAR_7 = 6 * src[16] - 16 * src[48]; VAR_8 = VAR_4 + VAR_6; VAR_9 = VAR_5 + VAR_7; VAR_10 = VAR_5 - VAR_7; VAR_11 = VAR_4 - VAR_6; VAR_4 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; VAR_5 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; VAR_6 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; VAR_7 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; VAR_0[0*VAR_1] = VAR_12[VAR_0[0*VAR_1] + ((VAR_8 + VAR_4) >> 7)]; VAR_0[1*VAR_1] = VAR_12[VAR_0[1*VAR_1] + ((VAR_9 + VAR_5) >> 7)]; VAR_0[2*VAR_1] = VAR_12[VAR_0[2*VAR_1] + ((VAR_10 + VAR_6) >> 7)]; VAR_0[3*VAR_1] = VAR_12[VAR_0[3*VAR_1] + ((VAR_11 + VAR_7) >> 7)]; VAR_0[4*VAR_1] = VAR_12[VAR_0[4*VAR_1] + ((VAR_11 - VAR_7 + 1) >> 7)]; VAR_0[5*VAR_1] = VAR_12[VAR_0[5*VAR_1] + ((VAR_10 - VAR_6 + 1) >> 7)]; VAR_0[6*VAR_1] = VAR_12[VAR_0[6*VAR_1] + ((VAR_9 - VAR_5 + 1) >> 7)]; VAR_0[7*VAR_1] = VAR_12[VAR_0[7*VAR_1] + ((VAR_8 - VAR_4 + 1) >> 7)]; src ++; VAR_0++; } }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, DCTELEM *VAR_2)\n{", "int VAR_3;", "register int VAR_4,VAR_5,VAR_6,VAR_7,VAR_8,VAR_9,VAR_10,VAR_11;", "DCTELEM *src, *dst;", "const uint8_t *VAR_12 = ff_cropTbl + MAX_NEG_CROP;", "src = VAR_2;", "dst = VAR_2;", "for(VAR_3 = 0; VAR_3 < 8; VAR_3++){", "VA...
[ 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, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ...
26,297
DISAS_INSN(shift_reg) { TCGv reg; TCGv shift; reg = DREG(insn, 0); shift = DREG(insn, 9); if (insn & 0x100) { gen_helper_shl_cc(reg, cpu_env, reg, shift); } else { if (insn & 8) { gen_helper_shr_cc(reg, cpu_env, reg, shift); } else { gen_helper_sar_cc(reg, cpu_env, reg, shift); } } set_cc_op(s, CC_OP_FLAGS); }
true
qemu
367790cce8e14131426f5190dfd7d1bdbf656e4d
DISAS_INSN(shift_reg) { TCGv reg; TCGv shift; reg = DREG(insn, 0); shift = DREG(insn, 9); if (insn & 0x100) { gen_helper_shl_cc(reg, cpu_env, reg, shift); } else { if (insn & 8) { gen_helper_shr_cc(reg, cpu_env, reg, shift); } else { gen_helper_sar_cc(reg, cpu_env, reg, shift); } } set_cc_op(s, CC_OP_FLAGS); }
{ "code": [ " TCGv reg;", " TCGv shift;", " reg = DREG(insn, 0);", " if (insn & 0x100) {", " gen_helper_shl_cc(reg, cpu_env, reg, shift);", " if (insn & 8) {", " gen_helper_shr_cc(reg, cpu_env, reg, shift);", " gen_helper_sar_cc(reg, cpu_env, reg, shift);", " TCGv reg;", " TCGv shift;", " reg = DREG(insn, 0);", " shift = DREG(insn, 9);", " if (insn & 0x100) {", " gen_helper_shl_cc(reg, cpu_env, reg, shift);", " if (insn & 8) {", " gen_helper_shr_cc(reg, cpu_env, reg, shift);", " gen_helper_sar_cc(reg, cpu_env, reg, shift);" ], "line_no": [ 5, 7, 11, 15, 17, 21, 23, 27, 5, 7, 11, 13, 15, 17, 21, 23, 27 ] }
FUNC_0(VAR_0) { TCGv reg; TCGv shift; reg = DREG(insn, 0); shift = DREG(insn, 9); if (insn & 0x100) { gen_helper_shl_cc(reg, cpu_env, reg, shift); } else { if (insn & 8) { gen_helper_shr_cc(reg, cpu_env, reg, shift); } else { gen_helper_sar_cc(reg, cpu_env, reg, shift); } } set_cc_op(s, CC_OP_FLAGS); }
[ "FUNC_0(VAR_0)\n{", "TCGv reg;", "TCGv shift;", "reg = DREG(insn, 0);", "shift = DREG(insn, 9);", "if (insn & 0x100) {", "gen_helper_shl_cc(reg, cpu_env, reg, shift);", "} else {", "if (insn & 8) {", "gen_helper_shr_cc(reg, cpu_env, reg, shift);", "} else {", "gen_helper_sar_cc(reg, cpu_env, r...
[ 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
26,298
static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx) { uint8_t *edata_ptr = avctx->extradata; unsigned int channel_mask; int i, bits; int log2_max_num_subframes; int num_possible_block_sizes; if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2) avctx->block_align = 2048; if (!avctx->block_align) { av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); return AVERROR(EINVAL); } s->avctx = avctx; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!s->fdsp) return AVERROR(ENOMEM); init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; /** dump the extradata */ av_log(avctx, AV_LOG_DEBUG, "extradata:\n"); for (i = 0; i < avctx->extradata_size; i++) av_log(avctx, AV_LOG_DEBUG, "[%x] ", avctx->extradata[i]); av_log(avctx, AV_LOG_DEBUG, "\n"); if (avctx->codec_id == AV_CODEC_ID_XMA2 && (!avctx->extradata || avctx->extradata_size >= 6)) { s->decode_flags = 0x10d6; channel_mask = avctx->extradata ? AV_RL32(edata_ptr+2) : 0; s->bits_per_sample = 16; } else if (avctx->codec_id == AV_CODEC_ID_XMA1) { s->decode_flags = 0x10d6; s->bits_per_sample = 16; channel_mask = 0; } else if (avctx->codec_id == AV_CODEC_ID_WMAPRO && avctx->extradata_size >= 18) { s->decode_flags = AV_RL16(edata_ptr+14); channel_mask = AV_RL32(edata_ptr+2); s->bits_per_sample = AV_RL16(edata_ptr); if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample); return AVERROR_PATCHWELCOME; } } else { avpriv_request_sample(avctx, "Unknown extradata size"); return AVERROR_PATCHWELCOME; } if (avctx->codec_id != AV_CODEC_ID_WMAPRO && avctx->channels > 2) { s->nb_channels = 2; } else { s->nb_channels = avctx->channels; } /** generic init */ s->log2_frame_size = av_log2(avctx->block_align) + 4; if (s->log2_frame_size > 25) { avpriv_request_sample(avctx, "Large block align"); return AVERROR_PATCHWELCOME; } /** frame info */ if (avctx->codec_id != AV_CODEC_ID_WMAPRO) s->skip_frame = 0; else s->skip_frame = 1; /* skip first frame */ s->packet_loss = 1; s->len_prefix = (s->decode_flags & 0x40); /** get frame len */ if (avctx->codec_id == AV_CODEC_ID_WMAPRO) { bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags); if (bits > WMAPRO_BLOCK_MAX_BITS) { avpriv_request_sample(avctx, "14-bit block sizes"); return AVERROR_PATCHWELCOME; } s->samples_per_frame = 1 << bits; } else { s->samples_per_frame = 512; } /** subframe info */ log2_max_num_subframes = ((s->decode_flags & 0x38) >> 3); s->max_num_subframes = 1 << log2_max_num_subframes; if (s->max_num_subframes == 16 || s->max_num_subframes == 4) s->max_subframe_len_bit = 1; s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1; num_possible_block_sizes = log2_max_num_subframes + 1; s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes; s->dynamic_range_compression = (s->decode_flags & 0x80); if (s->max_num_subframes > MAX_SUBFRAMES) { av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %"PRId8"\n", s->max_num_subframes); return AVERROR_INVALIDDATA; } if (s->min_samples_per_subframe < WMAPRO_BLOCK_MIN_SIZE) { av_log(avctx, AV_LOG_ERROR, "min_samples_per_subframe of %d too small\n", s->min_samples_per_subframe); return AVERROR_INVALIDDATA; } if (s->avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); return AVERROR_INVALIDDATA; } if (s->nb_channels <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", s->nb_channels); return AVERROR_INVALIDDATA; } else if (s->nb_channels > WMAPRO_MAX_CHANNELS) { avpriv_request_sample(avctx, "More than %d channels", WMAPRO_MAX_CHANNELS); return AVERROR_PATCHWELCOME; } /** init previous block len */ for (i = 0; i < s->nb_channels; i++) s->channel[i].prev_block_len = s->samples_per_frame; /** extract lfe channel position */ s->lfe_channel = -1; if (channel_mask & 8) { unsigned int mask; for (mask = 1; mask < 16; mask <<= 1) { if (channel_mask & mask) ++s->lfe_channel; } } INIT_VLC_STATIC(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE, scale_huffbits, 1, 1, scale_huffcodes, 2, 2, 616); INIT_VLC_STATIC(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE, scale_rl_huffbits, 1, 1, scale_rl_huffcodes, 4, 4, 1406); INIT_VLC_STATIC(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE, coef0_huffbits, 1, 1, coef0_huffcodes, 4, 4, 2108); INIT_VLC_STATIC(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE, coef1_huffbits, 1, 1, coef1_huffcodes, 4, 4, 3912); INIT_VLC_STATIC(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE, vec4_huffbits, 1, 1, vec4_huffcodes, 2, 2, 604); INIT_VLC_STATIC(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE, vec2_huffbits, 1, 1, vec2_huffcodes, 2, 2, 562); INIT_VLC_STATIC(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE, vec1_huffbits, 1, 1, vec1_huffcodes, 2, 2, 562); /** calculate number of scale factor bands and their offsets for every possible block size */ for (i = 0; i < num_possible_block_sizes; i++) { int subframe_len = s->samples_per_frame >> i; int x; int band = 1; int rate = get_rate(avctx); s->sfb_offsets[i][0] = 0; for (x = 0; x < MAX_BANDS-1 && s->sfb_offsets[i][band - 1] < subframe_len; x++) { int offset = (subframe_len * 2 * critical_freq[x]) / rate + 2; offset &= ~3; if (offset > s->sfb_offsets[i][band - 1]) s->sfb_offsets[i][band++] = offset; if (offset >= subframe_len) break; } s->sfb_offsets[i][band - 1] = subframe_len; s->num_sfb[i] = band - 1; if (s->num_sfb[i] <= 0) { av_log(avctx, AV_LOG_ERROR, "num_sfb invalid\n"); return AVERROR_INVALIDDATA; } } /** Scale factors can be shared between blocks of different size as every block has a different scale factor band layout. The matrix sf_offsets is needed to find the correct scale factor. */ for (i = 0; i < num_possible_block_sizes; i++) { int b; for (b = 0; b < s->num_sfb[i]; b++) { int x; int offset = ((s->sfb_offsets[i][b] + s->sfb_offsets[i][b + 1] - 1) << i) >> 1; for (x = 0; x < num_possible_block_sizes; x++) { int v = 0; while (s->sfb_offsets[x][v + 1] << x < offset) { v++; av_assert0(v < MAX_BANDS); } s->sf_offsets[i][x][b] = v; } } } /** init MDCT, FIXME: only init needed sizes */ for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) ff_mdct_init(&s->mdct_ctx[i], WMAPRO_BLOCK_MIN_BITS+1+i, 1, 1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + i - 1)) / (1 << (s->bits_per_sample - 1))); /** init MDCT windows: simple sine window */ for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) { const int win_idx = WMAPRO_BLOCK_MAX_BITS - i; ff_init_ff_sine_windows(win_idx); s->windows[WMAPRO_BLOCK_SIZES - i - 1] = ff_sine_windows[win_idx]; } /** calculate subwoofer cutoff values */ for (i = 0; i < num_possible_block_sizes; i++) { int block_size = s->samples_per_frame >> i; int cutoff = (440*block_size + 3LL * (s->avctx->sample_rate >> 1) - 1) / s->avctx->sample_rate; s->subwoofer_cutoffs[i] = av_clip(cutoff, 4, block_size); } /** calculate sine values for the decorrelation matrix */ for (i = 0; i < 33; i++) sin64[i] = sin(i*M_PI / 64.0); if (avctx->debug & FF_DEBUG_BITSTREAM) dump_context(s); avctx->channel_layout = channel_mask; return 0; }
true
FFmpeg
9ccc6cecd2d0645f5073382360509eb278b239b1
static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx) { uint8_t *edata_ptr = avctx->extradata; unsigned int channel_mask; int i, bits; int log2_max_num_subframes; int num_possible_block_sizes; if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2) avctx->block_align = 2048; if (!avctx->block_align) { av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); return AVERROR(EINVAL); } s->avctx = avctx; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!s->fdsp) return AVERROR(ENOMEM); init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; av_log(avctx, AV_LOG_DEBUG, "extradata:\n"); for (i = 0; i < avctx->extradata_size; i++) av_log(avctx, AV_LOG_DEBUG, "[%x] ", avctx->extradata[i]); av_log(avctx, AV_LOG_DEBUG, "\n"); if (avctx->codec_id == AV_CODEC_ID_XMA2 && (!avctx->extradata || avctx->extradata_size >= 6)) { s->decode_flags = 0x10d6; channel_mask = avctx->extradata ? AV_RL32(edata_ptr+2) : 0; s->bits_per_sample = 16; } else if (avctx->codec_id == AV_CODEC_ID_XMA1) { s->decode_flags = 0x10d6; s->bits_per_sample = 16; channel_mask = 0; } else if (avctx->codec_id == AV_CODEC_ID_WMAPRO && avctx->extradata_size >= 18) { s->decode_flags = AV_RL16(edata_ptr+14); channel_mask = AV_RL32(edata_ptr+2); s->bits_per_sample = AV_RL16(edata_ptr); if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { avpriv_request_sample(avctx, "bits per sample is %d", s->bits_per_sample); return AVERROR_PATCHWELCOME; } } else { avpriv_request_sample(avctx, "Unknown extradata size"); return AVERROR_PATCHWELCOME; } if (avctx->codec_id != AV_CODEC_ID_WMAPRO && avctx->channels > 2) { s->nb_channels = 2; } else { s->nb_channels = avctx->channels; } s->log2_frame_size = av_log2(avctx->block_align) + 4; if (s->log2_frame_size > 25) { avpriv_request_sample(avctx, "Large block align"); return AVERROR_PATCHWELCOME; } if (avctx->codec_id != AV_CODEC_ID_WMAPRO) s->skip_frame = 0; else s->skip_frame = 1; s->packet_loss = 1; s->len_prefix = (s->decode_flags & 0x40); if (avctx->codec_id == AV_CODEC_ID_WMAPRO) { bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags); if (bits > WMAPRO_BLOCK_MAX_BITS) { avpriv_request_sample(avctx, "14-bit block sizes"); return AVERROR_PATCHWELCOME; } s->samples_per_frame = 1 << bits; } else { s->samples_per_frame = 512; } log2_max_num_subframes = ((s->decode_flags & 0x38) >> 3); s->max_num_subframes = 1 << log2_max_num_subframes; if (s->max_num_subframes == 16 || s->max_num_subframes == 4) s->max_subframe_len_bit = 1; s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1; num_possible_block_sizes = log2_max_num_subframes + 1; s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes; s->dynamic_range_compression = (s->decode_flags & 0x80); if (s->max_num_subframes > MAX_SUBFRAMES) { av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %"PRId8"\n", s->max_num_subframes); return AVERROR_INVALIDDATA; } if (s->min_samples_per_subframe < WMAPRO_BLOCK_MIN_SIZE) { av_log(avctx, AV_LOG_ERROR, "min_samples_per_subframe of %d too small\n", s->min_samples_per_subframe); return AVERROR_INVALIDDATA; } if (s->avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); return AVERROR_INVALIDDATA; } if (s->nb_channels <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", s->nb_channels); return AVERROR_INVALIDDATA; } else if (s->nb_channels > WMAPRO_MAX_CHANNELS) { avpriv_request_sample(avctx, "More than %d channels", WMAPRO_MAX_CHANNELS); return AVERROR_PATCHWELCOME; } for (i = 0; i < s->nb_channels; i++) s->channel[i].prev_block_len = s->samples_per_frame; s->lfe_channel = -1; if (channel_mask & 8) { unsigned int mask; for (mask = 1; mask < 16; mask <<= 1) { if (channel_mask & mask) ++s->lfe_channel; } } INIT_VLC_STATIC(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE, scale_huffbits, 1, 1, scale_huffcodes, 2, 2, 616); INIT_VLC_STATIC(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE, scale_rl_huffbits, 1, 1, scale_rl_huffcodes, 4, 4, 1406); INIT_VLC_STATIC(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE, coef0_huffbits, 1, 1, coef0_huffcodes, 4, 4, 2108); INIT_VLC_STATIC(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE, coef1_huffbits, 1, 1, coef1_huffcodes, 4, 4, 3912); INIT_VLC_STATIC(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE, vec4_huffbits, 1, 1, vec4_huffcodes, 2, 2, 604); INIT_VLC_STATIC(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE, vec2_huffbits, 1, 1, vec2_huffcodes, 2, 2, 562); INIT_VLC_STATIC(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE, vec1_huffbits, 1, 1, vec1_huffcodes, 2, 2, 562); for (i = 0; i < num_possible_block_sizes; i++) { int subframe_len = s->samples_per_frame >> i; int x; int band = 1; int rate = get_rate(avctx); s->sfb_offsets[i][0] = 0; for (x = 0; x < MAX_BANDS-1 && s->sfb_offsets[i][band - 1] < subframe_len; x++) { int offset = (subframe_len * 2 * critical_freq[x]) / rate + 2; offset &= ~3; if (offset > s->sfb_offsets[i][band - 1]) s->sfb_offsets[i][band++] = offset; if (offset >= subframe_len) break; } s->sfb_offsets[i][band - 1] = subframe_len; s->num_sfb[i] = band - 1; if (s->num_sfb[i] <= 0) { av_log(avctx, AV_LOG_ERROR, "num_sfb invalid\n"); return AVERROR_INVALIDDATA; } } for (i = 0; i < num_possible_block_sizes; i++) { int b; for (b = 0; b < s->num_sfb[i]; b++) { int x; int offset = ((s->sfb_offsets[i][b] + s->sfb_offsets[i][b + 1] - 1) << i) >> 1; for (x = 0; x < num_possible_block_sizes; x++) { int v = 0; while (s->sfb_offsets[x][v + 1] << x < offset) { v++; av_assert0(v < MAX_BANDS); } s->sf_offsets[i][x][b] = v; } } } for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) ff_mdct_init(&s->mdct_ctx[i], WMAPRO_BLOCK_MIN_BITS+1+i, 1, 1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + i - 1)) / (1 << (s->bits_per_sample - 1))); for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) { const int win_idx = WMAPRO_BLOCK_MAX_BITS - i; ff_init_ff_sine_windows(win_idx); s->windows[WMAPRO_BLOCK_SIZES - i - 1] = ff_sine_windows[win_idx]; } for (i = 0; i < num_possible_block_sizes; i++) { int block_size = s->samples_per_frame >> i; int cutoff = (440*block_size + 3LL * (s->avctx->sample_rate >> 1) - 1) / s->avctx->sample_rate; s->subwoofer_cutoffs[i] = av_clip(cutoff, 4, block_size); } for (i = 0; i < 33; i++) sin64[i] = sin(i*M_PI / 64.0); if (avctx->debug & FF_DEBUG_BITSTREAM) dump_context(s); avctx->channel_layout = channel_mask; return 0; }
{ "code": [ " s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);", " if (!s->fdsp)", " return AVERROR(ENOMEM);" ], "line_no": [ 35, 37, 39 ] }
static av_cold int FUNC_0(WMAProDecodeCtx *s, AVCodecContext *avctx) { uint8_t *edata_ptr = avctx->extradata; unsigned int VAR_0; int VAR_1, VAR_2; int VAR_3; int VAR_4; if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2) avctx->block_align = 2048; if (!avctx->block_align) { av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); return AVERROR(EINVAL); } s->avctx = avctx; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!s->fdsp) return AVERROR(ENOMEM); init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; av_log(avctx, AV_LOG_DEBUG, "extradata:\n"); for (VAR_1 = 0; VAR_1 < avctx->extradata_size; VAR_1++) av_log(avctx, AV_LOG_DEBUG, "[%VAR_7] ", avctx->extradata[VAR_1]); av_log(avctx, AV_LOG_DEBUG, "\n"); if (avctx->codec_id == AV_CODEC_ID_XMA2 && (!avctx->extradata || avctx->extradata_size >= 6)) { s->decode_flags = 0x10d6; VAR_0 = avctx->extradata ? AV_RL32(edata_ptr+2) : 0; s->bits_per_sample = 16; } else if (avctx->codec_id == AV_CODEC_ID_XMA1) { s->decode_flags = 0x10d6; s->bits_per_sample = 16; VAR_0 = 0; } else if (avctx->codec_id == AV_CODEC_ID_WMAPRO && avctx->extradata_size >= 18) { s->decode_flags = AV_RL16(edata_ptr+14); VAR_0 = AV_RL32(edata_ptr+2); s->bits_per_sample = AV_RL16(edata_ptr); if (s->bits_per_sample > 32 || s->bits_per_sample < 1) { avpriv_request_sample(avctx, "VAR_2 per sample is %d", s->bits_per_sample); return AVERROR_PATCHWELCOME; } } else { avpriv_request_sample(avctx, "Unknown extradata size"); return AVERROR_PATCHWELCOME; } if (avctx->codec_id != AV_CODEC_ID_WMAPRO && avctx->channels > 2) { s->nb_channels = 2; } else { s->nb_channels = avctx->channels; } s->log2_frame_size = av_log2(avctx->block_align) + 4; if (s->log2_frame_size > 25) { avpriv_request_sample(avctx, "Large block align"); return AVERROR_PATCHWELCOME; } if (avctx->codec_id != AV_CODEC_ID_WMAPRO) s->skip_frame = 0; else s->skip_frame = 1; s->packet_loss = 1; s->len_prefix = (s->decode_flags & 0x40); if (avctx->codec_id == AV_CODEC_ID_WMAPRO) { VAR_2 = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags); if (VAR_2 > WMAPRO_BLOCK_MAX_BITS) { avpriv_request_sample(avctx, "14-bit block sizes"); return AVERROR_PATCHWELCOME; } s->samples_per_frame = 1 << VAR_2; } else { s->samples_per_frame = 512; } VAR_3 = ((s->decode_flags & 0x38) >> 3); s->max_num_subframes = 1 << VAR_3; if (s->max_num_subframes == 16 || s->max_num_subframes == 4) s->max_subframe_len_bit = 1; s->subframe_len_bits = av_log2(VAR_3) + 1; VAR_4 = VAR_3 + 1; s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes; s->dynamic_range_compression = (s->decode_flags & 0x80); if (s->max_num_subframes > MAX_SUBFRAMES) { av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %"PRId8"\n", s->max_num_subframes); return AVERROR_INVALIDDATA; } if (s->min_samples_per_subframe < WMAPRO_BLOCK_MIN_SIZE) { av_log(avctx, AV_LOG_ERROR, "min_samples_per_subframe of %d too small\n", s->min_samples_per_subframe); return AVERROR_INVALIDDATA; } if (s->avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid sample VAR_9\n"); return AVERROR_INVALIDDATA; } if (s->nb_channels <= 0) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", s->nb_channels); return AVERROR_INVALIDDATA; } else if (s->nb_channels > WMAPRO_MAX_CHANNELS) { avpriv_request_sample(avctx, "More than %d channels", WMAPRO_MAX_CHANNELS); return AVERROR_PATCHWELCOME; } for (VAR_1 = 0; VAR_1 < s->nb_channels; VAR_1++) s->channel[VAR_1].prev_block_len = s->samples_per_frame; s->lfe_channel = -1; if (VAR_0 & 8) { unsigned int VAR_5; for (VAR_5 = 1; VAR_5 < 16; VAR_5 <<= 1) { if (VAR_0 & VAR_5) ++s->lfe_channel; } } INIT_VLC_STATIC(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE, scale_huffbits, 1, 1, scale_huffcodes, 2, 2, 616); INIT_VLC_STATIC(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE, scale_rl_huffbits, 1, 1, scale_rl_huffcodes, 4, 4, 1406); INIT_VLC_STATIC(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE, coef0_huffbits, 1, 1, coef0_huffcodes, 4, 4, 2108); INIT_VLC_STATIC(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE, coef1_huffbits, 1, 1, coef1_huffcodes, 4, 4, 3912); INIT_VLC_STATIC(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE, vec4_huffbits, 1, 1, vec4_huffcodes, 2, 2, 604); INIT_VLC_STATIC(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE, vec2_huffbits, 1, 1, vec2_huffcodes, 2, 2, 562); INIT_VLC_STATIC(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE, vec1_huffbits, 1, 1, vec1_huffcodes, 2, 2, 562); for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) { int VAR_6 = s->samples_per_frame >> VAR_1; int VAR_7; int VAR_8 = 1; int VAR_9 = get_rate(avctx); s->sfb_offsets[VAR_1][0] = 0; for (VAR_7 = 0; VAR_7 < MAX_BANDS-1 && s->sfb_offsets[VAR_1][VAR_8 - 1] < VAR_6; VAR_7++) { int offset = (VAR_6 * 2 * critical_freq[VAR_7]) / VAR_9 + 2; offset &= ~3; if (offset > s->sfb_offsets[VAR_1][VAR_8 - 1]) s->sfb_offsets[VAR_1][VAR_8++] = offset; if (offset >= VAR_6) break; } s->sfb_offsets[VAR_1][VAR_8 - 1] = VAR_6; s->num_sfb[VAR_1] = VAR_8 - 1; if (s->num_sfb[VAR_1] <= 0) { av_log(avctx, AV_LOG_ERROR, "num_sfb invalid\n"); return AVERROR_INVALIDDATA; } } for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) { int VAR_10; for (VAR_10 = 0; VAR_10 < s->num_sfb[VAR_1]; VAR_10++) { int VAR_7; int offset = ((s->sfb_offsets[VAR_1][VAR_10] + s->sfb_offsets[VAR_1][VAR_10 + 1] - 1) << VAR_1) >> 1; for (VAR_7 = 0; VAR_7 < VAR_4; VAR_7++) { int v = 0; while (s->sfb_offsets[VAR_7][v + 1] << VAR_7 < offset) { v++; av_assert0(v < MAX_BANDS); } s->sf_offsets[VAR_1][VAR_7][VAR_10] = v; } } } for (VAR_1 = 0; VAR_1 < WMAPRO_BLOCK_SIZES; VAR_1++) ff_mdct_init(&s->mdct_ctx[VAR_1], WMAPRO_BLOCK_MIN_BITS+1+VAR_1, 1, 1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + VAR_1 - 1)) / (1 << (s->bits_per_sample - 1))); for (VAR_1 = 0; VAR_1 < WMAPRO_BLOCK_SIZES; VAR_1++) { const int win_idx = WMAPRO_BLOCK_MAX_BITS - VAR_1; ff_init_ff_sine_windows(win_idx); s->windows[WMAPRO_BLOCK_SIZES - VAR_1 - 1] = ff_sine_windows[win_idx]; } for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) { int VAR_11 = s->samples_per_frame >> VAR_1; int VAR_12 = (440*VAR_11 + 3LL * (s->avctx->sample_rate >> 1) - 1) / s->avctx->sample_rate; s->subwoofer_cutoffs[VAR_1] = av_clip(VAR_12, 4, VAR_11); } for (VAR_1 = 0; VAR_1 < 33; VAR_1++) sin64[VAR_1] = sin(VAR_1*M_PI / 64.0); if (avctx->debug & FF_DEBUG_BITSTREAM) dump_context(s); avctx->channel_layout = VAR_0; return 0; }
[ "static av_cold int FUNC_0(WMAProDecodeCtx *s, AVCodecContext *avctx)\n{", "uint8_t *edata_ptr = avctx->extradata;", "unsigned int VAR_0;", "int VAR_1, VAR_2;", "int VAR_3;", "int VAR_4;", "if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2)\navctx->block_align = 2048;", "i...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ...
26,299
static uint16_t qvirtio_pci_get_queue_size(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readw(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NUM); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static uint16_t qvirtio_pci_get_queue_size(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readw(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NUM); }
{ "code": [ " return qpci_io_readw(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NUM);" ], "line_no": [ 7 ] }
static uint16_t FUNC_0(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; return qpci_io_readw(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NUM); }
[ "static uint16_t FUNC_0(QVirtioDevice *d)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "return qpci_io_readw(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NUM);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,301
int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset, const void *buf, int count) { int ret; ret = bdrv_pwrite(bs, offset, buf, count); if (ret < 0) { return ret; } /* No flush needed for cache=writethrough, it uses O_DSYNC */ if ((bs->open_flags & BDRV_O_CACHE_MASK) != 0) { bdrv_flush(bs); } return 0; }
true
qemu
92196b2f5664d5defa778b1b24df56e2239b5e93
int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset, const void *buf, int count) { int ret; ret = bdrv_pwrite(bs, offset, buf, count); if (ret < 0) { return ret; } if ((bs->open_flags & BDRV_O_CACHE_MASK) != 0) { bdrv_flush(bs); } return 0; }
{ "code": [ " if ((bs->open_flags & BDRV_O_CACHE_MASK) != 0) {" ], "line_no": [ 23 ] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, const void *VAR_2, int VAR_3) { int VAR_4; VAR_4 = bdrv_pwrite(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_4 < 0) { return VAR_4; } if ((VAR_0->open_flags & BDRV_O_CACHE_MASK) != 0) { bdrv_flush(VAR_0); } return 0; }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nconst void *VAR_2, int VAR_3)\n{", "int VAR_4;", "VAR_4 = bdrv_pwrite(VAR_0, VAR_1, VAR_2, VAR_3);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "if ((VAR_0->open_flags & BDRV_O_CACHE_MASK) != 0) {", "bdrv_flush(VAR_0);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
26,302
static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx, RowContext *row, int n) { dnxhd_decode_dct_block(ctx, row, n, 4, 32, 6); }
true
FFmpeg
b8b8e82ea14016b2cb04b49ecea57f836e6ee7f8
static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx, RowContext *row, int n) { dnxhd_decode_dct_block(ctx, row, n, 4, 32, 6); }
{ "code": [ "static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx,", "static void dnxhd_decode_dct_block_8(const DNXHDContext *ctx,", " dnxhd_decode_dct_block(ctx, row, n, 4, 32, 6);" ], "line_no": [ 1, 1, 7 ] }
static void FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1, int VAR_2) { dnxhd_decode_dct_block(VAR_0, VAR_1, VAR_2, 4, 32, 6); }
[ "static void FUNC_0(const DNXHDContext *VAR_0,\nRowContext *VAR_1, int VAR_2)\n{", "dnxhd_decode_dct_block(VAR_0, VAR_1, VAR_2, 4, 32, 6);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,303
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) { unsigned int first_mb_in_slice; unsigned int pps_id; int ret; unsigned int slice_type, tmp, i, j; int last_pic_structure, last_pic_droppable; int must_reinit; int needs_reinit = 0; int field_pic_flag, bottom_field_flag; int first_slice = sl == h->slice_ctx && !h->current_slice; int frame_num, picture_structure, droppable; PPS *pps; h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab; h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab; first_mb_in_slice = get_ue_golomb_long(&sl->gb); if (first_mb_in_slice == 0) { // FIXME better field boundary detection if (h->current_slice) { if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) { ff_h264_field_end(h, sl, 1); h->current_slice = 0; } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == NAL_IDR_SLICE) { av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n"); ff_h264_field_end(h, sl, 1); h->current_slice = 0; ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); h->cur_pic_ptr = NULL; } else return AVERROR_INVALIDDATA; } if (!h->first_field) { if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); } h->cur_pic_ptr = NULL; } } slice_type = get_ue_golomb_31(&sl->gb); if (slice_type > 9) { av_log(h->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", slice_type, first_mb_in_slice); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; sl->slice_type_fixed = 1; } else sl->slice_type_fixed = 0; slice_type = golomb_to_pict_type[slice_type]; sl->slice_type = slice_type; sl->slice_type_nos = slice_type & 3; if (h->nal_unit_type == NAL_IDR_SLICE && sl->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(h->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } if ( (h->avctx->skip_frame >= AVDISCARD_NONREF && !h->nal_ref_idc) || (h->avctx->skip_frame >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_frame >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_frame >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || h->avctx->skip_frame >= AVDISCARD_ALL) { return SLICE_SKIPED; } // to make a few old functions happy, it's wrong though h->pict_type = sl->slice_type; pps_id = get_ue_golomb(&sl->gb); if (pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); return AVERROR_INVALIDDATA; } if (!h->pps_buffers[pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id); return AVERROR_INVALIDDATA; } if (h->au_pps_id >= 0 && pps_id != h->au_pps_id) { av_log(h->avctx, AV_LOG_ERROR, "PPS change from %d to %d forbidden\n", h->au_pps_id, pps_id); return AVERROR_INVALIDDATA; } pps = h->pps_buffers[pps_id]; if (!h->sps_buffers[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", h->pps.sps_id); return AVERROR_INVALIDDATA; } if (first_slice) h->pps = *h->pps_buffers[pps_id]; if (pps->sps_id != h->sps.sps_id || pps->sps_id != h->current_sps_id || h->sps_buffers[pps->sps_id]->new) { if (!first_slice) { av_log(h->avctx, AV_LOG_ERROR, "SPS changed in the middle of the frame\n"); return AVERROR_INVALIDDATA; } h->sps = *h->sps_buffers[h->pps.sps_id]; if (h->mb_width != h->sps.mb_width || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) || h->cur_bit_depth_luma != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc ) needs_reinit = 1; if (h->bit_depth_luma != h->sps.bit_depth_luma || h->chroma_format_idc != h->sps.chroma_format_idc) { h->bit_depth_luma = h->sps.bit_depth_luma; h->chroma_format_idc = h->sps.chroma_format_idc; needs_reinit = 1; } if ((ret = ff_h264_set_parameter_from_sps(h)) < 0) return ret; } h->avctx->profile = ff_h264_get_profile(&h->sps); h->avctx->level = h->sps.level_idc; h->avctx->refs = h->sps.ref_frame_count; must_reinit = (h->context_initialized && ( 16*h->sps.mb_width != h->avctx->coded_width || 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height || h->cur_bit_depth_luma != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc || h->mb_width != h->sps.mb_width || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) )); if (h->avctx->pix_fmt == AV_PIX_FMT_NONE || (non_j_pixfmt(h->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h, 0)))) must_reinit = 1; if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio)) must_reinit = 1; h->mb_width = h->sps.mb_width; h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); h->mb_num = h->mb_width * h->mb_height; h->mb_stride = h->mb_width + 1; h->b_stride = h->mb_width * 4; h->chroma_y_shift = h->sps.chroma_format_idc <= 1; // 400 uses yuv420p h->width = 16 * h->mb_width; h->height = 16 * h->mb_height; ret = init_dimensions(h); if (ret < 0) return ret; if (h->sps.video_signal_type_present_flag) { h->avctx->color_range = h->sps.full_range>0 ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; if (h->sps.colour_description_present_flag) { if (h->avctx->colorspace != h->sps.colorspace) needs_reinit = 1; h->avctx->color_primaries = h->sps.color_primaries; h->avctx->color_trc = h->sps.color_trc; h->avctx->colorspace = h->sps.colorspace; } } if (h->context_initialized && (must_reinit || needs_reinit)) { if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, "changing width %d -> %d / height %d -> %d on " "slice %d\n", h->width, h->avctx->coded_width, h->height, h->avctx->coded_height, h->current_slice + 1); return AVERROR_INVALIDDATA; } av_assert1(first_slice); ff_h264_flush_change(h); if ((ret = get_pixel_format(h, 1)) < 0) return ret; h->avctx->pix_fmt = ret; av_log(h->avctx, AV_LOG_INFO, "Reinit context to %dx%d, " "pix_fmt: %s\n", h->width, h->height, av_get_pix_fmt_name(h->avctx->pix_fmt)); if ((ret = h264_slice_header_init(h, 1)) < 0) { av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return ret; } } if (!h->context_initialized) { if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, "Cannot (re-)initialize context during parallel decoding.\n"); return AVERROR_PATCHWELCOME; } if ((ret = get_pixel_format(h, 1)) < 0) return ret; h->avctx->pix_fmt = ret; if ((ret = h264_slice_header_init(h, 0)) < 0) { av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return ret; } } if (first_slice && h->dequant_coeff_pps != pps_id) { h->dequant_coeff_pps = pps_id; ff_h264_init_dequant_tables(h); } frame_num = get_bits(&sl->gb, h->sps.log2_max_frame_num); if (!first_slice) { if (h->frame_num != frame_num) { av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n", h->frame_num, frame_num); return AVERROR_INVALIDDATA; } } sl->mb_mbaff = 0; h->mb_aff_frame = 0; last_pic_structure = h->picture_structure; last_pic_droppable = h->droppable; droppable = h->nal_ref_idc == 0; if (h->sps.frame_mbs_only_flag) { picture_structure = PICT_FRAME; } else { if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) { av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } field_pic_flag = get_bits1(&sl->gb); if (field_pic_flag) { bottom_field_flag = get_bits1(&sl->gb); picture_structure = PICT_TOP_FIELD + bottom_field_flag; } else { picture_structure = PICT_FRAME; h->mb_aff_frame = h->sps.mb_aff; } } if (h->current_slice) { if (last_pic_structure != picture_structure || last_pic_droppable != droppable) { av_log(h->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", last_pic_structure, h->picture_structure); return AVERROR_INVALIDDATA; } else if (!h->cur_pic_ptr) { av_log(h->avctx, AV_LOG_ERROR, "unset cur_pic_ptr on slice %d\n", h->current_slice + 1); return AVERROR_INVALIDDATA; } } h->picture_structure = picture_structure; h->droppable = droppable; h->frame_num = frame_num; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (h->current_slice == 0) { /* Shorten frame num gaps so we don't have to allocate reference * frames just to throw them away */ if (h->frame_num != h->prev_frame_num) { int unwrap_prev_frame_num = h->prev_frame_num; int max_frame_num = 1 << h->sps.log2_max_frame_num; if (unwrap_prev_frame_num > h->frame_num) unwrap_prev_frame_num -= max_frame_num; if ((h->frame_num - unwrap_prev_frame_num) > h->sps.ref_frame_count) { unwrap_prev_frame_num = (h->frame_num - h->sps.ref_frame_count) - 1; if (unwrap_prev_frame_num < 0) unwrap_prev_frame_num += max_frame_num; h->prev_frame_num = unwrap_prev_frame_num; } } /* See if we have a decoded first field looking for a pair... * Here, we're using that to see if we should mark previously * decode frames as "finished". * We have to do that before the "dummy" in-between frame allocation, * since that can modify h->cur_pic_ptr. */ if (h->first_field) { assert(h->cur_pic_ptr); assert(h->cur_pic_ptr->f.buf[0]); assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF); /* Mark old field/frame as completed */ if (h->cur_pic_ptr->tf.owner == h->avctx) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_BOTTOM_FIELD); } /* figure out if we have a complementary field pair */ if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) { /* Previous field is unmatched. Don't display it, but let it * remain for reference if marked as such. */ if (last_pic_structure != PICT_FRAME) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_TOP_FIELD); } } else { if (h->cur_pic_ptr->frame_num != h->frame_num) { /* This and previous field were reference, but had * different frame_nums. Consider this field first in * pair. Throw away previous field except for reference * purposes. */ if (last_pic_structure != PICT_FRAME) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_TOP_FIELD); } } else { /* Second field in complementary pair */ if (!((last_pic_structure == PICT_TOP_FIELD && h->picture_structure == PICT_BOTTOM_FIELD) || (last_pic_structure == PICT_BOTTOM_FIELD && h->picture_structure == PICT_TOP_FIELD))) { av_log(h->avctx, AV_LOG_ERROR, "Invalid field mode combination %d/%d\n", last_pic_structure, h->picture_structure); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_INVALIDDATA; } else if (last_pic_droppable != h->droppable) { avpriv_request_sample(h->avctx, "Found reference and non-reference fields in the same frame, which"); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_PATCHWELCOME; } } } } while (h->frame_num != h->prev_frame_num && !h->first_field && h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) { H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); if (!h->sps.gaps_in_frame_num_allowed_flag) for(i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; ret = h264_frame_start(h); if (ret < 0) { h->first_field = 0; return ret; } h->prev_frame_num++; h->prev_frame_num %= 1 << h->sps.log2_max_frame_num; h->cur_pic_ptr->frame_num = h->prev_frame_num; h->cur_pic_ptr->invalid_gap = !h->sps.gaps_in_frame_num_allowed_flag; ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); ret = ff_generate_sliding_window_mmcos(h, 1); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; ret = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; /* Error concealment: If a ref is missing, copy the previous ref * in its place. * FIXME: Avoiding a memcpy would be nice, but ref handling makes * many assumptions about there being no actual duplicates. * FIXME: This does not copy padding for out-of-frame motion * vectors. Given we are concealing a lost frame, this probably * is not noticeable by comparison, but it should be fixed. */ if (h->short_ref_count) { if (prev) { av_image_copy(h->short_ref[0]->f.data, h->short_ref[0]->f.linesize, (const uint8_t **)prev->f.data, prev->f.linesize, h->avctx->pix_fmt, h->mb_width * 16, h->mb_height * 16); h->short_ref[0]->poc = prev->poc + 2; } h->short_ref[0]->frame_num = h->prev_frame_num; } } /* See if we have a decoded first field looking for a pair... * We're using that to see whether to continue decoding in that * frame, or to allocate a new one. */ if (h->first_field) { assert(h->cur_pic_ptr); assert(h->cur_pic_ptr->f.buf[0]); assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF); /* figure out if we have a complementary field pair */ if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) { /* Previous field is unmatched. Don't display it, but let it * remain for reference if marked as such. */ h->missing_fields ++; h->cur_pic_ptr = NULL; h->first_field = FIELD_PICTURE(h); } else { h->missing_fields = 0; if (h->cur_pic_ptr->frame_num != h->frame_num) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure==PICT_BOTTOM_FIELD); /* This and the previous field had different frame_nums. * Consider this field first in pair. Throw away previous * one except for reference purposes. */ h->first_field = 1; h->cur_pic_ptr = NULL; } else { /* Second field in complementary pair */ h->first_field = 0; } } } else { /* Frame or first field in a potentially complementary pair */ h->first_field = FIELD_PICTURE(h); } if (!FIELD_PICTURE(h) || h->first_field) { if (h264_frame_start(h) < 0) { h->first_field = 0; return AVERROR_INVALIDDATA; } } else { release_unused_pictures(h, 0); } /* Some macroblocks can be accessed before they're available in case * of lost slices, MBAFF or threading. */ if (FIELD_PICTURE(h)) { for(i = (h->picture_structure == PICT_BOTTOM_FIELD); i<h->mb_height; i++) memset(h->slice_table + i*h->mb_stride, -1, (h->mb_stride - (i+1==h->mb_height)) * sizeof(*h->slice_table)); } else { memset(h->slice_table, -1, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); } h->last_slice_type = -1; } h->cur_pic_ptr->frame_num = h->frame_num; // FIXME frame_num cleanup av_assert1(h->mb_num == h->mb_width * h->mb_height); if (first_mb_in_slice << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num || first_mb_in_slice >= h->mb_num) { av_log(h->avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); return AVERROR_INVALIDDATA; } sl->resync_mb_x = sl->mb_x = first_mb_in_slice % h->mb_width; sl->resync_mb_y = sl->mb_y = (first_mb_in_slice / h->mb_width) << FIELD_OR_MBAFF_PICTURE(h); if (h->picture_structure == PICT_BOTTOM_FIELD) sl->resync_mb_y = sl->mb_y = sl->mb_y + 1; av_assert1(sl->mb_y < h->mb_height); if (h->picture_structure == PICT_FRAME) { h->curr_pic_num = h->frame_num; h->max_pic_num = 1 << h->sps.log2_max_frame_num; } else { h->curr_pic_num = 2 * h->frame_num + 1; h->max_pic_num = 1 << (h->sps.log2_max_frame_num + 1); } if (h->nal_unit_type == NAL_IDR_SLICE) get_ue_golomb(&sl->gb); /* idr_pic_id */ if (h->sps.poc_type == 0) { h->poc_lsb = get_bits(&sl->gb, h->sps.log2_max_poc_lsb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc_bottom = get_se_golomb(&sl->gb); } if (h->sps.poc_type == 1 && !h->sps.delta_pic_order_always_zero_flag) { h->delta_poc[0] = get_se_golomb(&sl->gb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc[1] = get_se_golomb(&sl->gb); } ff_init_poc(h, h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc); if (h->pps.redundant_pic_cnt_present) sl->redundant_pic_count = get_ue_golomb(&sl->gb); ret = ff_set_ref_count(h, sl); if (ret < 0) return ret; if (slice_type != AV_PICTURE_TYPE_I && (h->current_slice == 0 || slice_type != h->last_slice_type || memcmp(h->last_ref_count, sl->ref_count, sizeof(sl->ref_count)))) { ff_h264_fill_default_ref_list(h, sl); } if (sl->slice_type_nos != AV_PICTURE_TYPE_I) { ret = ff_h264_decode_ref_pic_list_reordering(h, sl); if (ret < 0) { sl->ref_count[1] = sl->ref_count[0] = 0; return ret; } } if ((h->pps.weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) ff_pred_weight_table(h, sl); else if (h->pps.weighted_bipred_idc == 2 && sl->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, sl, -1); } else { sl->use_weight = 0; for (i = 0; i < 2; i++) { sl->luma_weight_flag[i] = 0; sl->chroma_weight_flag[i] = 0; } } // If frame-mt is enabled, only update mmco tables for the first slice // in a field. Subsequent slices can temporarily clobber h->mmco_index // or h->mmco, which will cause ref list mix-ups and decoding errors // further down the line. This may break decoding if the first slice is // corrupt, thus we only do this if frame-mt is enabled. if (h->nal_ref_idc) { ret = ff_h264_decode_ref_pic_marking(h, &sl->gb, !(h->avctx->active_thread_type & FF_THREAD_FRAME) || h->current_slice == 0); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (FRAME_MBAFF(h)) { ff_h264_fill_mbaff_ref_list(h, sl); if (h->pps.weighted_bipred_idc == 2 && sl->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, sl, 0); implicit_weight_table(h, sl, 1); } } if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred) ff_h264_direct_dist_scale_factor(h, sl); ff_h264_direct_ref_list_init(h, sl); if (sl->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", tmp); return AVERROR_INVALIDDATA; } sl->cabac_init_idc = tmp; } sl->last_qscale_diff = 0; tmp = h->pps.init_qp + get_se_golomb(&sl->gb); if (tmp > 51 + 6 * (h->sps.bit_depth_luma - 8)) { av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->qscale = tmp; sl->chroma_qp[0] = get_chroma_qp(h, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale); // FIXME qscale / qp ... stuff if (sl->slice_type == AV_PICTURE_TYPE_SP) get_bits1(&sl->gb); /* sp_for_switch_flag */ if (sl->slice_type == AV_PICTURE_TYPE_SP || sl->slice_type == AV_PICTURE_TYPE_SI) get_se_golomb(&sl->gb); /* slice_qs_delta */ sl->deblocking_filter = 1; sl->slice_alpha_c0_offset = 0; sl->slice_beta_offset = 0; if (h->pps.deblocking_filter_parameters_present) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->deblocking_filter = tmp; if (sl->deblocking_filter < 2) sl->deblocking_filter ^= 1; // 1<->0 if (sl->deblocking_filter) { sl->slice_alpha_c0_offset = get_se_golomb(&sl->gb) * 2; sl->slice_beta_offset = get_se_golomb(&sl->gb) * 2; if (sl->slice_alpha_c0_offset > 12 || sl->slice_alpha_c0_offset < -12 || sl->slice_beta_offset > 12 || sl->slice_beta_offset < -12) { av_log(h->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", sl->slice_alpha_c0_offset, sl->slice_beta_offset); return AVERROR_INVALIDDATA; } } } if (h->avctx->skip_loop_filter >= AVDISCARD_ALL || (h->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || (h->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_loop_filter >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) sl->deblocking_filter = 0; if (sl->deblocking_filter == 1 && h->max_contexts > 1) { if (h->avctx->flags2 & CODEC_FLAG2_FAST) { /* Cheat slightly for speed: * Do not bother to deblock across slices. */ sl->deblocking_filter = 2; } else { h->max_contexts = 1; if (!h->single_decode_warning) { av_log(h->avctx, AV_LOG_INFO, "Cannot parallelize slice decoding with deblocking filter type 1, decoding such frames in sequential order\n" "To parallelize slice decoding you need video encoded with disable_deblocking_filter_idc set to 2 (deblock only edges that do not cross slices).\n" "Setting the flags2 libavcodec option to +fast (-flags2 +fast) will disable deblocking across slices and enable parallel slice decoding " "but will generate non-standard-compliant output.\n"); h->single_decode_warning = 1; } if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, "Deblocking switched inside frame.\n"); return SLICE_SINGLETHREAD; } } } sl->qp_thresh = 15 - FFMIN(sl->slice_alpha_c0_offset, sl->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]) + 6 * (h->sps.bit_depth_luma - 8); h->last_slice_type = slice_type; memcpy(h->last_ref_count, sl->ref_count, sizeof(h->last_ref_count)); sl->slice_num = ++h->current_slice; if (sl->slice_num) h->slice_row[(sl->slice_num-1)&(MAX_SLICES-1)]= sl->resync_mb_y; if ( h->slice_row[sl->slice_num&(MAX_SLICES-1)] + 3 >= sl->resync_mb_y && h->slice_row[sl->slice_num&(MAX_SLICES-1)] <= sl->resync_mb_y && sl->slice_num >= MAX_SLICES) { //in case of ASO this check needs to be updated depending on how we decide to assign slice numbers in this case av_log(h->avctx, AV_LOG_WARNING, "Possibly too many slices (%d >= %d), increase MAX_SLICES and recompile if there are artifacts\n", sl->slice_num, MAX_SLICES); } for (j = 0; j < 2; j++) { int id_list[16]; int *ref2frm = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][j]; for (i = 0; i < 16; i++) { id_list[i] = 60; if (j < sl->list_count && i < sl->ref_count[j] && sl->ref_list[j][i].parent->f.buf[0]) { int k; AVBuffer *buf = sl->ref_list[j][i].parent->f.buf[0]->buffer; for (k = 0; k < h->short_ref_count; k++) if (h->short_ref[k]->f.buf[0]->buffer == buf) { id_list[i] = k; break; } for (k = 0; k < h->long_ref_count; k++) if (h->long_ref[k] && h->long_ref[k]->f.buf[0]->buffer == buf) { id_list[i] = h->short_ref_count + k; break; } } } ref2frm[0] = ref2frm[1] = -1; for (i = 0; i < 16; i++) ref2frm[i + 2] = 4 * id_list[i] + (sl->ref_list[j][i].reference & 3); ref2frm[18 + 0] = ref2frm[18 + 1] = -1; for (i = 16; i < 48; i++) ref2frm[i + 4] = 4 * id_list[(i - 16) >> 1] + (sl->ref_list[j][i].reference & 3); } h->au_pps_id = pps_id; h->sps.new = h->sps_buffers[h->pps.sps_id]->new = 0; h->current_sps_id = h->pps.sps_id; if (h->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(h->avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n", sl->slice_num, (h->picture_structure == PICT_FRAME ? "F" : h->picture_structure == PICT_TOP_FIELD ? "T" : "B"), first_mb_in_slice, av_get_picture_type_char(sl->slice_type), sl->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "", pps_id, h->frame_num, h->cur_pic_ptr->field_poc[0], h->cur_pic_ptr->field_poc[1], sl->ref_count[0], sl->ref_count[1], sl->qscale, sl->deblocking_filter, sl->slice_alpha_c0_offset, sl->slice_beta_offset, sl->use_weight, sl->use_weight == 1 && sl->use_weight_chroma ? "c" : "", sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""); } return 0; }
true
FFmpeg
386601286fed2dff5e1955bc21a0256f6f35ab19
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl) { unsigned int first_mb_in_slice; unsigned int pps_id; int ret; unsigned int slice_type, tmp, i, j; int last_pic_structure, last_pic_droppable; int must_reinit; int needs_reinit = 0; int field_pic_flag, bottom_field_flag; int first_slice = sl == h->slice_ctx && !h->current_slice; int frame_num, picture_structure, droppable; PPS *pps; h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab; h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab; first_mb_in_slice = get_ue_golomb_long(&sl->gb); if (first_mb_in_slice == 0) { if (h->current_slice) { if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) { ff_h264_field_end(h, sl, 1); h->current_slice = 0; } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == NAL_IDR_SLICE) { av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n"); ff_h264_field_end(h, sl, 1); h->current_slice = 0; ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); h->cur_pic_ptr = NULL; } else return AVERROR_INVALIDDATA; } if (!h->first_field) { if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); } h->cur_pic_ptr = NULL; } } slice_type = get_ue_golomb_31(&sl->gb); if (slice_type > 9) { av_log(h->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", slice_type, first_mb_in_slice); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; sl->slice_type_fixed = 1; } else sl->slice_type_fixed = 0; slice_type = golomb_to_pict_type[slice_type]; sl->slice_type = slice_type; sl->slice_type_nos = slice_type & 3; if (h->nal_unit_type == NAL_IDR_SLICE && sl->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(h->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } if ( (h->avctx->skip_frame >= AVDISCARD_NONREF && !h->nal_ref_idc) || (h->avctx->skip_frame >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_frame >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_frame >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || h->avctx->skip_frame >= AVDISCARD_ALL) { return SLICE_SKIPED; } h->pict_type = sl->slice_type; pps_id = get_ue_golomb(&sl->gb); if (pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); return AVERROR_INVALIDDATA; } if (!h->pps_buffers[pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id); return AVERROR_INVALIDDATA; } if (h->au_pps_id >= 0 && pps_id != h->au_pps_id) { av_log(h->avctx, AV_LOG_ERROR, "PPS change from %d to %d forbidden\n", h->au_pps_id, pps_id); return AVERROR_INVALIDDATA; } pps = h->pps_buffers[pps_id]; if (!h->sps_buffers[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", h->pps.sps_id); return AVERROR_INVALIDDATA; } if (first_slice) h->pps = *h->pps_buffers[pps_id]; if (pps->sps_id != h->sps.sps_id || pps->sps_id != h->current_sps_id || h->sps_buffers[pps->sps_id]->new) { if (!first_slice) { av_log(h->avctx, AV_LOG_ERROR, "SPS changed in the middle of the frame\n"); return AVERROR_INVALIDDATA; } h->sps = *h->sps_buffers[h->pps.sps_id]; if (h->mb_width != h->sps.mb_width || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) || h->cur_bit_depth_luma != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc ) needs_reinit = 1; if (h->bit_depth_luma != h->sps.bit_depth_luma || h->chroma_format_idc != h->sps.chroma_format_idc) { h->bit_depth_luma = h->sps.bit_depth_luma; h->chroma_format_idc = h->sps.chroma_format_idc; needs_reinit = 1; } if ((ret = ff_h264_set_parameter_from_sps(h)) < 0) return ret; } h->avctx->profile = ff_h264_get_profile(&h->sps); h->avctx->level = h->sps.level_idc; h->avctx->refs = h->sps.ref_frame_count; must_reinit = (h->context_initialized && ( 16*h->sps.mb_width != h->avctx->coded_width || 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height || h->cur_bit_depth_luma != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc || h->mb_width != h->sps.mb_width || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) )); if (h->avctx->pix_fmt == AV_PIX_FMT_NONE || (non_j_pixfmt(h->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h, 0)))) must_reinit = 1; if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio)) must_reinit = 1; h->mb_width = h->sps.mb_width; h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); h->mb_num = h->mb_width * h->mb_height; h->mb_stride = h->mb_width + 1; h->b_stride = h->mb_width * 4; h->chroma_y_shift = h->sps.chroma_format_idc <= 1; h->width = 16 * h->mb_width; h->height = 16 * h->mb_height; ret = init_dimensions(h); if (ret < 0) return ret; if (h->sps.video_signal_type_present_flag) { h->avctx->color_range = h->sps.full_range>0 ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; if (h->sps.colour_description_present_flag) { if (h->avctx->colorspace != h->sps.colorspace) needs_reinit = 1; h->avctx->color_primaries = h->sps.color_primaries; h->avctx->color_trc = h->sps.color_trc; h->avctx->colorspace = h->sps.colorspace; } } if (h->context_initialized && (must_reinit || needs_reinit)) { if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, "changing width %d -> %d / height %d -> %d on " "slice %d\n", h->width, h->avctx->coded_width, h->height, h->avctx->coded_height, h->current_slice + 1); return AVERROR_INVALIDDATA; } av_assert1(first_slice); ff_h264_flush_change(h); if ((ret = get_pixel_format(h, 1)) < 0) return ret; h->avctx->pix_fmt = ret; av_log(h->avctx, AV_LOG_INFO, "Reinit context to %dx%d, " "pix_fmt: %s\n", h->width, h->height, av_get_pix_fmt_name(h->avctx->pix_fmt)); if ((ret = h264_slice_header_init(h, 1)) < 0) { av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return ret; } } if (!h->context_initialized) { if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, "Cannot (re-)initialize context during parallel decoding.\n"); return AVERROR_PATCHWELCOME; } if ((ret = get_pixel_format(h, 1)) < 0) return ret; h->avctx->pix_fmt = ret; if ((ret = h264_slice_header_init(h, 0)) < 0) { av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return ret; } } if (first_slice && h->dequant_coeff_pps != pps_id) { h->dequant_coeff_pps = pps_id; ff_h264_init_dequant_tables(h); } frame_num = get_bits(&sl->gb, h->sps.log2_max_frame_num); if (!first_slice) { if (h->frame_num != frame_num) { av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n", h->frame_num, frame_num); return AVERROR_INVALIDDATA; } } sl->mb_mbaff = 0; h->mb_aff_frame = 0; last_pic_structure = h->picture_structure; last_pic_droppable = h->droppable; droppable = h->nal_ref_idc == 0; if (h->sps.frame_mbs_only_flag) { picture_structure = PICT_FRAME; } else { if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) { av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } field_pic_flag = get_bits1(&sl->gb); if (field_pic_flag) { bottom_field_flag = get_bits1(&sl->gb); picture_structure = PICT_TOP_FIELD + bottom_field_flag; } else { picture_structure = PICT_FRAME; h->mb_aff_frame = h->sps.mb_aff; } } if (h->current_slice) { if (last_pic_structure != picture_structure || last_pic_droppable != droppable) { av_log(h->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", last_pic_structure, h->picture_structure); return AVERROR_INVALIDDATA; } else if (!h->cur_pic_ptr) { av_log(h->avctx, AV_LOG_ERROR, "unset cur_pic_ptr on slice %d\n", h->current_slice + 1); return AVERROR_INVALIDDATA; } } h->picture_structure = picture_structure; h->droppable = droppable; h->frame_num = frame_num; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (h->current_slice == 0) { if (h->frame_num != h->prev_frame_num) { int unwrap_prev_frame_num = h->prev_frame_num; int max_frame_num = 1 << h->sps.log2_max_frame_num; if (unwrap_prev_frame_num > h->frame_num) unwrap_prev_frame_num -= max_frame_num; if ((h->frame_num - unwrap_prev_frame_num) > h->sps.ref_frame_count) { unwrap_prev_frame_num = (h->frame_num - h->sps.ref_frame_count) - 1; if (unwrap_prev_frame_num < 0) unwrap_prev_frame_num += max_frame_num; h->prev_frame_num = unwrap_prev_frame_num; } } if (h->first_field) { assert(h->cur_pic_ptr); assert(h->cur_pic_ptr->f.buf[0]); assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF); if (h->cur_pic_ptr->tf.owner == h->avctx) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_BOTTOM_FIELD); } if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) { if (last_pic_structure != PICT_FRAME) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_TOP_FIELD); } } else { if (h->cur_pic_ptr->frame_num != h->frame_num) { if (last_pic_structure != PICT_FRAME) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_TOP_FIELD); } } else { if (!((last_pic_structure == PICT_TOP_FIELD && h->picture_structure == PICT_BOTTOM_FIELD) || (last_pic_structure == PICT_BOTTOM_FIELD && h->picture_structure == PICT_TOP_FIELD))) { av_log(h->avctx, AV_LOG_ERROR, "Invalid field mode combination %d/%d\n", last_pic_structure, h->picture_structure); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_INVALIDDATA; } else if (last_pic_droppable != h->droppable) { avpriv_request_sample(h->avctx, "Found reference and non-reference fields in the same frame, which"); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_PATCHWELCOME; } } } } while (h->frame_num != h->prev_frame_num && !h->first_field && h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) { H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); if (!h->sps.gaps_in_frame_num_allowed_flag) for(i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; ret = h264_frame_start(h); if (ret < 0) { h->first_field = 0; return ret; } h->prev_frame_num++; h->prev_frame_num %= 1 << h->sps.log2_max_frame_num; h->cur_pic_ptr->frame_num = h->prev_frame_num; h->cur_pic_ptr->invalid_gap = !h->sps.gaps_in_frame_num_allowed_flag; ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); ret = ff_generate_sliding_window_mmcos(h, 1); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; ret = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; if (h->short_ref_count) { if (prev) { av_image_copy(h->short_ref[0]->f.data, h->short_ref[0]->f.linesize, (const uint8_t **)prev->f.data, prev->f.linesize, h->avctx->pix_fmt, h->mb_width * 16, h->mb_height * 16); h->short_ref[0]->poc = prev->poc + 2; } h->short_ref[0]->frame_num = h->prev_frame_num; } } if (h->first_field) { assert(h->cur_pic_ptr); assert(h->cur_pic_ptr->f.buf[0]); assert(h->cur_pic_ptr->reference != DELAYED_PIC_REF); if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) { h->missing_fields ++; h->cur_pic_ptr = NULL; h->first_field = FIELD_PICTURE(h); } else { h->missing_fields = 0; if (h->cur_pic_ptr->frame_num != h->frame_num) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure==PICT_BOTTOM_FIELD); h->first_field = 1; h->cur_pic_ptr = NULL; } else { h->first_field = 0; } } } else { h->first_field = FIELD_PICTURE(h); } if (!FIELD_PICTURE(h) || h->first_field) { if (h264_frame_start(h) < 0) { h->first_field = 0; return AVERROR_INVALIDDATA; } } else { release_unused_pictures(h, 0); } if (FIELD_PICTURE(h)) { for(i = (h->picture_structure == PICT_BOTTOM_FIELD); i<h->mb_height; i++) memset(h->slice_table + i*h->mb_stride, -1, (h->mb_stride - (i+1==h->mb_height)) * sizeof(*h->slice_table)); } else { memset(h->slice_table, -1, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); } h->last_slice_type = -1; } h->cur_pic_ptr->frame_num = h->frame_num; av_assert1(h->mb_num == h->mb_width * h->mb_height); if (first_mb_in_slice << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num || first_mb_in_slice >= h->mb_num) { av_log(h->avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); return AVERROR_INVALIDDATA; } sl->resync_mb_x = sl->mb_x = first_mb_in_slice % h->mb_width; sl->resync_mb_y = sl->mb_y = (first_mb_in_slice / h->mb_width) << FIELD_OR_MBAFF_PICTURE(h); if (h->picture_structure == PICT_BOTTOM_FIELD) sl->resync_mb_y = sl->mb_y = sl->mb_y + 1; av_assert1(sl->mb_y < h->mb_height); if (h->picture_structure == PICT_FRAME) { h->curr_pic_num = h->frame_num; h->max_pic_num = 1 << h->sps.log2_max_frame_num; } else { h->curr_pic_num = 2 * h->frame_num + 1; h->max_pic_num = 1 << (h->sps.log2_max_frame_num + 1); } if (h->nal_unit_type == NAL_IDR_SLICE) get_ue_golomb(&sl->gb); if (h->sps.poc_type == 0) { h->poc_lsb = get_bits(&sl->gb, h->sps.log2_max_poc_lsb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc_bottom = get_se_golomb(&sl->gb); } if (h->sps.poc_type == 1 && !h->sps.delta_pic_order_always_zero_flag) { h->delta_poc[0] = get_se_golomb(&sl->gb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc[1] = get_se_golomb(&sl->gb); } ff_init_poc(h, h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc); if (h->pps.redundant_pic_cnt_present) sl->redundant_pic_count = get_ue_golomb(&sl->gb); ret = ff_set_ref_count(h, sl); if (ret < 0) return ret; if (slice_type != AV_PICTURE_TYPE_I && (h->current_slice == 0 || slice_type != h->last_slice_type || memcmp(h->last_ref_count, sl->ref_count, sizeof(sl->ref_count)))) { ff_h264_fill_default_ref_list(h, sl); } if (sl->slice_type_nos != AV_PICTURE_TYPE_I) { ret = ff_h264_decode_ref_pic_list_reordering(h, sl); if (ret < 0) { sl->ref_count[1] = sl->ref_count[0] = 0; return ret; } } if ((h->pps.weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) ff_pred_weight_table(h, sl); else if (h->pps.weighted_bipred_idc == 2 && sl->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, sl, -1); } else { sl->use_weight = 0; for (i = 0; i < 2; i++) { sl->luma_weight_flag[i] = 0; sl->chroma_weight_flag[i] = 0; } } if (h->nal_ref_idc) { ret = ff_h264_decode_ref_pic_marking(h, &sl->gb, !(h->avctx->active_thread_type & FF_THREAD_FRAME) || h->current_slice == 0); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (FRAME_MBAFF(h)) { ff_h264_fill_mbaff_ref_list(h, sl); if (h->pps.weighted_bipred_idc == 2 && sl->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, sl, 0); implicit_weight_table(h, sl, 1); } } if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred) ff_h264_direct_dist_scale_factor(h, sl); ff_h264_direct_ref_list_init(h, sl); if (sl->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", tmp); return AVERROR_INVALIDDATA; } sl->cabac_init_idc = tmp; } sl->last_qscale_diff = 0; tmp = h->pps.init_qp + get_se_golomb(&sl->gb); if (tmp > 51 + 6 * (h->sps.bit_depth_luma - 8)) { av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->qscale = tmp; sl->chroma_qp[0] = get_chroma_qp(h, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale); if (sl->slice_type == AV_PICTURE_TYPE_SP) get_bits1(&sl->gb); if (sl->slice_type == AV_PICTURE_TYPE_SP || sl->slice_type == AV_PICTURE_TYPE_SI) get_se_golomb(&sl->gb); sl->deblocking_filter = 1; sl->slice_alpha_c0_offset = 0; sl->slice_beta_offset = 0; if (h->pps.deblocking_filter_parameters_present) { tmp = get_ue_golomb_31(&sl->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); return AVERROR_INVALIDDATA; } sl->deblocking_filter = tmp; if (sl->deblocking_filter < 2) sl->deblocking_filter ^= 1; if (sl->deblocking_filter) { sl->slice_alpha_c0_offset = get_se_golomb(&sl->gb) * 2; sl->slice_beta_offset = get_se_golomb(&sl->gb) * 2; if (sl->slice_alpha_c0_offset > 12 || sl->slice_alpha_c0_offset < -12 || sl->slice_beta_offset > 12 || sl->slice_beta_offset < -12) { av_log(h->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", sl->slice_alpha_c0_offset, sl->slice_beta_offset); return AVERROR_INVALIDDATA; } } } if (h->avctx->skip_loop_filter >= AVDISCARD_ALL || (h->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || (h->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_loop_filter >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) sl->deblocking_filter = 0; if (sl->deblocking_filter == 1 && h->max_contexts > 1) { if (h->avctx->flags2 & CODEC_FLAG2_FAST) { sl->deblocking_filter = 2; } else { h->max_contexts = 1; if (!h->single_decode_warning) { av_log(h->avctx, AV_LOG_INFO, "Cannot parallelize slice decoding with deblocking filter type 1, decoding such frames in sequential order\n" "To parallelize slice decoding you need video encoded with disable_deblocking_filter_idc set to 2 (deblock only edges that do not cross slices).\n" "Setting the flags2 libavcodec option to +fast (-flags2 +fast) will disable deblocking across slices and enable parallel slice decoding " "but will generate non-standard-compliant output.\n"); h->single_decode_warning = 1; } if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, "Deblocking switched inside frame.\n"); return SLICE_SINGLETHREAD; } } } sl->qp_thresh = 15 - FFMIN(sl->slice_alpha_c0_offset, sl->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]) + 6 * (h->sps.bit_depth_luma - 8); h->last_slice_type = slice_type; memcpy(h->last_ref_count, sl->ref_count, sizeof(h->last_ref_count)); sl->slice_num = ++h->current_slice; if (sl->slice_num) h->slice_row[(sl->slice_num-1)&(MAX_SLICES-1)]= sl->resync_mb_y; if ( h->slice_row[sl->slice_num&(MAX_SLICES-1)] + 3 >= sl->resync_mb_y && h->slice_row[sl->slice_num&(MAX_SLICES-1)] <= sl->resync_mb_y && sl->slice_num >= MAX_SLICES) { av_log(h->avctx, AV_LOG_WARNING, "Possibly too many slices (%d >= %d), increase MAX_SLICES and recompile if there are artifacts\n", sl->slice_num, MAX_SLICES); } for (j = 0; j < 2; j++) { int id_list[16]; int *ref2frm = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][j]; for (i = 0; i < 16; i++) { id_list[i] = 60; if (j < sl->list_count && i < sl->ref_count[j] && sl->ref_list[j][i].parent->f.buf[0]) { int k; AVBuffer *buf = sl->ref_list[j][i].parent->f.buf[0]->buffer; for (k = 0; k < h->short_ref_count; k++) if (h->short_ref[k]->f.buf[0]->buffer == buf) { id_list[i] = k; break; } for (k = 0; k < h->long_ref_count; k++) if (h->long_ref[k] && h->long_ref[k]->f.buf[0]->buffer == buf) { id_list[i] = h->short_ref_count + k; break; } } } ref2frm[0] = ref2frm[1] = -1; for (i = 0; i < 16; i++) ref2frm[i + 2] = 4 * id_list[i] + (sl->ref_list[j][i].reference & 3); ref2frm[18 + 0] = ref2frm[18 + 1] = -1; for (i = 16; i < 48; i++) ref2frm[i + 4] = 4 * id_list[(i - 16) >> 1] + (sl->ref_list[j][i].reference & 3); } h->au_pps_id = pps_id; h->sps.new = h->sps_buffers[h->pps.sps_id]->new = 0; h->current_sps_id = h->pps.sps_id; if (h->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(h->avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n", sl->slice_num, (h->picture_structure == PICT_FRAME ? "F" : h->picture_structure == PICT_TOP_FIELD ? "T" : "B"), first_mb_in_slice, av_get_picture_type_char(sl->slice_type), sl->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "", pps_id, h->frame_num, h->cur_pic_ptr->field_poc[0], h->cur_pic_ptr->field_poc[1], sl->ref_count[0], sl->ref_count[1], sl->qscale, sl->deblocking_filter, sl->slice_alpha_c0_offset, sl->slice_beta_offset, sl->use_weight, sl->use_weight == 1 && sl->use_weight_chroma ? "c" : "", sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""); } return 0; }
{ "code": [ " h->mb_aff_frame = 0;", " h->mb_aff_frame = h->sps.mb_aff;", " last_pic_droppable != droppable) {" ], "line_no": [ 495, 531, 541 ] }
int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1) { unsigned int VAR_2; unsigned int VAR_3; int VAR_4; unsigned int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9, VAR_10; int VAR_11; int VAR_12 = 0; int VAR_13, VAR_14; int VAR_15 = VAR_1 == VAR_0->slice_ctx && !VAR_0->current_slice; int VAR_16, VAR_17, VAR_18; PPS *pps; VAR_0->qpel_put = VAR_0->h264qpel.put_h264_qpel_pixels_tab; VAR_0->qpel_avg = VAR_0->h264qpel.avg_h264_qpel_pixels_tab; VAR_2 = get_ue_golomb_long(&VAR_1->gb); if (VAR_2 == 0) { if (VAR_0->current_slice) { if (VAR_0->cur_pic_ptr && FIELD_PICTURE(VAR_0) && VAR_0->first_field) { ff_h264_field_end(VAR_0, VAR_1, 1); VAR_0->current_slice = 0; } else if (VAR_0->cur_pic_ptr && !FIELD_PICTURE(VAR_0) && !VAR_0->first_field && VAR_0->nal_unit_type == NAL_IDR_SLICE) { av_log(VAR_0, AV_LOG_WARNING, "Broken frame packetizing\n"); ff_h264_field_end(VAR_0, VAR_1, 1); VAR_0->current_slice = 0; ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, 1); VAR_0->cur_pic_ptr = NULL; } else return AVERROR_INVALIDDATA; } if (!VAR_0->first_field) { if (VAR_0->cur_pic_ptr && !VAR_0->VAR_18) { ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, VAR_0->VAR_17 == PICT_BOTTOM_FIELD); } VAR_0->cur_pic_ptr = NULL; } } VAR_5 = get_ue_golomb_31(&VAR_1->gb); if (VAR_5 > 9) { av_log(VAR_0->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", VAR_5, VAR_2); return AVERROR_INVALIDDATA; } if (VAR_5 > 4) { VAR_5 -= 5; VAR_1->slice_type_fixed = 1; } else VAR_1->slice_type_fixed = 0; VAR_5 = golomb_to_pict_type[VAR_5]; VAR_1->VAR_5 = VAR_5; VAR_1->slice_type_nos = VAR_5 & 3; if (VAR_0->nal_unit_type == NAL_IDR_SLICE && VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(VAR_0->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } if ( (VAR_0->avctx->skip_frame >= AVDISCARD_NONREF && !VAR_0->nal_ref_idc) || (VAR_0->avctx->skip_frame >= AVDISCARD_BIDIR && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B) || (VAR_0->avctx->skip_frame >= AVDISCARD_NONINTRA && VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) || (VAR_0->avctx->skip_frame >= AVDISCARD_NONKEY && VAR_0->nal_unit_type != NAL_IDR_SLICE) || VAR_0->avctx->skip_frame >= AVDISCARD_ALL) { return SLICE_SKIPED; } VAR_0->pict_type = VAR_1->VAR_5; VAR_3 = get_ue_golomb(&VAR_1->gb); if (VAR_3 >= MAX_PPS_COUNT) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_3 %u out of range\n", VAR_3); return AVERROR_INVALIDDATA; } if (!VAR_0->pps_buffers[VAR_3]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", VAR_3); return AVERROR_INVALIDDATA; } if (VAR_0->au_pps_id >= 0 && VAR_3 != VAR_0->au_pps_id) { av_log(VAR_0->avctx, AV_LOG_ERROR, "PPS change from %d to %d forbidden\n", VAR_0->au_pps_id, VAR_3); return AVERROR_INVALIDDATA; } pps = VAR_0->pps_buffers[VAR_3]; if (!VAR_0->sps_buffers[pps->sps_id]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", VAR_0->pps.sps_id); return AVERROR_INVALIDDATA; } if (VAR_15) VAR_0->pps = *VAR_0->pps_buffers[VAR_3]; if (pps->sps_id != VAR_0->sps.sps_id || pps->sps_id != VAR_0->current_sps_id || VAR_0->sps_buffers[pps->sps_id]->new) { if (!VAR_15) { av_log(VAR_0->avctx, AV_LOG_ERROR, "SPS changed in the middle of the frame\n"); return AVERROR_INVALIDDATA; } VAR_0->sps = *VAR_0->sps_buffers[VAR_0->pps.sps_id]; if (VAR_0->mb_width != VAR_0->sps.mb_width || VAR_0->mb_height != VAR_0->sps.mb_height * (2 - VAR_0->sps.frame_mbs_only_flag) || VAR_0->cur_bit_depth_luma != VAR_0->sps.bit_depth_luma || VAR_0->cur_chroma_format_idc != VAR_0->sps.chroma_format_idc ) VAR_12 = 1; if (VAR_0->bit_depth_luma != VAR_0->sps.bit_depth_luma || VAR_0->chroma_format_idc != VAR_0->sps.chroma_format_idc) { VAR_0->bit_depth_luma = VAR_0->sps.bit_depth_luma; VAR_0->chroma_format_idc = VAR_0->sps.chroma_format_idc; VAR_12 = 1; } if ((VAR_4 = ff_h264_set_parameter_from_sps(VAR_0)) < 0) return VAR_4; } VAR_0->avctx->profile = ff_h264_get_profile(&VAR_0->sps); VAR_0->avctx->level = VAR_0->sps.level_idc; VAR_0->avctx->refs = VAR_0->sps.ref_frame_count; VAR_11 = (VAR_0->context_initialized && ( 16*VAR_0->sps.mb_width != VAR_0->avctx->coded_width || 16*VAR_0->sps.mb_height * (2 - VAR_0->sps.frame_mbs_only_flag) != VAR_0->avctx->coded_height || VAR_0->cur_bit_depth_luma != VAR_0->sps.bit_depth_luma || VAR_0->cur_chroma_format_idc != VAR_0->sps.chroma_format_idc || VAR_0->mb_width != VAR_0->sps.mb_width || VAR_0->mb_height != VAR_0->sps.mb_height * (2 - VAR_0->sps.frame_mbs_only_flag) )); if (VAR_0->avctx->pix_fmt == AV_PIX_FMT_NONE || (non_j_pixfmt(VAR_0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(VAR_0, 0)))) VAR_11 = 1; if (VAR_15 && av_cmp_q(VAR_0->sps.sar, VAR_0->avctx->sample_aspect_ratio)) VAR_11 = 1; VAR_0->mb_width = VAR_0->sps.mb_width; VAR_0->mb_height = VAR_0->sps.mb_height * (2 - VAR_0->sps.frame_mbs_only_flag); VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height; VAR_0->mb_stride = VAR_0->mb_width + 1; VAR_0->b_stride = VAR_0->mb_width * 4; VAR_0->chroma_y_shift = VAR_0->sps.chroma_format_idc <= 1; VAR_0->width = 16 * VAR_0->mb_width; VAR_0->height = 16 * VAR_0->mb_height; VAR_4 = init_dimensions(VAR_0); if (VAR_4 < 0) return VAR_4; if (VAR_0->sps.video_signal_type_present_flag) { VAR_0->avctx->color_range = VAR_0->sps.full_range>0 ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; if (VAR_0->sps.colour_description_present_flag) { if (VAR_0->avctx->colorspace != VAR_0->sps.colorspace) VAR_12 = 1; VAR_0->avctx->color_primaries = VAR_0->sps.color_primaries; VAR_0->avctx->color_trc = VAR_0->sps.color_trc; VAR_0->avctx->colorspace = VAR_0->sps.colorspace; } } if (VAR_0->context_initialized && (VAR_11 || VAR_12)) { if (VAR_1 != VAR_0->slice_ctx) { av_log(VAR_0->avctx, AV_LOG_ERROR, "changing width %d -> %d / height %d -> %d on " "slice %d\n", VAR_0->width, VAR_0->avctx->coded_width, VAR_0->height, VAR_0->avctx->coded_height, VAR_0->current_slice + 1); return AVERROR_INVALIDDATA; } av_assert1(VAR_15); ff_h264_flush_change(VAR_0); if ((VAR_4 = get_pixel_format(VAR_0, 1)) < 0) return VAR_4; VAR_0->avctx->pix_fmt = VAR_4; av_log(VAR_0->avctx, AV_LOG_INFO, "Reinit context to %dx%d, " "pix_fmt: %s\n", VAR_0->width, VAR_0->height, av_get_pix_fmt_name(VAR_0->avctx->pix_fmt)); if ((VAR_4 = h264_slice_header_init(VAR_0, 1)) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return VAR_4; } } if (!VAR_0->context_initialized) { if (VAR_1 != VAR_0->slice_ctx) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Cannot (re-)initialize context during parallel decoding.\n"); return AVERROR_PATCHWELCOME; } if ((VAR_4 = get_pixel_format(VAR_0, 1)) < 0) return VAR_4; VAR_0->avctx->pix_fmt = VAR_4; if ((VAR_4 = h264_slice_header_init(VAR_0, 0)) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return VAR_4; } } if (VAR_15 && VAR_0->dequant_coeff_pps != VAR_3) { VAR_0->dequant_coeff_pps = VAR_3; ff_h264_init_dequant_tables(VAR_0); } VAR_16 = get_bits(&VAR_1->gb, VAR_0->sps.log2_max_frame_num); if (!VAR_15) { if (VAR_0->VAR_16 != VAR_16) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n", VAR_0->VAR_16, VAR_16); return AVERROR_INVALIDDATA; } } VAR_1->mb_mbaff = 0; VAR_0->mb_aff_frame = 0; VAR_9 = VAR_0->VAR_17; VAR_10 = VAR_0->VAR_18; VAR_18 = VAR_0->nal_ref_idc == 0; if (VAR_0->sps.frame_mbs_only_flag) { VAR_17 = PICT_FRAME; } else { if (!VAR_0->sps.direct_8x8_inference_flag && VAR_5 == AV_PICTURE_TYPE_B) { av_log(VAR_0->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } VAR_13 = get_bits1(&VAR_1->gb); if (VAR_13) { VAR_14 = get_bits1(&VAR_1->gb); VAR_17 = PICT_TOP_FIELD + VAR_14; } else { VAR_17 = PICT_FRAME; VAR_0->mb_aff_frame = VAR_0->sps.mb_aff; } } if (VAR_0->current_slice) { if (VAR_9 != VAR_17 || VAR_10 != VAR_18) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", VAR_9, VAR_0->VAR_17); return AVERROR_INVALIDDATA; } else if (!VAR_0->cur_pic_ptr) { av_log(VAR_0->avctx, AV_LOG_ERROR, "unset cur_pic_ptr on slice %d\n", VAR_0->current_slice + 1); return AVERROR_INVALIDDATA; } } VAR_0->VAR_17 = VAR_17; VAR_0->VAR_18 = VAR_18; VAR_0->VAR_16 = VAR_16; VAR_1->mb_field_decoding_flag = VAR_17 != PICT_FRAME; if (VAR_0->current_slice == 0) { if (VAR_0->VAR_16 != VAR_0->prev_frame_num) { int VAR_19 = VAR_0->prev_frame_num; int VAR_20 = 1 << VAR_0->sps.log2_max_frame_num; if (VAR_19 > VAR_0->VAR_16) VAR_19 -= VAR_20; if ((VAR_0->VAR_16 - VAR_19) > VAR_0->sps.ref_frame_count) { VAR_19 = (VAR_0->VAR_16 - VAR_0->sps.ref_frame_count) - 1; if (VAR_19 < 0) VAR_19 += VAR_20; VAR_0->prev_frame_num = VAR_19; } } if (VAR_0->first_field) { assert(VAR_0->cur_pic_ptr); assert(VAR_0->cur_pic_ptr->f.buf[0]); assert(VAR_0->cur_pic_ptr->reference != DELAYED_PIC_REF); if (VAR_0->cur_pic_ptr->tf.owner == VAR_0->avctx) { ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, VAR_9 == PICT_BOTTOM_FIELD); } if (!FIELD_PICTURE(VAR_0) || VAR_0->VAR_17 == VAR_9) { if (VAR_9 != PICT_FRAME) { ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, VAR_9 == PICT_TOP_FIELD); } } else { if (VAR_0->cur_pic_ptr->VAR_16 != VAR_0->VAR_16) { if (VAR_9 != PICT_FRAME) { ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, VAR_9 == PICT_TOP_FIELD); } } else { if (!((VAR_9 == PICT_TOP_FIELD && VAR_0->VAR_17 == PICT_BOTTOM_FIELD) || (VAR_9 == PICT_BOTTOM_FIELD && VAR_0->VAR_17 == PICT_TOP_FIELD))) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid field mode combination %d/%d\n", VAR_9, VAR_0->VAR_17); VAR_0->VAR_17 = VAR_9; VAR_0->VAR_18 = VAR_10; return AVERROR_INVALIDDATA; } else if (VAR_10 != VAR_0->VAR_18) { avpriv_request_sample(VAR_0->avctx, "Found reference and non-reference fields in the same frame, which"); VAR_0->VAR_17 = VAR_9; VAR_0->VAR_18 = VAR_10; return AVERROR_PATCHWELCOME; } } } } while (VAR_0->VAR_16 != VAR_0->prev_frame_num && !VAR_0->first_field && VAR_0->VAR_16 != (VAR_0->prev_frame_num + 1) % (1 << VAR_0->sps.log2_max_frame_num)) { H264Picture *prev = VAR_0->short_ref_count ? VAR_0->short_ref[0] : NULL; av_log(VAR_0->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", VAR_0->VAR_16, VAR_0->prev_frame_num); if (!VAR_0->sps.gaps_in_frame_num_allowed_flag) for(VAR_7=0; VAR_7<FF_ARRAY_ELEMS(VAR_0->last_pocs); VAR_7++) VAR_0->last_pocs[VAR_7] = INT_MIN; VAR_4 = h264_frame_start(VAR_0); if (VAR_4 < 0) { VAR_0->first_field = 0; return VAR_4; } VAR_0->prev_frame_num++; VAR_0->prev_frame_num %= 1 << VAR_0->sps.log2_max_frame_num; VAR_0->cur_pic_ptr->VAR_16 = VAR_0->prev_frame_num; VAR_0->cur_pic_ptr->invalid_gap = !VAR_0->sps.gaps_in_frame_num_allowed_flag; ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, 1); VAR_4 = ff_generate_sliding_window_mmcos(VAR_0, 1); if (VAR_4 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) return VAR_4; VAR_4 = ff_h264_execute_ref_pic_marking(VAR_0, VAR_0->mmco, VAR_0->mmco_index); if (VAR_4 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) return VAR_4; if (VAR_0->short_ref_count) { if (prev) { av_image_copy(VAR_0->short_ref[0]->f.data, VAR_0->short_ref[0]->f.linesize, (const uint8_t **)prev->f.data, prev->f.linesize, VAR_0->avctx->pix_fmt, VAR_0->mb_width * 16, VAR_0->mb_height * 16); VAR_0->short_ref[0]->poc = prev->poc + 2; } VAR_0->short_ref[0]->VAR_16 = VAR_0->prev_frame_num; } } if (VAR_0->first_field) { assert(VAR_0->cur_pic_ptr); assert(VAR_0->cur_pic_ptr->f.buf[0]); assert(VAR_0->cur_pic_ptr->reference != DELAYED_PIC_REF); if (!FIELD_PICTURE(VAR_0) || VAR_0->VAR_17 == VAR_9) { VAR_0->missing_fields ++; VAR_0->cur_pic_ptr = NULL; VAR_0->first_field = FIELD_PICTURE(VAR_0); } else { VAR_0->missing_fields = 0; if (VAR_0->cur_pic_ptr->VAR_16 != VAR_0->VAR_16) { ff_thread_report_progress(&VAR_0->cur_pic_ptr->tf, INT_MAX, VAR_0->VAR_17==PICT_BOTTOM_FIELD); VAR_0->first_field = 1; VAR_0->cur_pic_ptr = NULL; } else { VAR_0->first_field = 0; } } } else { VAR_0->first_field = FIELD_PICTURE(VAR_0); } if (!FIELD_PICTURE(VAR_0) || VAR_0->first_field) { if (h264_frame_start(VAR_0) < 0) { VAR_0->first_field = 0; return AVERROR_INVALIDDATA; } } else { release_unused_pictures(VAR_0, 0); } if (FIELD_PICTURE(VAR_0)) { for(VAR_7 = (VAR_0->VAR_17 == PICT_BOTTOM_FIELD); VAR_7<VAR_0->mb_height; VAR_7++) memset(VAR_0->slice_table + VAR_7*VAR_0->mb_stride, -1, (VAR_0->mb_stride - (VAR_7+1==VAR_0->mb_height)) * sizeof(*VAR_0->slice_table)); } else { memset(VAR_0->slice_table, -1, (VAR_0->mb_height * VAR_0->mb_stride - 1) * sizeof(*VAR_0->slice_table)); } VAR_0->last_slice_type = -1; } VAR_0->cur_pic_ptr->VAR_16 = VAR_0->VAR_16; av_assert1(VAR_0->mb_num == VAR_0->mb_width * VAR_0->mb_height); if (VAR_2 << FIELD_OR_MBAFF_PICTURE(VAR_0) >= VAR_0->mb_num || VAR_2 >= VAR_0->mb_num) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_2 overflow\n"); return AVERROR_INVALIDDATA; } VAR_1->resync_mb_x = VAR_1->mb_x = VAR_2 % VAR_0->mb_width; VAR_1->resync_mb_y = VAR_1->mb_y = (VAR_2 / VAR_0->mb_width) << FIELD_OR_MBAFF_PICTURE(VAR_0); if (VAR_0->VAR_17 == PICT_BOTTOM_FIELD) VAR_1->resync_mb_y = VAR_1->mb_y = VAR_1->mb_y + 1; av_assert1(VAR_1->mb_y < VAR_0->mb_height); if (VAR_0->VAR_17 == PICT_FRAME) { VAR_0->curr_pic_num = VAR_0->VAR_16; VAR_0->max_pic_num = 1 << VAR_0->sps.log2_max_frame_num; } else { VAR_0->curr_pic_num = 2 * VAR_0->VAR_16 + 1; VAR_0->max_pic_num = 1 << (VAR_0->sps.log2_max_frame_num + 1); } if (VAR_0->nal_unit_type == NAL_IDR_SLICE) get_ue_golomb(&VAR_1->gb); if (VAR_0->sps.poc_type == 0) { VAR_0->poc_lsb = get_bits(&VAR_1->gb, VAR_0->sps.log2_max_poc_lsb); if (VAR_0->pps.pic_order_present == 1 && VAR_0->VAR_17 == PICT_FRAME) VAR_0->delta_poc_bottom = get_se_golomb(&VAR_1->gb); } if (VAR_0->sps.poc_type == 1 && !VAR_0->sps.delta_pic_order_always_zero_flag) { VAR_0->delta_poc[0] = get_se_golomb(&VAR_1->gb); if (VAR_0->pps.pic_order_present == 1 && VAR_0->VAR_17 == PICT_FRAME) VAR_0->delta_poc[1] = get_se_golomb(&VAR_1->gb); } ff_init_poc(VAR_0, VAR_0->cur_pic_ptr->field_poc, &VAR_0->cur_pic_ptr->poc); if (VAR_0->pps.redundant_pic_cnt_present) VAR_1->redundant_pic_count = get_ue_golomb(&VAR_1->gb); VAR_4 = ff_set_ref_count(VAR_0, VAR_1); if (VAR_4 < 0) return VAR_4; if (VAR_5 != AV_PICTURE_TYPE_I && (VAR_0->current_slice == 0 || VAR_5 != VAR_0->last_slice_type || memcmp(VAR_0->last_ref_count, VAR_1->ref_count, sizeof(VAR_1->ref_count)))) { ff_h264_fill_default_ref_list(VAR_0, VAR_1); } if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) { VAR_4 = ff_h264_decode_ref_pic_list_reordering(VAR_0, VAR_1); if (VAR_4 < 0) { VAR_1->ref_count[1] = VAR_1->ref_count[0] = 0; return VAR_4; } } if ((VAR_0->pps.weighted_pred && VAR_1->slice_type_nos == AV_PICTURE_TYPE_P) || (VAR_0->pps.weighted_bipred_idc == 1 && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B)) ff_pred_weight_table(VAR_0, VAR_1); else if (VAR_0->pps.weighted_bipred_idc == 2 && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(VAR_0, VAR_1, -1); } else { VAR_1->use_weight = 0; for (VAR_7 = 0; VAR_7 < 2; VAR_7++) { VAR_1->luma_weight_flag[VAR_7] = 0; VAR_1->chroma_weight_flag[VAR_7] = 0; } } if (VAR_0->nal_ref_idc) { VAR_4 = ff_h264_decode_ref_pic_marking(VAR_0, &VAR_1->gb, !(VAR_0->avctx->active_thread_type & FF_THREAD_FRAME) || VAR_0->current_slice == 0); if (VAR_4 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (FRAME_MBAFF(VAR_0)) { ff_h264_fill_mbaff_ref_list(VAR_0, VAR_1); if (VAR_0->pps.weighted_bipred_idc == 2 && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(VAR_0, VAR_1, 0); implicit_weight_table(VAR_0, VAR_1, 1); } } if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_B && !VAR_1->direct_spatial_mv_pred) ff_h264_direct_dist_scale_factor(VAR_0, VAR_1); ff_h264_direct_ref_list_init(VAR_0, VAR_1); if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I && VAR_0->pps.cabac) { VAR_6 = get_ue_golomb_31(&VAR_1->gb); if (VAR_6 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", VAR_6); return AVERROR_INVALIDDATA; } VAR_1->cabac_init_idc = VAR_6; } VAR_1->last_qscale_diff = 0; VAR_6 = VAR_0->pps.init_qp + get_se_golomb(&VAR_1->gb); if (VAR_6 > 51 + 6 * (VAR_0->sps.bit_depth_luma - 8)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "QP %u out of range\n", VAR_6); return AVERROR_INVALIDDATA; } VAR_1->qscale = VAR_6; VAR_1->chroma_qp[0] = get_chroma_qp(VAR_0, 0, VAR_1->qscale); VAR_1->chroma_qp[1] = get_chroma_qp(VAR_0, 1, VAR_1->qscale); if (VAR_1->VAR_5 == AV_PICTURE_TYPE_SP) get_bits1(&VAR_1->gb); if (VAR_1->VAR_5 == AV_PICTURE_TYPE_SP || VAR_1->VAR_5 == AV_PICTURE_TYPE_SI) get_se_golomb(&VAR_1->gb); VAR_1->deblocking_filter = 1; VAR_1->slice_alpha_c0_offset = 0; VAR_1->slice_beta_offset = 0; if (VAR_0->pps.deblocking_filter_parameters_present) { VAR_6 = get_ue_golomb_31(&VAR_1->gb); if (VAR_6 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", VAR_6); return AVERROR_INVALIDDATA; } VAR_1->deblocking_filter = VAR_6; if (VAR_1->deblocking_filter < 2) VAR_1->deblocking_filter ^= 1; if (VAR_1->deblocking_filter) { VAR_1->slice_alpha_c0_offset = get_se_golomb(&VAR_1->gb) * 2; VAR_1->slice_beta_offset = get_se_golomb(&VAR_1->gb) * 2; if (VAR_1->slice_alpha_c0_offset > 12 || VAR_1->slice_alpha_c0_offset < -12 || VAR_1->slice_beta_offset > 12 || VAR_1->slice_beta_offset < -12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", VAR_1->slice_alpha_c0_offset, VAR_1->slice_beta_offset); return AVERROR_INVALIDDATA; } } } if (VAR_0->avctx->skip_loop_filter >= AVDISCARD_ALL || (VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONKEY && VAR_0->nal_unit_type != NAL_IDR_SLICE) || (VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) || (VAR_0->avctx->skip_loop_filter >= AVDISCARD_BIDIR && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B) || (VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONREF && VAR_0->nal_ref_idc == 0)) VAR_1->deblocking_filter = 0; if (VAR_1->deblocking_filter == 1 && VAR_0->max_contexts > 1) { if (VAR_0->avctx->flags2 & CODEC_FLAG2_FAST) { VAR_1->deblocking_filter = 2; } else { VAR_0->max_contexts = 1; if (!VAR_0->single_decode_warning) { av_log(VAR_0->avctx, AV_LOG_INFO, "Cannot parallelize slice decoding with deblocking filter type 1, decoding such frames in sequential order\n" "To parallelize slice decoding you need video encoded with disable_deblocking_filter_idc set to 2 (deblock only edges that do not cross slices).\n" "Setting the flags2 libavcodec option to +fast (-flags2 +fast) will disable deblocking across slices and enable parallel slice decoding " "but will generate non-standard-compliant output.\n"); VAR_0->single_decode_warning = 1; } if (VAR_1 != VAR_0->slice_ctx) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Deblocking switched inside frame.\n"); return SLICE_SINGLETHREAD; } } } VAR_1->qp_thresh = 15 - FFMIN(VAR_1->slice_alpha_c0_offset, VAR_1->slice_beta_offset) - FFMAX3(0, VAR_0->pps.chroma_qp_index_offset[0], VAR_0->pps.chroma_qp_index_offset[1]) + 6 * (VAR_0->sps.bit_depth_luma - 8); VAR_0->last_slice_type = VAR_5; memcpy(VAR_0->last_ref_count, VAR_1->ref_count, sizeof(VAR_0->last_ref_count)); VAR_1->slice_num = ++VAR_0->current_slice; if (VAR_1->slice_num) VAR_0->slice_row[(VAR_1->slice_num-1)&(MAX_SLICES-1)]= VAR_1->resync_mb_y; if ( VAR_0->slice_row[VAR_1->slice_num&(MAX_SLICES-1)] + 3 >= VAR_1->resync_mb_y && VAR_0->slice_row[VAR_1->slice_num&(MAX_SLICES-1)] <= VAR_1->resync_mb_y && VAR_1->slice_num >= MAX_SLICES) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Possibly too many slices (%d >= %d), increase MAX_SLICES and recompile if there are artifacts\n", VAR_1->slice_num, MAX_SLICES); } for (VAR_8 = 0; VAR_8 < 2; VAR_8++) { int VAR_21[16]; int *VAR_22 = VAR_1->VAR_22[VAR_1->slice_num & (MAX_SLICES - 1)][VAR_8]; for (VAR_7 = 0; VAR_7 < 16; VAR_7++) { VAR_21[VAR_7] = 60; if (VAR_8 < VAR_1->list_count && VAR_7 < VAR_1->ref_count[VAR_8] && VAR_1->ref_list[VAR_8][VAR_7].parent->f.buf[0]) { int VAR_23; AVBuffer *buf = VAR_1->ref_list[VAR_8][VAR_7].parent->f.buf[0]->buffer; for (VAR_23 = 0; VAR_23 < VAR_0->short_ref_count; VAR_23++) if (VAR_0->short_ref[VAR_23]->f.buf[0]->buffer == buf) { VAR_21[VAR_7] = VAR_23; break; } for (VAR_23 = 0; VAR_23 < VAR_0->long_ref_count; VAR_23++) if (VAR_0->long_ref[VAR_23] && VAR_0->long_ref[VAR_23]->f.buf[0]->buffer == buf) { VAR_21[VAR_7] = VAR_0->short_ref_count + VAR_23; break; } } } VAR_22[0] = VAR_22[1] = -1; for (VAR_7 = 0; VAR_7 < 16; VAR_7++) VAR_22[VAR_7 + 2] = 4 * VAR_21[VAR_7] + (VAR_1->ref_list[VAR_8][VAR_7].reference & 3); VAR_22[18 + 0] = VAR_22[18 + 1] = -1; for (VAR_7 = 16; VAR_7 < 48; VAR_7++) VAR_22[VAR_7 + 4] = 4 * VAR_21[(VAR_7 - 16) >> 1] + (VAR_1->ref_list[VAR_8][VAR_7].reference & 3); } VAR_0->au_pps_id = VAR_3; VAR_0->sps.new = VAR_0->sps_buffers[VAR_0->pps.sps_id]->new = 0; VAR_0->current_sps_id = VAR_0->pps.sps_id; if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n", VAR_1->slice_num, (VAR_0->VAR_17 == PICT_FRAME ? "F" : VAR_0->VAR_17 == PICT_TOP_FIELD ? "T" : "B"), VAR_2, av_get_picture_type_char(VAR_1->VAR_5), VAR_1->slice_type_fixed ? " fix" : "", VAR_0->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "", VAR_3, VAR_0->VAR_16, VAR_0->cur_pic_ptr->field_poc[0], VAR_0->cur_pic_ptr->field_poc[1], VAR_1->ref_count[0], VAR_1->ref_count[1], VAR_1->qscale, VAR_1->deblocking_filter, VAR_1->slice_alpha_c0_offset, VAR_1->slice_beta_offset, VAR_1->use_weight, VAR_1->use_weight == 1 && VAR_1->use_weight_chroma ? "c" : "", VAR_1->VAR_5 == AV_PICTURE_TYPE_B ? (VAR_1->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""); } return 0; }
[ "int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1)\n{", "unsigned int VAR_2;", "unsigned int VAR_3;", "int VAR_4;", "unsigned int VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9, VAR_10;", "int VAR_11;", "int VAR_12 = 0;", "int VAR_13, VAR_14;", "int VAR_15 = VAR_1 == VAR_0->slice_ctx && !VAR_0->cu...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ...
26,304
static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last) { int t, t2; int sign, base, add, ret; WvChannel *c = &ctx->ch[channel]; *last = 0; if ((ctx->ch[0].median[0] < 2U) && (ctx->ch[1].median[0] < 2U) && !ctx->zero && !ctx->one) { if (ctx->zeroes) { ctx->zeroes--; if (ctx->zeroes) { c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; } else { t = get_unary_0_33(gb); if (t >= 2) { if (get_bits_left(gb) < t - 1) t = get_bits(gb, t - 1) | (1 << (t-1)); } else { if (get_bits_left(gb) < 0) ctx->zeroes = t; if (ctx->zeroes) { memset(ctx->ch[0].median, 0, sizeof(ctx->ch[0].median)); memset(ctx->ch[1].median, 0, sizeof(ctx->ch[1].median)); c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; if (ctx->zero) { t = 0; ctx->zero = 0; } else { t = get_unary_0_33(gb); if (get_bits_left(gb) < 0) if (t == 16) { t2 = get_unary_0_33(gb); if (t2 < 2) { if (get_bits_left(gb) < 0) t += t2; } else { if (get_bits_left(gb) < t2 - 1) t += get_bits(gb, t2 - 1) | (1 << (t2 - 1)); if (ctx->one) { ctx->one = t & 1; t = (t >> 1) + 1; } else { ctx->one = t & 1; t >>= 1; ctx->zero = !ctx->one; if (ctx->hybrid && !channel) update_error_limit(ctx); if (!t) { base = 0; add = GET_MED(0) - 1; DEC_MED(0); } else if (t == 1) { base = GET_MED(0); add = GET_MED(1) - 1; INC_MED(0); DEC_MED(1); } else if (t == 2) { base = GET_MED(0) + GET_MED(1); add = GET_MED(2) - 1; INC_MED(0); INC_MED(1); DEC_MED(2); } else { base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2); add = GET_MED(2) - 1; INC_MED(0); INC_MED(1); INC_MED(2); if (!c->error_limit) { ret = base + get_tail(gb, add); if (get_bits_left(gb) <= 0) } else { int mid = (base * 2 + add + 1) >> 1; while (add > c->error_limit) { if (get_bits_left(gb) <= 0) if (get_bits1(gb)) { add -= (mid - base); base = mid; } else add = mid - base - 1; mid = (base * 2 + add + 1) >> 1; ret = mid; sign = get_bits1(gb); if (ctx->hybrid_bitrate) c->slow_level += wp_log2(ret) - LEVEL_DECAY(c->slow_level); return sign ? ~ret : ret; error: *last = 1; return 0;
true
FFmpeg
c6831e2a70f734c71f483d69d46d0635963530c7
static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last) { int t, t2; int sign, base, add, ret; WvChannel *c = &ctx->ch[channel]; *last = 0; if ((ctx->ch[0].median[0] < 2U) && (ctx->ch[1].median[0] < 2U) && !ctx->zero && !ctx->one) { if (ctx->zeroes) { ctx->zeroes--; if (ctx->zeroes) { c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; } else { t = get_unary_0_33(gb); if (t >= 2) { if (get_bits_left(gb) < t - 1) t = get_bits(gb, t - 1) | (1 << (t-1)); } else { if (get_bits_left(gb) < 0) ctx->zeroes = t; if (ctx->zeroes) { memset(ctx->ch[0].median, 0, sizeof(ctx->ch[0].median)); memset(ctx->ch[1].median, 0, sizeof(ctx->ch[1].median)); c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; if (ctx->zero) { t = 0; ctx->zero = 0; } else { t = get_unary_0_33(gb); if (get_bits_left(gb) < 0) if (t == 16) { t2 = get_unary_0_33(gb); if (t2 < 2) { if (get_bits_left(gb) < 0) t += t2; } else { if (get_bits_left(gb) < t2 - 1) t += get_bits(gb, t2 - 1) | (1 << (t2 - 1)); if (ctx->one) { ctx->one = t & 1; t = (t >> 1) + 1; } else { ctx->one = t & 1; t >>= 1; ctx->zero = !ctx->one; if (ctx->hybrid && !channel) update_error_limit(ctx); if (!t) { base = 0; add = GET_MED(0) - 1; DEC_MED(0); } else if (t == 1) { base = GET_MED(0); add = GET_MED(1) - 1; INC_MED(0); DEC_MED(1); } else if (t == 2) { base = GET_MED(0) + GET_MED(1); add = GET_MED(2) - 1; INC_MED(0); INC_MED(1); DEC_MED(2); } else { base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2); add = GET_MED(2) - 1; INC_MED(0); INC_MED(1); INC_MED(2); if (!c->error_limit) { ret = base + get_tail(gb, add); if (get_bits_left(gb) <= 0) } else { int mid = (base * 2 + add + 1) >> 1; while (add > c->error_limit) { if (get_bits_left(gb) <= 0) if (get_bits1(gb)) { add -= (mid - base); base = mid; } else add = mid - base - 1; mid = (base * 2 + add + 1) >> 1; ret = mid; sign = get_bits1(gb); if (ctx->hybrid_bitrate) c->slow_level += wp_log2(ret) - LEVEL_DECAY(c->slow_level); return sign ? ~ret : ret; error: *last = 1; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1, int VAR_2, int *VAR_3) { int VAR_4, VAR_5; int VAR_6, VAR_7, VAR_8, VAR_9; WvChannel *c = &VAR_0->ch[VAR_2]; *VAR_3 = 0; if ((VAR_0->ch[0].median[0] < 2U) && (VAR_0->ch[1].median[0] < 2U) && !VAR_0->zero && !VAR_0->one) { if (VAR_0->zeroes) { VAR_0->zeroes--; if (VAR_0->zeroes) { c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; } else { VAR_4 = get_unary_0_33(VAR_1); if (VAR_4 >= 2) { if (get_bits_left(VAR_1) < VAR_4 - 1) VAR_4 = get_bits(VAR_1, VAR_4 - 1) | (1 << (VAR_4-1)); } else { if (get_bits_left(VAR_1) < 0) VAR_0->zeroes = VAR_4; if (VAR_0->zeroes) { memset(VAR_0->ch[0].median, 0, sizeof(VAR_0->ch[0].median)); memset(VAR_0->ch[1].median, 0, sizeof(VAR_0->ch[1].median)); c->slow_level -= LEVEL_DECAY(c->slow_level); return 0; if (VAR_0->zero) { VAR_4 = 0; VAR_0->zero = 0; } else { VAR_4 = get_unary_0_33(VAR_1); if (get_bits_left(VAR_1) < 0) if (VAR_4 == 16) { VAR_5 = get_unary_0_33(VAR_1); if (VAR_5 < 2) { if (get_bits_left(VAR_1) < 0) VAR_4 += VAR_5; } else { if (get_bits_left(VAR_1) < VAR_5 - 1) VAR_4 += get_bits(VAR_1, VAR_5 - 1) | (1 << (VAR_5 - 1)); if (VAR_0->one) { VAR_0->one = VAR_4 & 1; VAR_4 = (VAR_4 >> 1) + 1; } else { VAR_0->one = VAR_4 & 1; VAR_4 >>= 1; VAR_0->zero = !VAR_0->one; if (VAR_0->hybrid && !VAR_2) update_error_limit(VAR_0); if (!VAR_4) { VAR_7 = 0; VAR_8 = GET_MED(0) - 1; DEC_MED(0); } else if (VAR_4 == 1) { VAR_7 = GET_MED(0); VAR_8 = GET_MED(1) - 1; INC_MED(0); DEC_MED(1); } else if (VAR_4 == 2) { VAR_7 = GET_MED(0) + GET_MED(1); VAR_8 = GET_MED(2) - 1; INC_MED(0); INC_MED(1); DEC_MED(2); } else { VAR_7 = GET_MED(0) + GET_MED(1) + GET_MED(2) * (VAR_4 - 2); VAR_8 = GET_MED(2) - 1; INC_MED(0); INC_MED(1); INC_MED(2); if (!c->error_limit) { VAR_9 = VAR_7 + get_tail(VAR_1, VAR_8); if (get_bits_left(VAR_1) <= 0) } else { int VAR_10 = (VAR_7 * 2 + VAR_8 + 1) >> 1; while (VAR_8 > c->error_limit) { if (get_bits_left(VAR_1) <= 0) if (get_bits1(VAR_1)) { VAR_8 -= (VAR_10 - VAR_7); VAR_7 = VAR_10; } else VAR_8 = VAR_10 - VAR_7 - 1; VAR_10 = (VAR_7 * 2 + VAR_8 + 1) >> 1; VAR_9 = VAR_10; VAR_6 = get_bits1(VAR_1); if (VAR_0->hybrid_bitrate) c->slow_level += wp_log2(VAR_9) - LEVEL_DECAY(c->slow_level); return VAR_6 ? ~VAR_9 : VAR_9; error: *VAR_3 = 1; return 0;
[ "static int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1,\nint VAR_2, int *VAR_3)\n{", "int VAR_4, VAR_5;", "int VAR_6, VAR_7, VAR_8, VAR_9;", "WvChannel *c = &VAR_0->ch[VAR_2];", "*VAR_3 = 0;", "if ((VAR_0->ch[0].median[0] < 2U) && (VAR_0->ch[1].median[0] < 2U) &&\n!VAR_0->zero && !VAR_0->one)...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 34 ], [ 36 ], [ 38 ], [ 40, 43 ], [ 45 ], [ 47, 51 ], [ 53 ...
26,305
static pxa2xx_timer_info *pxa2xx_timer_init(target_phys_addr_t base, qemu_irq *irqs) { int i; int iomemtype; pxa2xx_timer_info *s; s = (pxa2xx_timer_info *) qemu_mallocz(sizeof(pxa2xx_timer_info)); s->base = base; s->irq_enabled = 0; s->oldclock = 0; s->clock = 0; s->lastload = qemu_get_clock(vm_clock); s->reset3 = 0; for (i = 0; i < 4; i ++) { s->timer[i].value = 0; s->timer[i].irq = irqs[i]; s->timer[i].info = s; s->timer[i].num = i; s->timer[i].level = 0; s->timer[i].qtimer = qemu_new_timer(vm_clock, pxa2xx_timer_tick, &s->timer[i]); } iomemtype = cpu_register_io_memory(0, pxa2xx_timer_readfn, pxa2xx_timer_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); register_savevm("pxa2xx_timer", 0, 0, pxa2xx_timer_save, pxa2xx_timer_load, s); return s; }
true
qemu
187337f8b0ec0813dd3876d1efe37d415fb81c2e
static pxa2xx_timer_info *pxa2xx_timer_init(target_phys_addr_t base, qemu_irq *irqs) { int i; int iomemtype; pxa2xx_timer_info *s; s = (pxa2xx_timer_info *) qemu_mallocz(sizeof(pxa2xx_timer_info)); s->base = base; s->irq_enabled = 0; s->oldclock = 0; s->clock = 0; s->lastload = qemu_get_clock(vm_clock); s->reset3 = 0; for (i = 0; i < 4; i ++) { s->timer[i].value = 0; s->timer[i].irq = irqs[i]; s->timer[i].info = s; s->timer[i].num = i; s->timer[i].level = 0; s->timer[i].qtimer = qemu_new_timer(vm_clock, pxa2xx_timer_tick, &s->timer[i]); } iomemtype = cpu_register_io_memory(0, pxa2xx_timer_readfn, pxa2xx_timer_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); register_savevm("pxa2xx_timer", 0, 0, pxa2xx_timer_save, pxa2xx_timer_load, s); return s; }
{ "code": [ " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base, 0x00000fff, iomemtype);" ], "line_no": [ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55 ] }
static pxa2xx_timer_info *FUNC_0(target_phys_addr_t base, qemu_irq *irqs) { int VAR_0; int VAR_1; pxa2xx_timer_info *s; s = (pxa2xx_timer_info *) qemu_mallocz(sizeof(pxa2xx_timer_info)); s->base = base; s->irq_enabled = 0; s->oldclock = 0; s->clock = 0; s->lastload = qemu_get_clock(vm_clock); s->reset3 = 0; for (VAR_0 = 0; VAR_0 < 4; VAR_0 ++) { s->timer[VAR_0].value = 0; s->timer[VAR_0].irq = irqs[VAR_0]; s->timer[VAR_0].info = s; s->timer[VAR_0].num = VAR_0; s->timer[VAR_0].level = 0; s->timer[VAR_0].qtimer = qemu_new_timer(vm_clock, pxa2xx_timer_tick, &s->timer[VAR_0]); } VAR_1 = cpu_register_io_memory(0, pxa2xx_timer_readfn, pxa2xx_timer_writefn, s); cpu_register_physical_memory(base, 0x00000fff, VAR_1); register_savevm("pxa2xx_timer", 0, 0, pxa2xx_timer_save, pxa2xx_timer_load, s); return s; }
[ "static pxa2xx_timer_info *FUNC_0(target_phys_addr_t base,\nqemu_irq *irqs)\n{", "int VAR_0;", "int VAR_1;", "pxa2xx_timer_info *s;", "s = (pxa2xx_timer_info *) qemu_mallocz(sizeof(pxa2xx_timer_info));", "s->base = base;", "s->irq_enabled = 0;", "s->oldclock = 0;", "s->clock = 0;", "s->lastload = ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ...
26,307
static void http_write_packet(void *opaque, unsigned char *buf, int size) { HTTPContext *c = opaque; if (c->buffer_ptr == c->buffer_end || !c->buffer_ptr) c->buffer_ptr = c->buffer_end = c->buffer; if (c->buffer_end - c->buffer + size > IOBUFFER_MAX_SIZE) abort(); memcpy(c->buffer_end, buf, size); c->buffer_end += size; }
true
FFmpeg
ec3b22326dc07fb8300a577bd6b17c19a0f1bcf7
static void http_write_packet(void *opaque, unsigned char *buf, int size) { HTTPContext *c = opaque; if (c->buffer_ptr == c->buffer_end || !c->buffer_ptr) c->buffer_ptr = c->buffer_end = c->buffer; if (c->buffer_end - c->buffer + size > IOBUFFER_MAX_SIZE) abort(); memcpy(c->buffer_end, buf, size); c->buffer_end += size; }
{ "code": [ " abort();", " abort();" ], "line_no": [ 19, 19 ] }
static void FUNC_0(void *VAR_0, unsigned char *VAR_1, int VAR_2) { HTTPContext *c = VAR_0; if (c->buffer_ptr == c->buffer_end || !c->buffer_ptr) c->buffer_ptr = c->buffer_end = c->buffer; if (c->buffer_end - c->buffer + VAR_2 > IOBUFFER_MAX_SIZE) abort(); memcpy(c->buffer_end, VAR_1, VAR_2); c->buffer_end += VAR_2; }
[ "static void FUNC_0(void *VAR_0,\nunsigned char *VAR_1, int VAR_2)\n{", "HTTPContext *c = VAR_0;", "if (c->buffer_ptr == c->buffer_end || !c->buffer_ptr)\nc->buffer_ptr = c->buffer_end = c->buffer;", "if (c->buffer_end - c->buffer + VAR_2 > IOBUFFER_MAX_SIZE)\nabort();", "memcpy(c->buffer_end, VAR_1, VAR_2)...
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ] ]
26,308
void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt, const struct iovec *iov, int iovcnt, size_t iovoff, bool strip_vlan, uint16_t vet) { uint16_t tci = 0; uint16_t ploff = iovoff; assert(pkt); pkt->vlan_stripped = false; if (strip_vlan) { pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet, pkt->ehdr_buf, &ploff, &tci); } pkt->tci = tci; net_rx_pkt_pull_data(pkt, iov, iovcnt, ploff); }
true
qemu
df8bf7a7fe75eb5d5caffa55f5cd4292b757aea6
void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt, const struct iovec *iov, int iovcnt, size_t iovoff, bool strip_vlan, uint16_t vet) { uint16_t tci = 0; uint16_t ploff = iovoff; assert(pkt); pkt->vlan_stripped = false; if (strip_vlan) { pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet, pkt->ehdr_buf, &ploff, &tci); } pkt->tci = tci; net_rx_pkt_pull_data(pkt, iov, iovcnt, ploff); }
{ "code": [ " pkt->vlan_stripped = false;", " pkt->vlan_stripped = false;", " pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,", " pkt->ehdr_buf,", " &ploff, &tci);" ], "line_no": [ 17, 17, 23, 25, 27 ] }
void FUNC_0(struct NetRxPkt *VAR_0, const struct iovec *VAR_1, int VAR_2, size_t VAR_3, bool VAR_4, uint16_t VAR_5) { uint16_t tci = 0; uint16_t ploff = VAR_3; assert(VAR_0); VAR_0->vlan_stripped = false; if (VAR_4) { VAR_0->vlan_stripped = eth_strip_vlan_ex(VAR_1, VAR_2, VAR_3, VAR_5, VAR_0->ehdr_buf, &ploff, &tci); } VAR_0->tci = tci; net_rx_pkt_pull_data(VAR_0, VAR_1, VAR_2, ploff); }
[ "void FUNC_0(struct NetRxPkt *VAR_0,\nconst struct iovec *VAR_1, int VAR_2,\nsize_t VAR_3, bool VAR_4,\nuint16_t VAR_5)\n{", "uint16_t tci = 0;", "uint16_t ploff = VAR_3;", "assert(VAR_0);", "VAR_0->vlan_stripped = false;", "if (VAR_4) {", "VAR_0->vlan_stripped = eth_strip_vlan_ex(VAR_1, VAR_2, VAR_3, V...
[ 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ] ]
26,309
static int http_read_stream(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int err, new_location; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { err = http_read_header(h, &new_location); if (err < 0) return err; } if (s->chunksize >= 0) { if (!s->chunksize) { char line[32]; for (;;) { do { if ((err = http_get_line(s, line, sizeof(line))) < 0) return err; } while (!*line); /* skip CR LF from last chunk */ s->chunksize = strtoll(line, NULL, 16); av_log(NULL, AV_LOG_TRACE, "Chunked encoding data size: %"PRId64"'\n", s->chunksize); if (!s->chunksize) return 0; break; } } size = FFMIN(size, s->chunksize); } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(h, buf, size); #endif /* CONFIG_ZLIB */ return http_buf_read(h, buf, size); }
true
FFmpeg
131644677970a3c4a0096270ea2a5b5d437c2e63
static int http_read_stream(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int err, new_location; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { err = http_read_header(h, &new_location); if (err < 0) return err; } if (s->chunksize >= 0) { if (!s->chunksize) { char line[32]; for (;;) { do { if ((err = http_get_line(s, line, sizeof(line))) < 0) return err; } while (!*line); s->chunksize = strtoll(line, NULL, 16); av_log(NULL, AV_LOG_TRACE, "Chunked encoding data size: %"PRId64"'\n", s->chunksize); if (!s->chunksize) return 0; break; } } size = FFMIN(size, s->chunksize); } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(h, buf, size); #endif return http_buf_read(h, buf, size); }
{ "code": [ " if (!s->chunksize)" ], "line_no": [ 59 ] }
static int FUNC_0(URLContext *VAR_0, uint8_t *VAR_1, int VAR_2) { HTTPContext *s = VAR_0->priv_data; int VAR_3, VAR_4; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { VAR_3 = http_read_header(VAR_0, &VAR_4); if (VAR_3 < 0) return VAR_3; } if (s->chunksize >= 0) { if (!s->chunksize) { char VAR_5[32]; for (;;) { do { if ((VAR_3 = http_get_line(s, VAR_5, sizeof(VAR_5))) < 0) return VAR_3; } while (!*VAR_5); s->chunksize = strtoll(VAR_5, NULL, 16); av_log(NULL, AV_LOG_TRACE, "Chunked encoding data VAR_2: %"PRId64"'\n", s->chunksize); if (!s->chunksize) return 0; break; } } VAR_2 = FFMIN(VAR_2, s->chunksize); } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(VAR_0, VAR_1, VAR_2); #endif return http_buf_read(VAR_0, VAR_1, VAR_2); }
[ "static int FUNC_0(URLContext *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "HTTPContext *s = VAR_0->priv_data;", "int VAR_3, VAR_4;", "if (!s->hd)\nreturn AVERROR_EOF;", "if (s->end_chunked_post && !s->end_header) {", "VAR_3 = http_read_header(VAR_0, &VAR_4);", "if (VAR_3 < 0)\nreturn VAR_3;", "}", "if (...
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 49 ], [ 53, 55 ], [ 59...
26,310
static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) { int i, j, scale_factor; unsigned prob, cumulative_target; unsigned cumul_prob = 0; unsigned scaled_cumul_prob = 0; rac->prob[0] = 0; rac->prob[257] = UINT_MAX; /* Read probabilities from bitstream */ for (i = 1; i < 257; i++) { if (lag_decode_prob(gb, &rac->prob[i]) < 0) { av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability encountered.\n"); return -1; } if ((uint64_t)cumul_prob + rac->prob[i] > UINT_MAX) { av_log(rac->avctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n"); return -1; } cumul_prob += rac->prob[i]; if (!rac->prob[i]) { if (lag_decode_prob(gb, &prob)) { av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability run encountered.\n"); return -1; } if (prob > 256 - i) prob = 256 - i; for (j = 0; j < prob; j++) rac->prob[++i] = 0; } } if (!cumul_prob) { av_log(rac->avctx, AV_LOG_ERROR, "All probabilities are 0!\n"); return -1; } /* Scale probabilities so cumulative probability is an even power of 2. */ scale_factor = av_log2(cumul_prob); if (cumul_prob & (cumul_prob - 1)) { uint64_t mul = softfloat_reciprocal(cumul_prob); for (i = 1; i <= 128; i++) { rac->prob[i] = softfloat_mul(rac->prob[i], mul); scaled_cumul_prob += rac->prob[i]; } if (scaled_cumul_prob <= 0) { av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities invalid\n"); return AVERROR_INVALIDDATA; } for (; i < 257; i++) { rac->prob[i] = softfloat_mul(rac->prob[i], mul); scaled_cumul_prob += rac->prob[i]; } scale_factor++; cumulative_target = 1 << scale_factor; if (scaled_cumul_prob > cumulative_target) { av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities are larger than target!\n"); return -1; } scaled_cumul_prob = cumulative_target - scaled_cumul_prob; for (i = 1; scaled_cumul_prob; i = (i & 0x7f) + 1) { if (rac->prob[i]) { rac->prob[i]++; scaled_cumul_prob--; } /* Comment from reference source: * if (b & 0x80 == 0) { // order of operations is 'wrong'; it has been left this way * // since the compression change is negligible and fixing it * // breaks backwards compatibility * b =- (signed int)b; * b &= 0xFF; * } else { * b++; * b &= 0x7f; * } */ } } rac->scale = scale_factor; /* Fill probability array with cumulative probability for each symbol. */ for (i = 1; i < 257; i++) rac->prob[i] += rac->prob[i - 1]; return 0; }
true
FFmpeg
ed3c9b5b0dd5abb545c48e930e1c32c187b0776a
static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) { int i, j, scale_factor; unsigned prob, cumulative_target; unsigned cumul_prob = 0; unsigned scaled_cumul_prob = 0; rac->prob[0] = 0; rac->prob[257] = UINT_MAX; for (i = 1; i < 257; i++) { if (lag_decode_prob(gb, &rac->prob[i]) < 0) { av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability encountered.\n"); return -1; } if ((uint64_t)cumul_prob + rac->prob[i] > UINT_MAX) { av_log(rac->avctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n"); return -1; } cumul_prob += rac->prob[i]; if (!rac->prob[i]) { if (lag_decode_prob(gb, &prob)) { av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability run encountered.\n"); return -1; } if (prob > 256 - i) prob = 256 - i; for (j = 0; j < prob; j++) rac->prob[++i] = 0; } } if (!cumul_prob) { av_log(rac->avctx, AV_LOG_ERROR, "All probabilities are 0!\n"); return -1; } scale_factor = av_log2(cumul_prob); if (cumul_prob & (cumul_prob - 1)) { uint64_t mul = softfloat_reciprocal(cumul_prob); for (i = 1; i <= 128; i++) { rac->prob[i] = softfloat_mul(rac->prob[i], mul); scaled_cumul_prob += rac->prob[i]; } if (scaled_cumul_prob <= 0) { av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities invalid\n"); return AVERROR_INVALIDDATA; } for (; i < 257; i++) { rac->prob[i] = softfloat_mul(rac->prob[i], mul); scaled_cumul_prob += rac->prob[i]; } scale_factor++; cumulative_target = 1 << scale_factor; if (scaled_cumul_prob > cumulative_target) { av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities are larger than target!\n"); return -1; } scaled_cumul_prob = cumulative_target - scaled_cumul_prob; for (i = 1; scaled_cumul_prob; i = (i & 0x7f) + 1) { if (rac->prob[i]) { rac->prob[i]++; scaled_cumul_prob--; } } } rac->scale = scale_factor; for (i = 1; i < 257; i++) rac->prob[i] += rac->prob[i - 1]; return 0; }
{ "code": [ " cumulative_target = 1 << scale_factor;" ], "line_no": [ 113 ] }
static int FUNC_0(lag_rac *VAR_0, GetBitContext *VAR_1) { int VAR_2, VAR_3, VAR_4; unsigned VAR_5, VAR_6; unsigned VAR_7 = 0; unsigned VAR_8 = 0; VAR_0->VAR_5[0] = 0; VAR_0->VAR_5[257] = UINT_MAX; for (VAR_2 = 1; VAR_2 < 257; VAR_2++) { if (lag_decode_prob(VAR_1, &VAR_0->VAR_5[VAR_2]) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid probability encountered.\n"); return -1; } if ((uint64_t)VAR_7 + VAR_0->VAR_5[VAR_2] > UINT_MAX) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n"); return -1; } VAR_7 += VAR_0->VAR_5[VAR_2]; if (!VAR_0->VAR_5[VAR_2]) { if (lag_decode_prob(VAR_1, &VAR_5)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid probability run encountered.\n"); return -1; } if (VAR_5 > 256 - VAR_2) VAR_5 = 256 - VAR_2; for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++) VAR_0->VAR_5[++VAR_2] = 0; } } if (!VAR_7) { av_log(VAR_0->avctx, AV_LOG_ERROR, "All probabilities are 0!\n"); return -1; } VAR_4 = av_log2(VAR_7); if (VAR_7 & (VAR_7 - 1)) { uint64_t mul = softfloat_reciprocal(VAR_7); for (VAR_2 = 1; VAR_2 <= 128; VAR_2++) { VAR_0->VAR_5[VAR_2] = softfloat_mul(VAR_0->VAR_5[VAR_2], mul); VAR_8 += VAR_0->VAR_5[VAR_2]; } if (VAR_8 <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Scaled probabilities invalid\n"); return AVERROR_INVALIDDATA; } for (; VAR_2 < 257; VAR_2++) { VAR_0->VAR_5[VAR_2] = softfloat_mul(VAR_0->VAR_5[VAR_2], mul); VAR_8 += VAR_0->VAR_5[VAR_2]; } VAR_4++; VAR_6 = 1 << VAR_4; if (VAR_8 > VAR_6) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Scaled probabilities are larger than target!\n"); return -1; } VAR_8 = VAR_6 - VAR_8; for (VAR_2 = 1; VAR_8; VAR_2 = (VAR_2 & 0x7f) + 1) { if (VAR_0->VAR_5[VAR_2]) { VAR_0->VAR_5[VAR_2]++; VAR_8--; } } } VAR_0->scale = VAR_4; for (VAR_2 = 1; VAR_2 < 257; VAR_2++) VAR_0->VAR_5[VAR_2] += VAR_0->VAR_5[VAR_2 - 1]; return 0; }
[ "static int FUNC_0(lag_rac *VAR_0, GetBitContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "unsigned VAR_5, VAR_6;", "unsigned VAR_7 = 0;", "unsigned VAR_8 = 0;", "VAR_0->VAR_5[0] = 0;", "VAR_0->VAR_5[257] = UINT_MAX;", "for (VAR_2 = 1; VAR_2 < 257; VAR_2++) {", "if (lag_decode_prob(VAR_1, &VAR_0->VA...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ...
26,311
static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf) { int length = buf[2] & 0x3; int xfer; int unit = ata_passthrough_xfer_unit(dev, buf); switch (length) { case 0: case 3: /* USB-specific. */ xfer = 0; break; case 1: xfer = buf[3]; break; case 2: xfer = buf[4]; break; } return xfer * unit; }
true
qemu
d83c951cce14dd3c7600c386d3791c4993744622
static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf) { int length = buf[2] & 0x3; int xfer; int unit = ata_passthrough_xfer_unit(dev, buf); switch (length) { case 0: case 3: xfer = 0; break; case 1: xfer = buf[3]; break; case 2: xfer = buf[4]; break; } return xfer * unit; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCSIDevice *VAR_0, uint8_t *VAR_1) { int VAR_2 = VAR_1[2] & 0x3; int VAR_3; int VAR_4 = ata_passthrough_xfer_unit(VAR_0, VAR_1); switch (VAR_2) { case 0: case 3: VAR_3 = 0; break; case 1: VAR_3 = VAR_1[3]; break; case 2: VAR_3 = VAR_1[4]; break; } return VAR_3 * VAR_4; }
[ "static int FUNC_0(SCSIDevice *VAR_0, uint8_t *VAR_1)\n{", "int VAR_2 = VAR_1[2] & 0x3;", "int VAR_3;", "int VAR_4 = ata_passthrough_xfer_unit(VAR_0, VAR_1);", "switch (VAR_2) {", "case 0:\ncase 3:\nVAR_3 = 0;", "break;", "case 1:\nVAR_3 = VAR_1[3];", "break;", "case 2:\nVAR_3 = VAR_1[4];", "bre...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17, 20 ], [ 22 ], [ 24, 26 ], [ 28 ], [ 30, 32 ], [ 34 ], [ 36 ], [ 40 ], [ 42 ] ]
26,312
static inline void downmix_2f_2r_to_stereo(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += samples[i + 512]; samples[i + 256] = samples[i + 768]; samples[i + 512] = samples[i + 768] = 0; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_2f_2r_to_stereo(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += samples[i + 512]; samples[i + 256] = 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 + 512]; VAR_0[VAR_1 + 256] = 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 + 512];", "VAR_0[VAR_1 + 256] = 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 ] ]
26,313
static int video_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; st = av_new_stream(s, 0); if (!st) return AVERROR_NOMEM; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = s->iformat->value; st->need_parsing = 1; /* for mjpeg, specify frame rate */ /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/ if (ap && ap->time_base.num) { av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); } else if ( st->codec->codec_id == CODEC_ID_MJPEG || st->codec->codec_id == CODEC_ID_MPEG4 || st->codec->codec_id == CODEC_ID_H264) { av_set_pts_info(st, 64, 1, 25); } return 0; }
false
FFmpeg
c04c3282b4334ff64cfd69d40fea010602e830fd
static int video_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; st = av_new_stream(s, 0); if (!st) return AVERROR_NOMEM; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = s->iformat->value; st->need_parsing = 1; if (ap && ap->time_base.num) { av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); } else if ( st->codec->codec_id == CODEC_ID_MJPEG || st->codec->codec_id == CODEC_ID_MPEG4 || st->codec->codec_id == CODEC_ID_H264) { av_set_pts_info(st, 64, 1, 25); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { AVStream *st; st = av_new_stream(VAR_0, 0); if (!st) return AVERROR_NOMEM; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = VAR_0->iformat->value; st->need_parsing = 1; if (VAR_1 && VAR_1->time_base.num) { av_set_pts_info(st, 64, VAR_1->time_base.num, VAR_1->time_base.den); } else if ( st->codec->codec_id == CODEC_ID_MJPEG || st->codec->codec_id == CODEC_ID_MPEG4 || st->codec->codec_id == CODEC_ID_H264) { av_set_pts_info(st, 64, 1, 25); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{", "AVStream *st;", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR_NOMEM;", "st->codec->codec_type = CODEC_TYPE_VIDEO;", "st->codec->codec_id = VAR_0->iformat->value;", "st->need_parsing = 1;", "if (VAR_1 && VAR_1->ti...
[ 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
26,314
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; static int counter = 0; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { #if 1 av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; #else int ptype = get_bits(&gb, 7); skip_bits(&gb, 6*8); /* "theora" */ switch(ptype) { case 1: theora_decode_comments(avctx, gb); break; case 2: theora_decode_tables(avctx, gb); init_dequantizer(s); break; default: av_log(avctx, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype); } return buf_size; #endif } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); s->last_quality_index = s->quality_index; s->quality_index = get_bits(&gb, 6); if (s->theora >= 0x030200) skip_bits1(&gb); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", counter, s->quality_index); counter++; if (s->quality_index != s->last_quality_index) { init_dequantizer(s); init_loop_filter(s); } if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); /* width code */ skip_bits(&gb, 4); /* height code */ if (s->version) { s->version = get_bits(&gb, 5); if (counter == 1) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); /* reserved? */ } if (s->last_frame.data[0] == s->golden_frame.data[0]) { if (s->golden_frame.data[0]) avctx->release_buffer(avctx, &s->golden_frame); s->last_frame= s->golden_frame; /* ensure that we catch any access to this released frame */ } else { if (s->golden_frame.data[0]) avctx->release_buffer(avctx, &s->golden_frame); if (s->last_frame.data[0]) avctx->release_buffer(avctx, &s->last_frame); } s->golden_frame.reference = 3; if(avctx->get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } /* golden frame is also the current frame */ memcpy(&s->current_frame, &s->golden_frame, sizeof(AVFrame)); /* time to figure out pixel addresses? */ if (!s->pixel_addresses_inited) { if (!s->flipped_image) vp3_calculate_pixel_addresses(s); else theora_calculate_pixel_addresses(s); } } else { /* allocate a new current frame */ s->current_frame.reference = 3; if(avctx->get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } } s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame s->current_frame.qstride= 0; {START_TIMER init_frame(s, &gb); STOP_TIMER("init_frame")} #if KEYFRAMES_ONLY if (!s->keyframe) { memcpy(s->current_frame.data[0], s->golden_frame.data[0], s->current_frame.linesize[0] * s->height); memcpy(s->current_frame.data[1], s->golden_frame.data[1], s->current_frame.linesize[1] * s->height / 2); memcpy(s->current_frame.data[2], s->golden_frame.data[2], s->current_frame.linesize[2] * s->height / 2); } else { #endif {START_TIMER if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); return -1; } STOP_TIMER("unpack_superblocks")} {START_TIMER if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); return -1; } STOP_TIMER("unpack_modes")} {START_TIMER if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); return -1; } STOP_TIMER("unpack_vectors")} {START_TIMER if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); return -1; } STOP_TIMER("unpack_dct_coeffs")} {START_TIMER reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height); if ((avctx->flags & CODEC_FLAG_GRAY) == 0) { reverse_dc_prediction(s, s->u_fragment_start, s->fragment_width / 2, s->fragment_height / 2); reverse_dc_prediction(s, s->v_fragment_start, s->fragment_width / 2, s->fragment_height / 2); } STOP_TIMER("reverse_dc_prediction")} {START_TIMER for (i = 0; i < s->macroblock_height; i++) render_slice(s, i); STOP_TIMER("render_fragments")} {START_TIMER apply_loop_filter(s); STOP_TIMER("apply_loop_filter")} #if KEYFRAMES_ONLY } #endif *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; /* release the last frame, if it is allocated and if it is not the * golden frame */ if ((s->last_frame.data[0]) && (s->last_frame.data[0] != s->golden_frame.data[0])) avctx->release_buffer(avctx, &s->last_frame); /* shuffle frames (last = current) */ memcpy(&s->last_frame, &s->current_frame, sizeof(AVFrame)); s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */ return buf_size; }
false
FFmpeg
e278056fbad7405fc47901faea7de98db003a0fa
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; static int counter = 0; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { #if 1 av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; #else int ptype = get_bits(&gb, 7); skip_bits(&gb, 6*8); switch(ptype) { case 1: theora_decode_comments(avctx, gb); break; case 2: theora_decode_tables(avctx, gb); init_dequantizer(s); break; default: av_log(avctx, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype); } return buf_size; #endif } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); s->last_quality_index = s->quality_index; s->quality_index = get_bits(&gb, 6); if (s->theora >= 0x030200) skip_bits1(&gb); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", counter, s->quality_index); counter++; if (s->quality_index != s->last_quality_index) { init_dequantizer(s); init_loop_filter(s); } if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (counter == 1) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } if (s->last_frame.data[0] == s->golden_frame.data[0]) { if (s->golden_frame.data[0]) avctx->release_buffer(avctx, &s->golden_frame); s->last_frame= s->golden_frame; } else { if (s->golden_frame.data[0]) avctx->release_buffer(avctx, &s->golden_frame); if (s->last_frame.data[0]) avctx->release_buffer(avctx, &s->last_frame); } s->golden_frame.reference = 3; if(avctx->get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } memcpy(&s->current_frame, &s->golden_frame, sizeof(AVFrame)); if (!s->pixel_addresses_inited) { if (!s->flipped_image) vp3_calculate_pixel_addresses(s); else theora_calculate_pixel_addresses(s); } } else { s->current_frame.reference = 3; if(avctx->get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } } s->current_frame.qscale_table= s->qscale_table; s->current_frame.qstride= 0; {START_TIMER init_frame(s, &gb); STOP_TIMER("init_frame")} #if KEYFRAMES_ONLY if (!s->keyframe) { memcpy(s->current_frame.data[0], s->golden_frame.data[0], s->current_frame.linesize[0] * s->height); memcpy(s->current_frame.data[1], s->golden_frame.data[1], s->current_frame.linesize[1] * s->height / 2); memcpy(s->current_frame.data[2], s->golden_frame.data[2], s->current_frame.linesize[2] * s->height / 2); } else { #endif {START_TIMER if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); return -1; } STOP_TIMER("unpack_superblocks")} {START_TIMER if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); return -1; } STOP_TIMER("unpack_modes")} {START_TIMER if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); return -1; } STOP_TIMER("unpack_vectors")} {START_TIMER if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); return -1; } STOP_TIMER("unpack_dct_coeffs")} {START_TIMER reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height); if ((avctx->flags & CODEC_FLAG_GRAY) == 0) { reverse_dc_prediction(s, s->u_fragment_start, s->fragment_width / 2, s->fragment_height / 2); reverse_dc_prediction(s, s->v_fragment_start, s->fragment_width / 2, s->fragment_height / 2); } STOP_TIMER("reverse_dc_prediction")} {START_TIMER for (i = 0; i < s->macroblock_height; i++) render_slice(s, i); STOP_TIMER("render_fragments")} {START_TIMER apply_loop_filter(s); STOP_TIMER("apply_loop_filter")} #if KEYFRAMES_ONLY } #endif *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; if ((s->last_frame.data[0]) && (s->last_frame.data[0] != s->golden_frame.data[0])) avctx->release_buffer(avctx, &s->last_frame); memcpy(&s->last_frame, &s->current_frame, sizeof(AVFrame)); s->current_frame.data[0]= NULL; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, uint8_t *VAR_3, int VAR_4) { Vp3DecodeContext *s = VAR_0->priv_data; GetBitContext gb; static int VAR_5 = 0; int VAR_6; init_get_bits(&gb, VAR_3, VAR_4 * 8); if (s->theora && get_bits1(&gb)) { #if 1 av_log(VAR_0, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; #else int ptype = get_bits(&gb, 7); skip_bits(&gb, 6*8); switch(ptype) { case 1: theora_decode_comments(VAR_0, gb); break; case 2: theora_decode_tables(VAR_0, gb); init_dequantizer(s); break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype); } return VAR_4; #endif } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); s->last_quality_index = s->quality_index; s->quality_index = get_bits(&gb, 6); if (s->theora >= 0x030200) skip_bits1(&gb); if (s->VAR_0->debug & FF_DEBUG_PICT_INFO) av_log(s->VAR_0, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", VAR_5, s->quality_index); VAR_5++; if (s->quality_index != s->last_quality_index) { init_dequantizer(s); init_loop_filter(s); } if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (VAR_5 == 1) av_log(s->VAR_0, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->VAR_0, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } if (s->last_frame.VAR_1[0] == s->golden_frame.VAR_1[0]) { if (s->golden_frame.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->golden_frame); s->last_frame= s->golden_frame; } else { if (s->golden_frame.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->golden_frame); if (s->last_frame.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->last_frame); } s->golden_frame.reference = 3; if(VAR_0->get_buffer(VAR_0, &s->golden_frame) < 0) { av_log(s->VAR_0, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } memcpy(&s->current_frame, &s->golden_frame, sizeof(AVFrame)); if (!s->pixel_addresses_inited) { if (!s->flipped_image) vp3_calculate_pixel_addresses(s); else theora_calculate_pixel_addresses(s); } } else { s->current_frame.reference = 3; if(VAR_0->get_buffer(VAR_0, &s->current_frame) < 0) { av_log(s->VAR_0, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } } s->current_frame.qscale_table= s->qscale_table; s->current_frame.qstride= 0; {START_TIMER init_frame(s, &gb); STOP_TIMER("init_frame")} #if KEYFRAMES_ONLY if (!s->keyframe) { memcpy(s->current_frame.VAR_1[0], s->golden_frame.VAR_1[0], s->current_frame.linesize[0] * s->height); memcpy(s->current_frame.VAR_1[1], s->golden_frame.VAR_1[1], s->current_frame.linesize[1] * s->height / 2); memcpy(s->current_frame.VAR_1[2], s->golden_frame.VAR_1[2], s->current_frame.linesize[2] * s->height / 2); } else { #endif {START_TIMER if (unpack_superblocks(s, &gb)){ av_log(s->VAR_0, AV_LOG_ERROR, "error in unpack_superblocks\n"); return -1; } STOP_TIMER("unpack_superblocks")} {START_TIMER if (unpack_modes(s, &gb)){ av_log(s->VAR_0, AV_LOG_ERROR, "error in unpack_modes\n"); return -1; } STOP_TIMER("unpack_modes")} {START_TIMER if (unpack_vectors(s, &gb)){ av_log(s->VAR_0, AV_LOG_ERROR, "error in unpack_vectors\n"); return -1; } STOP_TIMER("unpack_vectors")} {START_TIMER if (unpack_dct_coeffs(s, &gb)){ av_log(s->VAR_0, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); return -1; } STOP_TIMER("unpack_dct_coeffs")} {START_TIMER reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height); if ((VAR_0->flags & CODEC_FLAG_GRAY) == 0) { reverse_dc_prediction(s, s->u_fragment_start, s->fragment_width / 2, s->fragment_height / 2); reverse_dc_prediction(s, s->v_fragment_start, s->fragment_width / 2, s->fragment_height / 2); } STOP_TIMER("reverse_dc_prediction")} {START_TIMER for (VAR_6 = 0; VAR_6 < s->macroblock_height; VAR_6++) render_slice(s, VAR_6); STOP_TIMER("render_fragments")} {START_TIMER apply_loop_filter(s); STOP_TIMER("apply_loop_filter")} #if KEYFRAMES_ONLY } #endif *VAR_2=sizeof(AVFrame); *(AVFrame*)VAR_1= s->current_frame; if ((s->last_frame.VAR_1[0]) && (s->last_frame.VAR_1[0] != s->golden_frame.VAR_1[0])) VAR_0->release_buffer(VAR_0, &s->last_frame); memcpy(&s->last_frame, &s->current_frame, sizeof(AVFrame)); s->current_frame.VAR_1[0]= NULL; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "Vp3DecodeContext *s = VAR_0->priv_data;", "GetBitContext gb;", "static int VAR_5 = 0;", "int VAR_6;", "init_get_bits(&gb, VAR_3, VAR_4 * 8);", "if (s->theora && get_bits1(&gb))\n{", "#if 1\nav_log(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...
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ...
26,316
static inline int host_to_target_errno(int err) { if(host_to_target_errno_table[err]) return host_to_target_errno_table[err]; return err; }
true
qemu
2466119c9551d606a0f92f9832e0c865bc04b488
static inline int host_to_target_errno(int err) { if(host_to_target_errno_table[err]) return host_to_target_errno_table[err]; return err; }
{ "code": [ " if(host_to_target_errno_table[err])" ], "line_no": [ 5 ] }
static inline int FUNC_0(int VAR_0) { if(host_to_target_errno_table[VAR_0]) return host_to_target_errno_table[VAR_0]; return VAR_0; }
[ "static inline int FUNC_0(int VAR_0)\n{", "if(host_to_target_errno_table[VAR_0])\nreturn host_to_target_errno_table[VAR_0];", "return VAR_0;", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
26,317
void backup_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, bool compress, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, BlockJobTxn *txn, Error **errp) { int64_t len; BlockDriverInfo bdi; BackupBlockJob *job = NULL; int ret; assert(bs); assert(target); if (bs == target) { error_setg(errp, "Source and target cannot be the same"); return; } if (!bdrv_is_inserted(bs)) { error_setg(errp, "Device is not inserted: %s", bdrv_get_device_name(bs)); return; } if (!bdrv_is_inserted(target)) { error_setg(errp, "Device is not inserted: %s", bdrv_get_device_name(target)); return; } if (compress && target->drv->bdrv_co_pwritev_compressed == NULL) { error_setg(errp, "Compression is not supported for this drive %s", bdrv_get_device_name(target)); return; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) { return; } if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) { return; } if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) { if (!sync_bitmap) { error_setg(errp, "must provide a valid bitmap name for " "\"incremental\" sync mode"); return; } /* Create a new bitmap, and freeze/disable this one. */ if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0) { return; } } else if (sync_bitmap) { error_setg(errp, "a sync_bitmap was provided to backup_run, " "but received an incompatible sync_mode (%s)", MirrorSyncMode_lookup[sync_mode]); return; } len = bdrv_getlength(bs); if (len < 0) { error_setg_errno(errp, -len, "unable to get length for '%s'", bdrv_get_device_name(bs)); goto error; } job = block_job_create(job_id, &backup_job_driver, bs, speed, creation_flags, cb, opaque, errp); if (!job) { goto error; } job->target = blk_new(); blk_insert_bs(job->target, target); job->on_source_error = on_source_error; job->on_target_error = on_target_error; job->sync_mode = sync_mode; job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ? sync_bitmap : NULL; job->compress = compress; /* If there is no backing file on the target, we cannot rely on COW if our * backup cluster size is smaller than the target cluster size. Even for * targets with a backing file, try to avoid COW if possible. */ ret = bdrv_get_info(target, &bdi); if (ret < 0 && !target->backing) { error_setg_errno(errp, -ret, "Couldn't determine the cluster size of the target image, " "which has no backing file"); error_append_hint(errp, "Aborting, since this may create an unusable destination image\n"); goto error; } else if (ret < 0 && target->backing) { /* Not fatal; just trudge on ahead. */ job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; } else { job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); } block_job_add_bdrv(&job->common, target); job->common.len = len; job->common.co = qemu_coroutine_create(backup_run, job); block_job_txn_add_job(txn, &job->common); qemu_coroutine_enter(job->common.co); return; error: if (sync_bitmap) { bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL); } if (job) { blk_unref(job->target); block_job_unref(&job->common); } }
true
qemu
e8a40bf71d606f9f87866fb2461eaed52814b38e
void backup_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, bool compress, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, BlockJobTxn *txn, Error **errp) { int64_t len; BlockDriverInfo bdi; BackupBlockJob *job = NULL; int ret; assert(bs); assert(target); if (bs == target) { error_setg(errp, "Source and target cannot be the same"); return; } if (!bdrv_is_inserted(bs)) { error_setg(errp, "Device is not inserted: %s", bdrv_get_device_name(bs)); return; } if (!bdrv_is_inserted(target)) { error_setg(errp, "Device is not inserted: %s", bdrv_get_device_name(target)); return; } if (compress && target->drv->bdrv_co_pwritev_compressed == NULL) { error_setg(errp, "Compression is not supported for this drive %s", bdrv_get_device_name(target)); return; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) { return; } if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) { return; } if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) { if (!sync_bitmap) { error_setg(errp, "must provide a valid bitmap name for " "\"incremental\" sync mode"); return; } if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0) { return; } } else if (sync_bitmap) { error_setg(errp, "a sync_bitmap was provided to backup_run, " "but received an incompatible sync_mode (%s)", MirrorSyncMode_lookup[sync_mode]); return; } len = bdrv_getlength(bs); if (len < 0) { error_setg_errno(errp, -len, "unable to get length for '%s'", bdrv_get_device_name(bs)); goto error; } job = block_job_create(job_id, &backup_job_driver, bs, speed, creation_flags, cb, opaque, errp); if (!job) { goto error; } job->target = blk_new(); blk_insert_bs(job->target, target); job->on_source_error = on_source_error; job->on_target_error = on_target_error; job->sync_mode = sync_mode; job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ? sync_bitmap : NULL; job->compress = compress; ret = bdrv_get_info(target, &bdi); if (ret < 0 && !target->backing) { error_setg_errno(errp, -ret, "Couldn't determine the cluster size of the target image, " "which has no backing file"); error_append_hint(errp, "Aborting, since this may create an unusable destination image\n"); goto error; } else if (ret < 0 && target->backing) { job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; } else { job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); } block_job_add_bdrv(&job->common, target); job->common.len = len; job->common.co = qemu_coroutine_create(backup_run, job); block_job_txn_add_job(txn, &job->common); qemu_coroutine_enter(job->common.co); return; error: if (sync_bitmap) { bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL); } if (job) { blk_unref(job->target); block_job_unref(&job->common); } }
{ "code": [ " blk_unref(job->target);" ], "line_no": [ 243 ] }
void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1, BlockDriverState *VAR_2, int64_t VAR_3, MirrorSyncMode VAR_4, BdrvDirtyBitmap *VAR_5, bool VAR_6, BlockdevOnError VAR_7, BlockdevOnError VAR_8, int VAR_9, BlockCompletionFunc *VAR_10, void *VAR_11, BlockJobTxn *VAR_12, Error **VAR_13) { int64_t len; BlockDriverInfo bdi; BackupBlockJob *job = NULL; int VAR_14; assert(VAR_1); assert(VAR_2); if (VAR_1 == VAR_2) { error_setg(VAR_13, "Source and VAR_2 cannot be the same"); return; } if (!bdrv_is_inserted(VAR_1)) { error_setg(VAR_13, "Device is not inserted: %s", bdrv_get_device_name(VAR_1)); return; } if (!bdrv_is_inserted(VAR_2)) { error_setg(VAR_13, "Device is not inserted: %s", bdrv_get_device_name(VAR_2)); return; } if (VAR_6 && VAR_2->drv->bdrv_co_pwritev_compressed == NULL) { error_setg(VAR_13, "Compression is not supported for this drive %s", bdrv_get_device_name(VAR_2)); return; } if (bdrv_op_is_blocked(VAR_1, BLOCK_OP_TYPE_BACKUP_SOURCE, VAR_13)) { return; } if (bdrv_op_is_blocked(VAR_2, BLOCK_OP_TYPE_BACKUP_TARGET, VAR_13)) { return; } if (VAR_4 == MIRROR_SYNC_MODE_INCREMENTAL) { if (!VAR_5) { error_setg(VAR_13, "must provide a valid bitmap name for " "\"incremental\" sync mode"); return; } if (bdrv_dirty_bitmap_create_successor(VAR_1, VAR_5, VAR_13) < 0) { return; } } else if (VAR_5) { error_setg(VAR_13, "a VAR_5 was provided to backup_run, " "but received an incompatible VAR_4 (%s)", MirrorSyncMode_lookup[VAR_4]); return; } len = bdrv_getlength(VAR_1); if (len < 0) { error_setg_errno(VAR_13, -len, "unable to get length for '%s'", bdrv_get_device_name(VAR_1)); goto error; } job = block_job_create(VAR_0, &backup_job_driver, VAR_1, VAR_3, VAR_9, VAR_10, VAR_11, VAR_13); if (!job) { goto error; } job->VAR_2 = blk_new(); blk_insert_bs(job->VAR_2, VAR_2); job->VAR_7 = VAR_7; job->VAR_8 = VAR_8; job->VAR_4 = VAR_4; job->VAR_5 = VAR_4 == MIRROR_SYNC_MODE_INCREMENTAL ? VAR_5 : NULL; job->VAR_6 = VAR_6; VAR_14 = bdrv_get_info(VAR_2, &bdi); if (VAR_14 < 0 && !VAR_2->backing) { error_setg_errno(VAR_13, -VAR_14, "Couldn't determine the cluster size of the VAR_2 image, " "which has no backing file"); error_append_hint(VAR_13, "Aborting, since this may create an unusable destination image\n"); goto error; } else if (VAR_14 < 0 && VAR_2->backing) { job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; } else { job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); } block_job_add_bdrv(&job->common, VAR_2); job->common.len = len; job->common.co = qemu_coroutine_create(backup_run, job); block_job_txn_add_job(VAR_12, &job->common); qemu_coroutine_enter(job->common.co); return; error: if (VAR_5) { bdrv_reclaim_dirty_bitmap(VAR_1, VAR_5, NULL); } if (job) { blk_unref(job->VAR_2); block_job_unref(&job->common); } }
[ "void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,\nBlockDriverState *VAR_2, int64_t VAR_3,\nMirrorSyncMode VAR_4, BdrvDirtyBitmap *VAR_5,\nbool VAR_6,\nBlockdevOnError VAR_7,\nBlockdevOnError VAR_8,\nint VAR_9,\nBlockCompletionFunc *VAR_10, void *VAR_11,\nBlockJobTxn *VAR_12, Error **VAR_13)\n{", "int64_t ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [...
26,318
static void restart_co_req(void *opaque) { Coroutine *co = opaque; qemu_coroutine_enter(co, NULL); }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static void restart_co_req(void *opaque) { Coroutine *co = opaque; qemu_coroutine_enter(co, NULL); }
{ "code": [ " qemu_coroutine_enter(co, NULL);", " qemu_coroutine_enter(co, NULL);", " qemu_coroutine_enter(co, NULL);", " qemu_coroutine_enter(co, NULL);", " qemu_coroutine_enter(co, NULL);", " qemu_coroutine_enter(co, NULL);", " qemu_coroutine_enter(co, NULL);" ], "line_no": [ 9, 9, 9, 9, 9, 9, 9 ] }
static void FUNC_0(void *VAR_0) { Coroutine *co = VAR_0; qemu_coroutine_enter(co, NULL); }
[ "static void FUNC_0(void *VAR_0)\n{", "Coroutine *co = VAR_0;", "qemu_coroutine_enter(co, NULL);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
26,319
static void nbd_coroutine_start(NBDClientSession *s, NBDRequest *request) { /* Poor man semaphore. The free_sema is locked when no other request * can be accepted, and unlocked after receiving one reply. */ if (s->in_flight == MAX_NBD_REQUESTS) { qemu_co_queue_wait(&s->free_sema, NULL); assert(s->in_flight < MAX_NBD_REQUESTS); } s->in_flight++; /* s->recv_coroutine[i] is set as soon as we get the send_lock. */ }
true
qemu
6bdcc018a6ed760b9dfe43539124e420aed83092
static void nbd_coroutine_start(NBDClientSession *s, NBDRequest *request) { if (s->in_flight == MAX_NBD_REQUESTS) { qemu_co_queue_wait(&s->free_sema, NULL); assert(s->in_flight < MAX_NBD_REQUESTS); } s->in_flight++; }
{ "code": [ "static void nbd_coroutine_start(NBDClientSession *s,", " NBDRequest *request)", " if (s->in_flight == MAX_NBD_REQUESTS) {", " qemu_co_queue_wait(&s->free_sema, NULL);", " assert(s->in_flight < MAX_NBD_REQUESTS);", " s->in_flight++;" ], "line_no": [ 1, 3, 11, 13, 15, 19 ] }
static void FUNC_0(NBDClientSession *VAR_0, NBDRequest *VAR_1) { if (VAR_0->in_flight == MAX_NBD_REQUESTS) { qemu_co_queue_wait(&VAR_0->free_sema, NULL); assert(VAR_0->in_flight < MAX_NBD_REQUESTS); } VAR_0->in_flight++; }
[ "static void FUNC_0(NBDClientSession *VAR_0,\nNBDRequest *VAR_1)\n{", "if (VAR_0->in_flight == MAX_NBD_REQUESTS) {", "qemu_co_queue_wait(&VAR_0->free_sema, NULL);", "assert(VAR_0->in_flight < MAX_NBD_REQUESTS);", "}", "VAR_0->in_flight++;", "}" ]
[ 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ] ]
26,322
void ff_h264_direct_dist_scale_factor(H264Context *const h) { const int poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD]; const int poc1 = h->ref_list[1][0].poc; int i, field; if (FRAME_MBAFF(h)) for (field = 0; field < 2; field++) { const int poc = h->cur_pic_ptr->field_poc[field]; const int poc1 = h->ref_list[1][0].field_poc[field]; for (i = 0; i < 2 * h->ref_count[0]; i++) h->dist_scale_factor_field[field][i ^ field] = get_scale_factor(h, poc, poc1, i + 16); } for (i = 0; i < h->ref_count[0]; i++) h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i); }
false
FFmpeg
c39059bea3adebcd888571d1181db215eee54495
void ff_h264_direct_dist_scale_factor(H264Context *const h) { const int poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD]; const int poc1 = h->ref_list[1][0].poc; int i, field; if (FRAME_MBAFF(h)) for (field = 0; field < 2; field++) { const int poc = h->cur_pic_ptr->field_poc[field]; const int poc1 = h->ref_list[1][0].field_poc[field]; for (i = 0; i < 2 * h->ref_count[0]; i++) h->dist_scale_factor_field[field][i ^ field] = get_scale_factor(h, poc, poc1, i + 16); } for (i = 0; i < h->ref_count[0]; i++) h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i); }
{ "code": [], "line_no": [] }
void FUNC_0(H264Context *const VAR_0) { const int VAR_5 = VAR_0->cur_pic_ptr->field_poc[VAR_0->picture_structure == PICT_BOTTOM_FIELD]; const int VAR_5 = VAR_0->ref_list[1][0].VAR_5; int VAR_3, VAR_4; if (FRAME_MBAFF(VAR_0)) for (VAR_4 = 0; VAR_4 < 2; VAR_4++) { const int VAR_5 = VAR_0->cur_pic_ptr->field_poc[VAR_4]; const int VAR_5 = VAR_0->ref_list[1][0].field_poc[VAR_4]; for (VAR_3 = 0; VAR_3 < 2 * VAR_0->ref_count[0]; VAR_3++) VAR_0->dist_scale_factor_field[VAR_4][VAR_3 ^ VAR_4] = get_scale_factor(VAR_0, VAR_5, VAR_5, VAR_3 + 16); } for (VAR_3 = 0; VAR_3 < VAR_0->ref_count[0]; VAR_3++) VAR_0->dist_scale_factor[VAR_3] = get_scale_factor(VAR_0, VAR_5, VAR_5, VAR_3); }
[ "void FUNC_0(H264Context *const VAR_0)\n{", "const int VAR_5 = VAR_0->cur_pic_ptr->field_poc[VAR_0->picture_structure == PICT_BOTTOM_FIELD];", "const int VAR_5 = VAR_0->ref_list[1][0].VAR_5;", "int VAR_3, VAR_4;", "if (FRAME_MBAFF(VAR_0))\nfor (VAR_4 = 0; VAR_4 < 2; VAR_4++) {", "const int VAR_5 = VAR_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 ], [ 31 ], [ 33 ], [ 35 ] ]
26,323
static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, QDict *options, int flags, BlockDriver *drv) { int ret, open_flags; const char *filename; assert(drv != NULL); assert(bs->file == NULL); assert(options != NULL && bs->options != options); trace_bdrv_open_common(bs, filename, flags, drv->format_name); if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) { return -ENOTSUP; } /* bdrv_open() with directly using a protocol as drv. This layer is already * opened, so assign it to bs (while file becomes a closed BlockDriverState) * and return immediately. */ if (file != NULL && drv->bdrv_file_open) { bdrv_swap(file, bs); return 0; } bs->open_flags = flags; bs->buffer_alignment = 512; assert(bs->copy_on_read == 0); /* bdrv_new() and bdrv_close() make it so */ if ((flags & BDRV_O_RDWR) && (flags & BDRV_O_COPY_ON_READ)) { bdrv_enable_copy_on_read(bs); } if (file != NULL) { filename = file->filename; } else { filename = qdict_get_try_str(options, "filename"); } if (filename != NULL) { pstrcpy(bs->filename, sizeof(bs->filename), filename); } else { bs->filename[0] = '\0'; } bs->drv = drv; bs->opaque = g_malloc0(drv->instance_size); bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB); open_flags = bdrv_open_flags(bs, flags); bs->read_only = !(open_flags & BDRV_O_RDWR); /* Open the image, either directly or using a protocol */ if (drv->bdrv_file_open) { assert(file == NULL); assert(drv->bdrv_parse_filename || filename != NULL); ret = drv->bdrv_file_open(bs, options, open_flags); } else { if (file == NULL) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a " "block driver for the protocol level", drv->format_name); ret = -EINVAL; goto free_and_fail; } assert(file != NULL); bs->file = file; ret = drv->bdrv_open(bs, options, open_flags); } if (ret < 0) { goto free_and_fail; } ret = refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { goto free_and_fail; } #ifndef _WIN32 if (bs->is_temporary) { assert(filename != NULL); unlink(filename); } #endif return 0; free_and_fail: bs->file = NULL; g_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; }
true
qemu
456736710df19c2275192269fe67a3f0b2583835
static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, QDict *options, int flags, BlockDriver *drv) { int ret, open_flags; const char *filename; assert(drv != NULL); assert(bs->file == NULL); assert(options != NULL && bs->options != options); trace_bdrv_open_common(bs, filename, flags, drv->format_name); if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) { return -ENOTSUP; } if (file != NULL && drv->bdrv_file_open) { bdrv_swap(file, bs); return 0; } bs->open_flags = flags; bs->buffer_alignment = 512; assert(bs->copy_on_read == 0); if ((flags & BDRV_O_RDWR) && (flags & BDRV_O_COPY_ON_READ)) { bdrv_enable_copy_on_read(bs); } if (file != NULL) { filename = file->filename; } else { filename = qdict_get_try_str(options, "filename"); } if (filename != NULL) { pstrcpy(bs->filename, sizeof(bs->filename), filename); } else { bs->filename[0] = '\0'; } bs->drv = drv; bs->opaque = g_malloc0(drv->instance_size); bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB); open_flags = bdrv_open_flags(bs, flags); bs->read_only = !(open_flags & BDRV_O_RDWR); if (drv->bdrv_file_open) { assert(file == NULL); assert(drv->bdrv_parse_filename || filename != NULL); ret = drv->bdrv_file_open(bs, options, open_flags); } else { if (file == NULL) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a " "block driver for the protocol level", drv->format_name); ret = -EINVAL; goto free_and_fail; } assert(file != NULL); bs->file = file; ret = drv->bdrv_open(bs, options, open_flags); } if (ret < 0) { goto free_and_fail; } ret = refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { goto free_and_fail; } #ifndef _WIN32 if (bs->is_temporary) { assert(filename != NULL); unlink(filename); } #endif return 0; free_and_fail: bs->file = NULL; g_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; }
{ "code": [ " trace_bdrv_open_common(bs, filename, flags, drv->format_name);", " if (file != NULL) {", " filename = file->filename;", " } else {", " filename = qdict_get_try_str(options, \"filename\");" ], "line_no": [ 21, 65, 67, 69, 71 ] }
static int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, QDict *VAR_2, int VAR_3, BlockDriver *VAR_4) { int VAR_5, VAR_6; const char *VAR_7; assert(VAR_4 != NULL); assert(VAR_0->VAR_1 == NULL); assert(VAR_2 != NULL && VAR_0->VAR_2 != VAR_2); trace_bdrv_open_common(VAR_0, VAR_7, VAR_3, VAR_4->format_name); if (use_bdrv_whitelist && !bdrv_is_whitelisted(VAR_4)) { return -ENOTSUP; } if (VAR_1 != NULL && VAR_4->bdrv_file_open) { bdrv_swap(VAR_1, VAR_0); return 0; } VAR_0->VAR_6 = VAR_3; VAR_0->buffer_alignment = 512; assert(VAR_0->copy_on_read == 0); if ((VAR_3 & BDRV_O_RDWR) && (VAR_3 & BDRV_O_COPY_ON_READ)) { bdrv_enable_copy_on_read(VAR_0); } if (VAR_1 != NULL) { VAR_7 = VAR_1->VAR_7; } else { VAR_7 = qdict_get_try_str(VAR_2, "VAR_7"); } if (VAR_7 != NULL) { pstrcpy(VAR_0->VAR_7, sizeof(VAR_0->VAR_7), VAR_7); } else { VAR_0->VAR_7[0] = '\0'; } VAR_0->VAR_4 = VAR_4; VAR_0->opaque = g_malloc0(VAR_4->instance_size); VAR_0->enable_write_cache = !!(VAR_3 & BDRV_O_CACHE_WB); VAR_6 = bdrv_open_flags(VAR_0, VAR_3); VAR_0->read_only = !(VAR_6 & BDRV_O_RDWR); if (VAR_4->bdrv_file_open) { assert(VAR_1 == NULL); assert(VAR_4->bdrv_parse_filename || VAR_7 != NULL); VAR_5 = VAR_4->bdrv_file_open(VAR_0, VAR_2, VAR_6); } else { if (VAR_1 == NULL) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a " "block driver for the protocol level", VAR_4->format_name); VAR_5 = -EINVAL; goto free_and_fail; } assert(VAR_1 != NULL); VAR_0->VAR_1 = VAR_1; VAR_5 = VAR_4->bdrv_open(VAR_0, VAR_2, VAR_6); } if (VAR_5 < 0) { goto free_and_fail; } VAR_5 = refresh_total_sectors(VAR_0, VAR_0->total_sectors); if (VAR_5 < 0) { goto free_and_fail; } #ifndef _WIN32 if (VAR_0->is_temporary) { assert(VAR_7 != NULL); unlink(VAR_7); } #endif return 0; free_and_fail: VAR_0->VAR_1 = NULL; g_free(VAR_0->opaque); VAR_0->opaque = NULL; VAR_0->VAR_4 = NULL; return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,\nQDict *VAR_2, int VAR_3, BlockDriver *VAR_4)\n{", "int VAR_5, VAR_6;", "const char *VAR_7;", "assert(VAR_4 != NULL);", "assert(VAR_0->VAR_1 == NULL);", "assert(VAR_2 != NULL && VAR_0->VAR_2 != VAR_2);", "trace_bdrv_open_common(VAR_0, ...
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [...
26,324
static int qcow2_open(BlockDriverState *bs, int flags) { BDRVQcowState *s = bs->opaque; int len, i, ret = 0; QCowHeader header; uint64_t ext_end; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { ret = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { report_unsupported(bs, "QCOW version %d", header.version); ret = -ENOTSUP; goto fail; } s->qcow_version = header.version; /* Initialise version 3 header fields */ if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { goto fail; } } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } /* Handle feature bits */ s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features != 0) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table); report_unsupported_feature(bs, feature_table, s->incompatible_features); ret = -ENOTSUP; goto fail; } /* Check support for various header values */ if (header.refcount_order != 4) { report_unsupported(bs, "%d bit reference counts", 1 << header.refcount_order); ret = -ENOTSUP; goto fail; } if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { ret = -EINVAL; goto fail; } if (header.crypt_method > QCOW_CRYPT_AES) { ret = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { bs->encrypted = 1; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */ s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; /* read the level 1 table */ s->l1_size = header.l1_size; s->l1_vm_state_index = size_to_l1(s, header.size); /* the L1 table must contain at least enough entries to put header.size bytes */ if (s->l1_size < s->l1_vm_state_index) { ret = -EINVAL; goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { goto fail; } for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } } /* alloc L2 table/refcount block cache */ s->l2_table_cache = qcow2_cache_create(bs, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(bs, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); /* one more sector for decompressed data alignment */ s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { goto fail; } QLIST_INIT(&s->cluster_allocs); /* read qcow2 extensions */ if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL)) { ret = -EINVAL; goto fail; } /* read the backing file name */ if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) { len = 1023; } ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { goto fail; } bs->backing_file[len] = '\0'; } ret = qcow2_read_snapshots(bs); if (ret < 0) { goto fail; } /* Clear unknown autoclear feature bits */ if (!bs->read_only && s->autoclear_features != 0) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { goto fail; } } /* Initialise locks */ qemu_co_mutex_init(&s->lock); #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result); } #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); g_free(s->l1_table); if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return ret; }
true
qemu
b35278f75450e57c134a153e6da9744c1db8382f
static int qcow2_open(BlockDriverState *bs, int flags) { BDRVQcowState *s = bs->opaque; int len, i, ret = 0; QCowHeader header; uint64_t ext_end; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { ret = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { report_unsupported(bs, "QCOW version %d", header.version); ret = -ENOTSUP; goto fail; } s->qcow_version = header.version; if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { goto fail; } } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features != 0) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table); report_unsupported_feature(bs, feature_table, s->incompatible_features); ret = -ENOTSUP; goto fail; } if (header.refcount_order != 4) { report_unsupported(bs, "%d bit reference counts", 1 << header.refcount_order); ret = -ENOTSUP; goto fail; } if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { ret = -EINVAL; goto fail; } if (header.crypt_method > QCOW_CRYPT_AES) { ret = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { bs->encrypted = 1; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; s->l1_size = header.l1_size; s->l1_vm_state_index = size_to_l1(s, header.size); if (s->l1_size < s->l1_vm_state_index) { ret = -EINVAL; goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { goto fail; } for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } } s->l2_table_cache = qcow2_cache_create(bs, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(bs, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { goto fail; } QLIST_INIT(&s->cluster_allocs); if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL)) { ret = -EINVAL; goto fail; } if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) { len = 1023; } ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { goto fail; } bs->backing_file[len] = '\0'; } ret = qcow2_read_snapshots(bs); if (ret < 0) { goto fail; } if (!bs->read_only && s->autoclear_features != 0) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { goto fail; } } qemu_co_mutex_init(&s->lock); #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result); } #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); g_free(s->l1_table); if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return ret; }
{ "code": [ " qcow2_check_refcounts(bs, &result);", " qcow2_check_refcounts(bs, &result);", " qcow2_check_refcounts(bs, &result);" ], "line_no": [ 403, 403, 403 ] }
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1) { BDRVQcowState *s = VAR_0->opaque; int VAR_2, VAR_3, VAR_4 = 0; QCowHeader header; uint64_t ext_end; VAR_4 = bdrv_pread(VAR_0->file, 0, &header, sizeof(header)); if (VAR_4 < 0) { goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { VAR_4 = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { report_unsupported(VAR_0, "QCOW version %d", header.version); VAR_4 = -ENOTSUP; goto fail; } s->qcow_version = header.version; if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); VAR_4 = bdrv_pread(VAR_0->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (VAR_4 < 0) { goto fail; } } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features != 0) { void *VAR_5 = NULL; qcow2_read_extensions(VAR_0, header.header_length, ext_end, &VAR_5); report_unsupported_feature(VAR_0, VAR_5, s->incompatible_features); VAR_4 = -ENOTSUP; goto fail; } if (header.refcount_order != 4) { report_unsupported(VAR_0, "%d bit reference counts", 1 << header.refcount_order); VAR_4 = -ENOTSUP; goto fail; } if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { VAR_4 = -EINVAL; goto fail; } if (header.crypt_method > QCOW_CRYPT_AES) { VAR_4 = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { VAR_0->encrypted = 1; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; VAR_0->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; s->l1_size = header.l1_size; s->l1_vm_state_index = size_to_l1(s, header.size); if (s->l1_size < s->l1_vm_state_index) { VAR_4 = -EINVAL; goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); VAR_4 = bdrv_pread(VAR_0->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (VAR_4 < 0) { goto fail; } for(VAR_3 = 0;VAR_3 < s->l1_size; VAR_3++) { be64_to_cpus(&s->l1_table[VAR_3]); } } s->l2_table_cache = qcow2_cache_create(VAR_0, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(VAR_0, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); s->cluster_data = qemu_blockalign(VAR_0, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->VAR_1 = VAR_1; VAR_4 = qcow2_refcount_init(VAR_0); if (VAR_4 != 0) { goto fail; } QLIST_INIT(&s->cluster_allocs); if (qcow2_read_extensions(VAR_0, header.header_length, ext_end, NULL)) { VAR_4 = -EINVAL; goto fail; } if (header.backing_file_offset != 0) { VAR_2 = header.backing_file_size; if (VAR_2 > 1023) { VAR_2 = 1023; } VAR_4 = bdrv_pread(VAR_0->file, header.backing_file_offset, VAR_0->backing_file, VAR_2); if (VAR_4 < 0) { goto fail; } VAR_0->backing_file[VAR_2] = '\0'; } VAR_4 = qcow2_read_snapshots(VAR_0); if (VAR_4 < 0) { goto fail; } if (!VAR_0->read_only && s->autoclear_features != 0) { s->autoclear_features = 0; VAR_4 = qcow2_update_header(VAR_0); if (VAR_4 < 0) { goto fail; } } qemu_co_mutex_init(&s->lock); #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(VAR_0, &result); } #endif return VAR_4; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(VAR_0); qcow2_free_snapshots(VAR_0); qcow2_refcount_close(VAR_0); g_free(s->l1_table); if (s->l2_table_cache) { qcow2_cache_destroy(VAR_0, s->l2_table_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return VAR_4; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int VAR_1)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_2, VAR_3, VAR_4 = 0;", "QCowHeader header;", "uint64_t ext_end;", "VAR_4 = bdrv_pread(VAR_0->file, 0, &header, sizeof(header));", "if (VAR_4 < 0) {", "goto fail;", "}", "be32_to_cpus(&header.m...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ...
26,325
static int read_packet(AVFormatContext *s, AVPacket *pkt) { PAFDemuxContext *p = s->priv_data; AVIOContext *pb = s->pb; uint32_t count, offset; int size, i; if (p->current_frame >= p->nb_frames) return AVERROR_EOF; if (url_feof(pb)) return AVERROR_EOF; if (p->got_audio) { if (av_new_packet(pkt, p->audio_size) < 0) return AVERROR(ENOMEM); memcpy(pkt->data, p->temp_audio_frame, p->audio_size); pkt->duration = PAF_SOUND_SAMPLES * (p->audio_size / PAF_SOUND_FRAME_SIZE); pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 1; p->got_audio = 0; return pkt->size; } count = (p->current_frame == 0) ? p->preload_count : p->blocks_count_table[p->current_frame - 1]; for (i = 0; i < count; i++) { if (p->current_frame_block >= p->frame_blks) return AVERROR_INVALIDDATA; offset = p->blocks_offset_table[p->current_frame_block] & ~(1U << 31); if (p->blocks_offset_table[p->current_frame_block] & (1U << 31)) { if (offset > p->audio_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->audio_frame + offset, p->buffer_size); if (offset == (p->max_audio_blks - 2) * p->buffer_size) { memcpy(p->temp_audio_frame, p->audio_frame, p->audio_size); p->got_audio = 1; } } else { if (offset > p->video_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->video_frame + offset, p->buffer_size); } p->current_frame_block++; } size = p->video_size - p->frames_offset_table[p->current_frame]; if (size < 1) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); pkt->stream_index = 0; pkt->duration = 1; memcpy(pkt->data, p->video_frame + p->frames_offset_table[p->current_frame], size); if (pkt->data[0] & 0x20) pkt->flags |= AV_PKT_FLAG_KEY; p->current_frame++; return pkt->size; }
true
FFmpeg
f58cd2867a8af2eed13acdd21d067b48249b14a1
static int read_packet(AVFormatContext *s, AVPacket *pkt) { PAFDemuxContext *p = s->priv_data; AVIOContext *pb = s->pb; uint32_t count, offset; int size, i; if (p->current_frame >= p->nb_frames) return AVERROR_EOF; if (url_feof(pb)) return AVERROR_EOF; if (p->got_audio) { if (av_new_packet(pkt, p->audio_size) < 0) return AVERROR(ENOMEM); memcpy(pkt->data, p->temp_audio_frame, p->audio_size); pkt->duration = PAF_SOUND_SAMPLES * (p->audio_size / PAF_SOUND_FRAME_SIZE); pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 1; p->got_audio = 0; return pkt->size; } count = (p->current_frame == 0) ? p->preload_count : p->blocks_count_table[p->current_frame - 1]; for (i = 0; i < count; i++) { if (p->current_frame_block >= p->frame_blks) return AVERROR_INVALIDDATA; offset = p->blocks_offset_table[p->current_frame_block] & ~(1U << 31); if (p->blocks_offset_table[p->current_frame_block] & (1U << 31)) { if (offset > p->audio_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->audio_frame + offset, p->buffer_size); if (offset == (p->max_audio_blks - 2) * p->buffer_size) { memcpy(p->temp_audio_frame, p->audio_frame, p->audio_size); p->got_audio = 1; } } else { if (offset > p->video_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->video_frame + offset, p->buffer_size); } p->current_frame_block++; } size = p->video_size - p->frames_offset_table[p->current_frame]; if (size < 1) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); pkt->stream_index = 0; pkt->duration = 1; memcpy(pkt->data, p->video_frame + p->frames_offset_table[p->current_frame], size); if (pkt->data[0] & 0x20) pkt->flags |= AV_PKT_FLAG_KEY; p->current_frame++; return pkt->size; }
{ "code": [ " size = p->video_size - p->frames_offset_table[p->current_frame];", " if (size < 1)" ], "line_no": [ 99, 101 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { PAFDemuxContext *p = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; uint32_t count, offset; int VAR_2, VAR_3; if (p->current_frame >= p->nb_frames) return AVERROR_EOF; if (url_feof(pb)) return AVERROR_EOF; if (p->got_audio) { if (av_new_packet(VAR_1, p->audio_size) < 0) return AVERROR(ENOMEM); memcpy(VAR_1->data, p->temp_audio_frame, p->audio_size); VAR_1->duration = PAF_SOUND_SAMPLES * (p->audio_size / PAF_SOUND_FRAME_SIZE); VAR_1->flags |= AV_PKT_FLAG_KEY; VAR_1->stream_index = 1; p->got_audio = 0; return VAR_1->VAR_2; } count = (p->current_frame == 0) ? p->preload_count : p->blocks_count_table[p->current_frame - 1]; for (VAR_3 = 0; VAR_3 < count; VAR_3++) { if (p->current_frame_block >= p->frame_blks) return AVERROR_INVALIDDATA; offset = p->blocks_offset_table[p->current_frame_block] & ~(1U << 31); if (p->blocks_offset_table[p->current_frame_block] & (1U << 31)) { if (offset > p->audio_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->audio_frame + offset, p->buffer_size); if (offset == (p->max_audio_blks - 2) * p->buffer_size) { memcpy(p->temp_audio_frame, p->audio_frame, p->audio_size); p->got_audio = 1; } } else { if (offset > p->video_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->video_frame + offset, p->buffer_size); } p->current_frame_block++; } VAR_2 = p->video_size - p->frames_offset_table[p->current_frame]; if (VAR_2 < 1) return AVERROR_INVALIDDATA; if (av_new_packet(VAR_1, VAR_2) < 0) return AVERROR(ENOMEM); VAR_1->stream_index = 0; VAR_1->duration = 1; memcpy(VAR_1->data, p->video_frame + p->frames_offset_table[p->current_frame], VAR_2); if (VAR_1->data[0] & 0x20) VAR_1->flags |= AV_PKT_FLAG_KEY; p->current_frame++; return VAR_1->VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "PAFDemuxContext *p = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "uint32_t count, offset;", "int VAR_2, VAR_3;", "if (p->current_frame >= p->nb_frames)\nreturn AVERROR_EOF;", "if (url_feof(pb))\nreturn AVERR...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21, 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [...
26,326
char *target_strerror(int err) { return strerror(target_to_host_errno(err));
true
qemu
962b289ef35087fcd8764e4e29808d8ac90157f7
char *target_strerror(int err) { return strerror(target_to_host_errno(err));
{ "code": [], "line_no": [] }
char *FUNC_0(int VAR_0) { return strerror(target_to_host_errno(VAR_0));
[ "char *FUNC_0(int VAR_0)\n{", "return strerror(target_to_host_errno(VAR_0));" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 8 ] ]
26,327
AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size) { AVFormatContext *rtpctx; int ret; AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); if (!rtp_format) return NULL; /* Allocate an AVFormatContext for each output stream */ rtpctx = avformat_alloc_context(); if (!rtpctx) return NULL; rtpctx->oformat = rtp_format; if (!av_new_stream(rtpctx, 0)) { av_free(rtpctx); return NULL; } /* Copy the max delay setting; the rtp muxer reads this. */ rtpctx->max_delay = s->max_delay; /* Copy other stream parameters. */ rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; /* Set the synchronized start time. */ rtpctx->start_time_realtime = s->start_time_realtime; /* Remove the local codec, link to the original codec * context instead, to give the rtp muxer access to * codec parameters. */ av_free(rtpctx->streams[0]->codec); rtpctx->streams[0]->codec = st->codec; if (handle) { url_fdopen(&rtpctx->pb, handle); } else url_open_dyn_packet_buf(&rtpctx->pb, packet_size); ret = av_write_header(rtpctx); if (ret) { if (handle) { url_fclose(rtpctx->pb); } else { uint8_t *ptr; url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } av_free(rtpctx->streams[0]); av_free(rtpctx); return NULL; } /* Copy the RTP AVStream timebase back to the original AVStream */ st->time_base = rtpctx->streams[0]->time_base; return rtpctx; }
true
FFmpeg
ce41c51b0c71c87f623914ba0786aef325d818fe
AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size) { AVFormatContext *rtpctx; int ret; AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); if (!rtp_format) return NULL; rtpctx = avformat_alloc_context(); if (!rtpctx) return NULL; rtpctx->oformat = rtp_format; if (!av_new_stream(rtpctx, 0)) { av_free(rtpctx); return NULL; } rtpctx->max_delay = s->max_delay; rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; rtpctx->start_time_realtime = s->start_time_realtime; av_free(rtpctx->streams[0]->codec); rtpctx->streams[0]->codec = st->codec; if (handle) { url_fdopen(&rtpctx->pb, handle); } else url_open_dyn_packet_buf(&rtpctx->pb, packet_size); ret = av_write_header(rtpctx); if (ret) { if (handle) { url_fclose(rtpctx->pb); } else { uint8_t *ptr; url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } av_free(rtpctx->streams[0]); av_free(rtpctx); return NULL; } st->time_base = rtpctx->streams[0]->time_base; return rtpctx; }
{ "code": [], "line_no": [] }
AVFormatContext *FUNC_0(AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size) { AVFormatContext *rtpctx; int VAR_0; AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); if (!rtp_format) return NULL; rtpctx = avformat_alloc_context(); if (!rtpctx) return NULL; rtpctx->oformat = rtp_format; if (!av_new_stream(rtpctx, 0)) { av_free(rtpctx); return NULL; } rtpctx->max_delay = s->max_delay; rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; rtpctx->start_time_realtime = s->start_time_realtime; av_free(rtpctx->streams[0]->codec); rtpctx->streams[0]->codec = st->codec; if (handle) { url_fdopen(&rtpctx->pb, handle); } else url_open_dyn_packet_buf(&rtpctx->pb, packet_size); VAR_0 = av_write_header(rtpctx); if (VAR_0) { if (handle) { url_fclose(rtpctx->pb); } else { uint8_t *ptr; url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } av_free(rtpctx->streams[0]); av_free(rtpctx); return NULL; } st->time_base = rtpctx->streams[0]->time_base; return rtpctx; }
[ "AVFormatContext *FUNC_0(AVFormatContext *s, AVStream *st,\nURLContext *handle, int packet_size)\n{", "AVFormatContext *rtpctx;", "int VAR_0;", "AVOutputFormat *rtp_format = av_guess_format(\"rtp\", NULL, NULL);", "if (!rtp_format)\nreturn NULL;", "rtpctx = avformat_alloc_context();", "if (!rtpctx)\nret...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 53 ], [ 63 ], [ 65 ], [ 69 ], [...
26,328
static int pci_cirrus_vga_initfn(PCIDevice *dev) { PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev); CirrusVGAState *s = &d->cirrus_vga; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); int16_t device_id = pc->device_id; /* setup VGA */ vga_common_init(&s->vga, OBJECT(dev), true); cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev), pci_address_space_io(dev)); s->vga.con = graphic_console_init(DEVICE(dev), 0, s->vga.hw_ops, &s->vga); /* setup PCI */ memory_region_init(&s->pci_bar, OBJECT(dev), "cirrus-pci-bar0", 0x2000000); /* XXX: add byte swapping apertures */ memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io); memory_region_add_subregion(&s->pci_bar, 0x1000000, &s->cirrus_linear_bitblt_io); /* setup memory space */ /* memory #0 LFB */ /* memory #1 memory-mapped I/O */ /* XXX: s->vga.vram_size must be a power of two */ pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io); return 0;
true
qemu
f61d82c2dfe02a60642a76e8f0034a0244eef2bf
static int pci_cirrus_vga_initfn(PCIDevice *dev) { PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev); CirrusVGAState *s = &d->cirrus_vga; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); int16_t device_id = pc->device_id; vga_common_init(&s->vga, OBJECT(dev), true); cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev), pci_address_space_io(dev)); s->vga.con = graphic_console_init(DEVICE(dev), 0, s->vga.hw_ops, &s->vga); memory_region_init(&s->pci_bar, OBJECT(dev), "cirrus-pci-bar0", 0x2000000); memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io); memory_region_add_subregion(&s->pci_bar, 0x1000000, &s->cirrus_linear_bitblt_io); pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, VAR_0, VAR_0); CirrusVGAState *s = &d->cirrus_vga; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(VAR_0); int16_t device_id = pc->device_id; vga_common_init(&s->vga, OBJECT(VAR_0), true); cirrus_init_common(s, OBJECT(VAR_0), device_id, 1, pci_address_space(VAR_0), pci_address_space_io(VAR_0)); s->vga.con = graphic_console_init(DEVICE(VAR_0), 0, s->vga.hw_ops, &s->vga); memory_region_init(&s->pci_bar, OBJECT(VAR_0), "cirrus-pci-bar0", 0x2000000); memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io); memory_region_add_subregion(&s->pci_bar, 0x1000000, &s->cirrus_linear_bitblt_io); pci_register_bar(&d->VAR_0, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_bar(&d->VAR_0, 1, 0, &s->cirrus_mmio_io); return 0;
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, VAR_0, VAR_0);", "CirrusVGAState *s = &d->cirrus_vga;", "PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(VAR_0);", "int16_t device_id = pc->device_id;", "vga_common_init(&s->vga, OBJECT(VAR_0), true);", "cirrus_init...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 39 ], [ 45 ], [ 47, 49 ], [ 61 ], [ 63 ], [ 65 ], [ 68 ] ]
26,329
static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, int read_all) { RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; char buf[256]; uint32_t version; int i; /* ra type header */ version = get_be32(pb); /* version */ if (((version >> 16) & 0xff) == 3) { int64_t startpos = url_ftell(pb); /* very old version */ for(i = 0; i < 14; i++) get_byte(pb); get_str8(pb, s->title, sizeof(s->title)); get_str8(pb, s->author, sizeof(s->author)); get_str8(pb, s->copyright, sizeof(s->copyright)); get_str8(pb, s->comment, sizeof(s->comment)); if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) { // fourcc (should always be "lpcJ") get_byte(pb); get_str8(pb, buf, sizeof(buf)); // Skip extra header crap (this should never happen) if ((startpos + (version & 0xffff)) > url_ftell(pb)) url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb)); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_RA_144; } else { int flavor, sub_packet_h, coded_framesize, sub_packet_size; /* old version (4) */ get_be32(pb); /* .ra4 */ get_be32(pb); /* data size */ get_be16(pb); /* version2 */ get_be32(pb); /* header size */ flavor= get_be16(pb); /* add codec info / flavor */ rm->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */ get_be32(pb); /* ??? */ get_be32(pb); /* ??? */ get_be32(pb); /* ??? */ rm->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */ st->codec->block_align= get_be16(pb); /* frame size */ rm->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */ get_be16(pb); /* ??? */ if (((version >> 16) & 0xff) == 5) { get_be16(pb); get_be16(pb); get_be16(pb); } st->codec->sample_rate = get_be16(pb); get_be32(pb); st->codec->channels = get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be32(pb); buf[0] = get_byte(pb); buf[1] = get_byte(pb); buf[2] = get_byte(pb); buf[3] = get_byte(pb); buf[4] = 0; } else { get_str8(pb, buf, sizeof(buf)); /* desc */ get_str8(pb, buf, sizeof(buf)); /* desc */ st->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(buf, "dnet")) { st->codec->codec_id = CODEC_ID_AC3; } else if (!strcmp(buf, "28_8")) { st->codec->codec_id = CODEC_ID_RA_288; st->codec->extradata_size= 0; rm->audio_framesize = st->codec->block_align; st->codec->block_align = coded_framesize; rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); } else if (!strcmp(buf, "cook")) { int codecdata_length, i; get_be16(pb); get_byte(pb); if (((version >> 16) & 0xff) == 5) get_byte(pb); codecdata_length = get_be32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); st->codec->codec_id = CODEC_ID_COOK; st->codec->extradata_size= codecdata_length; st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i = 0; i < codecdata_length; i++) ((uint8_t*)st->codec->extradata)[i] = get_byte(pb); rm->audio_framesize = st->codec->block_align; st->codec->block_align = rm->sub_packet_size; rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); } else { st->codec->codec_id = CODEC_ID_NONE; pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name), buf); if (read_all) { get_byte(pb); get_byte(pb); get_byte(pb); get_str8(pb, s->title, sizeof(s->title)); get_str8(pb, s->author, sizeof(s->author)); get_str8(pb, s->copyright, sizeof(s->copyright)); get_str8(pb, s->comment, sizeof(s->comment));
true
FFmpeg
a443a2530d00b7019269202ac0f5ca8ba0a021c7
static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, int read_all) { RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; char buf[256]; uint32_t version; int i; version = get_be32(pb); if (((version >> 16) & 0xff) == 3) { int64_t startpos = url_ftell(pb); for(i = 0; i < 14; i++) get_byte(pb); get_str8(pb, s->title, sizeof(s->title)); get_str8(pb, s->author, sizeof(s->author)); get_str8(pb, s->copyright, sizeof(s->copyright)); get_str8(pb, s->comment, sizeof(s->comment)); if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) { get_byte(pb); get_str8(pb, buf, sizeof(buf)); if ((startpos + (version & 0xffff)) > url_ftell(pb)) url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb)); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_RA_144; } else { int flavor, sub_packet_h, coded_framesize, sub_packet_size; get_be32(pb); get_be32(pb); get_be16(pb); get_be32(pb); flavor= get_be16(pb); rm->coded_framesize = coded_framesize = get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); rm->sub_packet_h = sub_packet_h = get_be16(pb); st->codec->block_align= get_be16(pb); rm->sub_packet_size = sub_packet_size = get_be16(pb); get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be16(pb); get_be16(pb); get_be16(pb); } st->codec->sample_rate = get_be16(pb); get_be32(pb); st->codec->channels = get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be32(pb); buf[0] = get_byte(pb); buf[1] = get_byte(pb); buf[2] = get_byte(pb); buf[3] = get_byte(pb); buf[4] = 0; } else { get_str8(pb, buf, sizeof(buf)); get_str8(pb, buf, sizeof(buf)); st->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(buf, "dnet")) { st->codec->codec_id = CODEC_ID_AC3; } else if (!strcmp(buf, "28_8")) { st->codec->codec_id = CODEC_ID_RA_288; st->codec->extradata_size= 0; rm->audio_framesize = st->codec->block_align; st->codec->block_align = coded_framesize; rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); } else if (!strcmp(buf, "cook")) { int codecdata_length, i; get_be16(pb); get_byte(pb); if (((version >> 16) & 0xff) == 5) get_byte(pb); codecdata_length = get_be32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); st->codec->codec_id = CODEC_ID_COOK; st->codec->extradata_size= codecdata_length; st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i = 0; i < codecdata_length; i++) ((uint8_t*)st->codec->extradata)[i] = get_byte(pb); rm->audio_framesize = st->codec->block_align; st->codec->block_align = rm->sub_packet_size; rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); } else { st->codec->codec_id = CODEC_ID_NONE; pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name), buf); if (read_all) { get_byte(pb); get_byte(pb); get_byte(pb); get_str8(pb, s->title, sizeof(s->title)); get_str8(pb, s->author, sizeof(s->author)); get_str8(pb, s->copyright, sizeof(s->copyright)); get_str8(pb, s->comment, sizeof(s->comment));
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, int VAR_2) { RMContext *rm = VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; char VAR_3[256]; uint32_t version; int VAR_10; version = get_be32(pb); if (((version >> 16) & 0xff) == 3) { int64_t startpos = url_ftell(pb); for(VAR_10 = 0; VAR_10 < 14; VAR_10++) get_byte(pb); get_str8(pb, VAR_0->title, sizeof(VAR_0->title)); get_str8(pb, VAR_0->author, sizeof(VAR_0->author)); get_str8(pb, VAR_0->copyright, sizeof(VAR_0->copyright)); get_str8(pb, VAR_0->comment, sizeof(VAR_0->comment)); if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) { get_byte(pb); get_str8(pb, VAR_3, sizeof(VAR_3)); if ((startpos + (version & 0xffff)) > url_ftell(pb)) url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb)); VAR_1->codec->sample_rate = 8000; VAR_1->codec->channels = 1; VAR_1->codec->codec_type = CODEC_TYPE_AUDIO; VAR_1->codec->codec_id = CODEC_ID_RA_144; } else { int VAR_5, VAR_6, VAR_7, VAR_8; get_be32(pb); get_be32(pb); get_be16(pb); get_be32(pb); VAR_5= get_be16(pb); rm->VAR_7 = VAR_7 = get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); rm->VAR_6 = VAR_6 = get_be16(pb); VAR_1->codec->block_align= get_be16(pb); rm->VAR_8 = VAR_8 = get_be16(pb); get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be16(pb); get_be16(pb); get_be16(pb); } VAR_1->codec->sample_rate = get_be16(pb); get_be32(pb); VAR_1->codec->channels = get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be32(pb); VAR_3[0] = get_byte(pb); VAR_3[1] = get_byte(pb); VAR_3[2] = get_byte(pb); VAR_3[3] = get_byte(pb); VAR_3[4] = 0; } else { get_str8(pb, VAR_3, sizeof(VAR_3)); get_str8(pb, VAR_3, sizeof(VAR_3)); VAR_1->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(VAR_3, "dnet")) { VAR_1->codec->codec_id = CODEC_ID_AC3; } else if (!strcmp(VAR_3, "28_8")) { VAR_1->codec->codec_id = CODEC_ID_RA_288; VAR_1->codec->extradata_size= 0; rm->audio_framesize = VAR_1->codec->block_align; VAR_1->codec->block_align = VAR_7; rm->audiobuf = av_malloc(rm->audio_framesize * VAR_6); } else if (!strcmp(VAR_3, "cook")) { int VAR_9, VAR_10; get_be16(pb); get_byte(pb); if (((version >> 16) & 0xff) == 5) get_byte(pb); VAR_9 = get_be32(pb); if(VAR_9 + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)VAR_9){ av_log(VAR_0, AV_LOG_ERROR, "VAR_9 too large\n"); VAR_1->codec->codec_id = CODEC_ID_COOK; VAR_1->codec->extradata_size= VAR_9; VAR_1->codec->extradata= av_mallocz(VAR_1->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); for(VAR_10 = 0; VAR_10 < VAR_9; VAR_10++) ((uint8_t*)VAR_1->codec->extradata)[VAR_10] = get_byte(pb); rm->audio_framesize = VAR_1->codec->block_align; VAR_1->codec->block_align = rm->VAR_8; rm->audiobuf = av_malloc(rm->audio_framesize * VAR_6); } else { VAR_1->codec->codec_id = CODEC_ID_NONE; pstrcpy(VAR_1->codec->codec_name, sizeof(VAR_1->codec->codec_name), VAR_3); if (VAR_2) { get_byte(pb); get_byte(pb); get_byte(pb); get_str8(pb, VAR_0->title, sizeof(VAR_0->title)); get_str8(pb, VAR_0->author, sizeof(VAR_0->author)); get_str8(pb, VAR_0->copyright, sizeof(VAR_0->copyright)); get_str8(pb, VAR_0->comment, sizeof(VAR_0->comment));
[ "static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,\nint VAR_2)\n{", "RMContext *rm = VAR_0->priv_data;", "ByteIOContext *pb = &VAR_0->pb;", "char VAR_3[256];", "uint32_t version;", "int VAR_10;", "version = get_be32(pb);", "if (((version >> 16) & 0xff) == 3) {", "int64_t startpos = url_fte...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 10 ], [ 11 ], [ 12 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 22 ], [ 23 ], [ 25, 26 ]...
26,332
static int vc1test_write_header(AVFormatContext *s) { AVCodecContext *avc = s->streams[0]->codec; AVIOContext *pb = s->pb; if (avc->codec_id != CODEC_ID_WMV3) { av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); return -1; } avio_wl24(pb, 0); //frames count will be here avio_w8(pb, 0xC5); avio_wl32(pb, 4); avio_write(pb, avc->extradata, 4); avio_wl32(pb, avc->height); avio_wl32(pb, avc->width); avio_wl32(pb, 0xC); avio_wl24(pb, 0); // hrd_buffer avio_w8(pb, 0x80); // level|cbr|res1 avio_wl32(pb, 0); // hrd_rate if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1) avio_wl32(pb, s->streams[0]->r_frame_rate.den); else avio_wl32(pb, 0xFFFFFFFF); //variable framerate avpriv_set_pts_info(s->streams[0], 32, 1, 1000); return 0; }
true
FFmpeg
aba232cfa9b193604ed98f3fa505378d006b1b3b
static int vc1test_write_header(AVFormatContext *s) { AVCodecContext *avc = s->streams[0]->codec; AVIOContext *pb = s->pb; if (avc->codec_id != CODEC_ID_WMV3) { av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); return -1; } avio_wl24(pb, 0); avio_w8(pb, 0xC5); avio_wl32(pb, 4); avio_write(pb, avc->extradata, 4); avio_wl32(pb, avc->height); avio_wl32(pb, avc->width); avio_wl32(pb, 0xC); avio_wl24(pb, 0); avio_w8(pb, 0x80); avio_wl32(pb, 0); if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1) avio_wl32(pb, s->streams[0]->r_frame_rate.den); else avio_wl32(pb, 0xFFFFFFFF); avpriv_set_pts_info(s->streams[0], 32, 1, 1000); return 0; }
{ "code": [ " if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1)", " avio_wl32(pb, s->streams[0]->r_frame_rate.den);" ], "line_no": [ 39, 41 ] }
static int FUNC_0(AVFormatContext *VAR_0) { AVCodecContext *avc = VAR_0->streams[0]->codec; AVIOContext *pb = VAR_0->pb; if (avc->codec_id != CODEC_ID_WMV3) { av_log(VAR_0, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); return -1; } avio_wl24(pb, 0); avio_w8(pb, 0xC5); avio_wl32(pb, 4); avio_write(pb, avc->extradata, 4); avio_wl32(pb, avc->height); avio_wl32(pb, avc->width); avio_wl32(pb, 0xC); avio_wl24(pb, 0); avio_w8(pb, 0x80); avio_wl32(pb, 0); if (VAR_0->streams[0]->r_frame_rate.den && VAR_0->streams[0]->r_frame_rate.num == 1) avio_wl32(pb, VAR_0->streams[0]->r_frame_rate.den); else avio_wl32(pb, 0xFFFFFFFF); avpriv_set_pts_info(VAR_0->streams[0], 32, 1, 1000); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVCodecContext *avc = VAR_0->streams[0]->codec;", "AVIOContext *pb = VAR_0->pb;", "if (avc->codec_id != CODEC_ID_WMV3) {", "av_log(VAR_0, AV_LOG_ERROR, \"Only WMV3 is accepted!\\n\");", "return -1;", "}", "avio_wl24(pb, 0);", "avio_w8(pb, 0xC5);", "...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45...
26,334
static int caca_write_trailer(AVFormatContext *s) { CACAContext *c = s->priv_data; av_freep(&c->window_title); caca_free_dither(c->dither); caca_free_display(c->display); caca_free_canvas(c->canvas); return 0; }
true
FFmpeg
c0b91348fe4aec7d2245d95ccabb460a6971e361
static int caca_write_trailer(AVFormatContext *s) { CACAContext *c = s->priv_data; av_freep(&c->window_title); caca_free_dither(c->dither); caca_free_display(c->display); caca_free_canvas(c->canvas); return 0; }
{ "code": [ " caca_free_dither(c->dither);", " caca_free_display(c->display);", " caca_free_canvas(c->canvas);" ], "line_no": [ 13, 15, 17 ] }
static int FUNC_0(AVFormatContext *VAR_0) { CACAContext *c = VAR_0->priv_data; av_freep(&c->window_title); caca_free_dither(c->dither); caca_free_display(c->display); caca_free_canvas(c->canvas); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "CACAContext *c = VAR_0->priv_data;", "av_freep(&c->window_title);", "caca_free_dither(c->dither);", "caca_free_display(c->display);", "caca_free_canvas(c->canvas);", "return 0;", "}" ]
[ 0, 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,335
static void dec_null(DisasContext *dc) { qemu_log ("unknown insn pc=%x opc=%x\n", dc->pc, dc->opcode); dc->abort_at_next_insn = 1;
true
qemu
02b33596d09bafed5d58366403a2d369f0d1047e
static void dec_null(DisasContext *dc) { qemu_log ("unknown insn pc=%x opc=%x\n", dc->pc, dc->opcode); dc->abort_at_next_insn = 1;
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { qemu_log ("unknown insn pc=%x opc=%x\n", VAR_0->pc, VAR_0->opcode); VAR_0->abort_at_next_insn = 1;
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "qemu_log (\"unknown insn pc=%x opc=%x\\n\", VAR_0->pc, VAR_0->opcode);", "VAR_0->abort_at_next_insn = 1;" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 11 ], [ 13 ] ]
26,336
int av_parse_cpu_flags(const char *s) { #define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV) #define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX) #define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW) #define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT) #define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE) #define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2) #define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2) #define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3) #define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3) #define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3) #define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4) #define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42) #define CPUFLAG_AVXSLOW (AV_CPU_FLAG_AVXSLOW | CPUFLAG_AVX) #define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX) #define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX) #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX) #define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX) #define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | AV_CPU_FLAG_BMI1) static const AVOption cpuflags_opts[] = { { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, #if ARCH_PPC { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" }, #elif ARCH_X86 { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" }, { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "flags" }, { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "flags" }, { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "flags" }, { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "flags" }, { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "flags" }, { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "flags" }, { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "flags" }, { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" }, { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "flags" }, { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "flags" }, { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" }, { "avxslow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVXSLOW }, .unit = "flags" }, { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" }, { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3 }, .unit = "flags" }, { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" }, { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "flags" }, { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1 }, .unit = "flags" }, { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2 }, .unit = "flags" }, { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" }, { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" }, { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" }, #elif ARCH_ARM { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" }, { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" }, { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" }, { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" }, { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, #elif ARCH_AARCH64 { "armv8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8 }, .unit = "flags" }, { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, #endif { NULL }, }; static const AVClass class = { .class_name = "cpuflags", .item_name = av_default_item_name, .option = cpuflags_opts, .version = LIBAVUTIL_VERSION_INT, }; int flags = 0, ret; const AVClass *pclass = &class; if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, &flags)) < 0) return ret; return flags & INT_MAX; }
true
FFmpeg
e2710e790c09e49e86baa58c6063af0097cc8cb0
int av_parse_cpu_flags(const char *s) { #define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV) #define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX) #define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW) #define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT) #define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE) #define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2) #define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2) #define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3) #define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3) #define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3) #define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4) #define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42) #define CPUFLAG_AVXSLOW (AV_CPU_FLAG_AVXSLOW | CPUFLAG_AVX) #define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX) #define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX) #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX) #define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX) #define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | AV_CPU_FLAG_BMI1) static const AVOption cpuflags_opts[] = { { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, #if ARCH_PPC { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" }, #elif ARCH_X86 { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" }, { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "flags" }, { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "flags" }, { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "flags" }, { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "flags" }, { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "flags" }, { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "flags" }, { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "flags" }, { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" }, { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "flags" }, { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "flags" }, { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" }, { "avxslow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVXSLOW }, .unit = "flags" }, { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" }, { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3 }, .unit = "flags" }, { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" }, { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "flags" }, { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1 }, .unit = "flags" }, { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2 }, .unit = "flags" }, { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" }, { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" }, { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" }, #elif ARCH_ARM { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" }, { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" }, { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" }, { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" }, { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, #elif ARCH_AARCH64 { "armv8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8 }, .unit = "flags" }, { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, #endif { NULL }, }; static const AVClass class = { .class_name = "cpuflags", .item_name = av_default_item_name, .option = cpuflags_opts, .version = LIBAVUTIL_VERSION_INT, }; int flags = 0, ret; const AVClass *pclass = &class; if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, &flags)) < 0) return ret; return flags & INT_MAX; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0) { #define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV) #define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX) #define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW) #define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT) #define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE) #define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2) #define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2) #define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3) #define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3) #define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3) #define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4) #define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42) #define CPUFLAG_AVXSLOW (AV_CPU_FLAG_AVXSLOW | CPUFLAG_AVX) #define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX) #define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX) #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX) #define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX) #define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | AV_CPU_FLAG_BMI1) static const AVOption VAR_1[] = { { "VAR_3" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "VAR_3" }, #if ARCH_PPC { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "VAR_3" }, #elif ARCH_X86 { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "VAR_3" }, { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "VAR_3" }, { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "VAR_3" }, { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "VAR_3" }, { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "VAR_3" }, { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "VAR_3" }, { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "VAR_3" }, { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "VAR_3" }, { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "VAR_3" }, { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "VAR_3" }, { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "VAR_3" }, { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "VAR_3" }, { "avxslow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVXSLOW }, .unit = "VAR_3" }, { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "VAR_3" }, { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3 }, .unit = "VAR_3" }, { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "VAR_3" }, { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "VAR_3" }, { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1 }, .unit = "VAR_3" }, { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2 }, .unit = "VAR_3" }, { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "VAR_3" }, { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "VAR_3" }, { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "VAR_3" }, #elif ARCH_ARM { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "VAR_3" }, { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "VAR_3" }, { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "VAR_3" }, { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "VAR_3" }, { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "VAR_3" }, { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "VAR_3" }, #elif ARCH_AARCH64 { "armv8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8 }, .unit = "VAR_3" }, { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "VAR_3" }, { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "VAR_3" }, #endif { NULL }, }; static const AVClass VAR_2 = { .class_name = "cpuflags", .item_name = av_default_item_name, .option = VAR_1, .version = LIBAVUTIL_VERSION_INT, }; int VAR_3 = 0, VAR_4; const AVClass *VAR_5 = &VAR_2; if ((VAR_4 = av_opt_eval_flags(&VAR_5, &VAR_1[0], VAR_0, &VAR_3)) < 0) return VAR_4; return VAR_3 & INT_MAX; }
[ "int FUNC_0(const char *VAR_0)\n{", "#define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV)\n#define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX)\n#define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW)\n#define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ...
26,337
void mpeg1_init_vlc(MpegEncContext *s) { static int done = 0; if (!done) { init_vlc(&dc_lum_vlc, 9, 12, vlc_dc_lum_bits, 1, 1, vlc_dc_lum_code, 2, 2); init_vlc(&dc_chroma_vlc, 9, 12, vlc_dc_chroma_bits, 1, 1, vlc_dc_chroma_code, 2, 2); init_vlc(&mv_vlc, 9, 17, &mbMotionVectorTable[0][1], 2, 1, &mbMotionVectorTable[0][0], 2, 1); init_vlc(&mbincr_vlc, 9, 35, &mbAddrIncrTable[0][1], 2, 1, &mbAddrIncrTable[0][0], 2, 1); init_vlc(&mb_pat_vlc, 9, 63, &mbPatTable[0][1], 2, 1, &mbPatTable[0][0], 2, 1); init_vlc(&mb_ptype_vlc, 6, 32, &table_mb_ptype[0][1], 2, 1, &table_mb_ptype[0][0], 2, 1); init_vlc(&mb_btype_vlc, 6, 32, &table_mb_btype[0][1], 2, 1, &table_mb_btype[0][0], 2, 1); init_rl(&rl_mpeg1); init_rl(&rl_mpeg2); /* cannot use generic init because we must add the EOB code */ init_vlc(&rl_mpeg1.vlc, 9, rl_mpeg1.n + 2, &rl_mpeg1.table_vlc[0][1], 4, 2, &rl_mpeg1.table_vlc[0][0], 4, 2); init_vlc(&rl_mpeg2.vlc, 9, rl_mpeg2.n + 2, &rl_mpeg2.table_vlc[0][1], 4, 2, &rl_mpeg2.table_vlc[0][0], 4, 2); } }
true
FFmpeg
915bbac6815eddd911fb5cb8a23517b3cac3a84b
void mpeg1_init_vlc(MpegEncContext *s) { static int done = 0; if (!done) { init_vlc(&dc_lum_vlc, 9, 12, vlc_dc_lum_bits, 1, 1, vlc_dc_lum_code, 2, 2); init_vlc(&dc_chroma_vlc, 9, 12, vlc_dc_chroma_bits, 1, 1, vlc_dc_chroma_code, 2, 2); init_vlc(&mv_vlc, 9, 17, &mbMotionVectorTable[0][1], 2, 1, &mbMotionVectorTable[0][0], 2, 1); init_vlc(&mbincr_vlc, 9, 35, &mbAddrIncrTable[0][1], 2, 1, &mbAddrIncrTable[0][0], 2, 1); init_vlc(&mb_pat_vlc, 9, 63, &mbPatTable[0][1], 2, 1, &mbPatTable[0][0], 2, 1); init_vlc(&mb_ptype_vlc, 6, 32, &table_mb_ptype[0][1], 2, 1, &table_mb_ptype[0][0], 2, 1); init_vlc(&mb_btype_vlc, 6, 32, &table_mb_btype[0][1], 2, 1, &table_mb_btype[0][0], 2, 1); init_rl(&rl_mpeg1); init_rl(&rl_mpeg2); init_vlc(&rl_mpeg1.vlc, 9, rl_mpeg1.n + 2, &rl_mpeg1.table_vlc[0][1], 4, 2, &rl_mpeg1.table_vlc[0][0], 4, 2); init_vlc(&rl_mpeg2.vlc, 9, rl_mpeg2.n + 2, &rl_mpeg2.table_vlc[0][1], 4, 2, &rl_mpeg2.table_vlc[0][0], 4, 2); } }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0) { static int VAR_1 = 0; if (!VAR_1) { init_vlc(&dc_lum_vlc, 9, 12, vlc_dc_lum_bits, 1, 1, vlc_dc_lum_code, 2, 2); init_vlc(&dc_chroma_vlc, 9, 12, vlc_dc_chroma_bits, 1, 1, vlc_dc_chroma_code, 2, 2); init_vlc(&mv_vlc, 9, 17, &mbMotionVectorTable[0][1], 2, 1, &mbMotionVectorTable[0][0], 2, 1); init_vlc(&mbincr_vlc, 9, 35, &mbAddrIncrTable[0][1], 2, 1, &mbAddrIncrTable[0][0], 2, 1); init_vlc(&mb_pat_vlc, 9, 63, &mbPatTable[0][1], 2, 1, &mbPatTable[0][0], 2, 1); init_vlc(&mb_ptype_vlc, 6, 32, &table_mb_ptype[0][1], 2, 1, &table_mb_ptype[0][0], 2, 1); init_vlc(&mb_btype_vlc, 6, 32, &table_mb_btype[0][1], 2, 1, &table_mb_btype[0][0], 2, 1); init_rl(&rl_mpeg1); init_rl(&rl_mpeg2); init_vlc(&rl_mpeg1.vlc, 9, rl_mpeg1.n + 2, &rl_mpeg1.table_vlc[0][1], 4, 2, &rl_mpeg1.table_vlc[0][0], 4, 2); init_vlc(&rl_mpeg2.vlc, 9, rl_mpeg2.n + 2, &rl_mpeg2.table_vlc[0][1], 4, 2, &rl_mpeg2.table_vlc[0][0], 4, 2); } }
[ "void FUNC_0(MpegEncContext *VAR_0)\n{", "static int VAR_1 = 0;", "if (!VAR_1) {", "init_vlc(&dc_lum_vlc, 9, 12,\nvlc_dc_lum_bits, 1, 1,\nvlc_dc_lum_code, 2, 2);", "init_vlc(&dc_chroma_vlc, 9, 12,\nvlc_dc_chroma_bits, 1, 1,\nvlc_dc_chroma_code, 2, 2);", "init_vlc(&mv_vlc, 9, 17,\n&mbMotionVectorTable[0][1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 14, 16, 18 ], [ 20, 22, 24 ], [ 26, 28, 30 ], [ 32, 34, 36 ], [ 38, 40, 42 ], [ 46, 48, 50 ], [ 52, 54, 56 ], [ 58 ], [ 60 ], [ 64...
26,338
static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf, int buf_size, int block_width, int block_height, uint8_t *previous_frame, int *I_frame) { PutBitContext pb; int h_blocks, v_blocks, h_part, v_part, i, j; int buf_pos, res; int pred_blocks = 0; init_put_bits(&pb, buf, buf_size * 8); put_bits(&pb, 4, block_width / 16 - 1); put_bits(&pb, 12, s->image_width); put_bits(&pb, 4, block_height / 16 - 1); put_bits(&pb, 12, s->image_height); flush_put_bits(&pb); buf_pos = 4; h_blocks = s->image_width / block_width; h_part = s->image_width % block_width; v_blocks = s->image_height / block_height; v_part = s->image_height % block_height; /* loop over all block columns */ for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) { int y_pos = j * block_height; // vertical position in frame int cur_blk_height = (j < v_blocks) ? block_height : v_part; /* loop over all block rows */ for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) { int x_pos = i * block_width; // horizontal position in frame int cur_blk_width = (i < h_blocks) ? block_width : h_part; int ret = Z_OK; uint8_t *ptr = buf + buf_pos; /* copy the block to the temp buffer before compression * (if it differs from the previous frame's block) */ res = copy_region_enc(p->data[0], s->tmpblock, s->image_height - (y_pos + cur_blk_height + 1), x_pos, cur_blk_height, cur_blk_width, p->linesize[0], previous_frame); if (res || *I_frame) { unsigned long zsize = 3 * block_width * block_height; ret = compress2(ptr + 2, &zsize, s->tmpblock, 3 * cur_blk_width * cur_blk_height, 9); //ret = deflateReset(&s->zstream); if (ret != Z_OK) av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j); bytestream_put_be16(&ptr, zsize); buf_pos += zsize + 2; av_dlog(s->avctx, "buf_pos = %d\n", buf_pos); } else { pred_blocks++; bytestream_put_be16(&ptr, 0); buf_pos += 2; } } } if (pred_blocks) *I_frame = 0; else *I_frame = 1; return buf_pos; }
true
FFmpeg
50833c9f7b4e1922197a8955669f8ab3589c8cef
static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf, int buf_size, int block_width, int block_height, uint8_t *previous_frame, int *I_frame) { PutBitContext pb; int h_blocks, v_blocks, h_part, v_part, i, j; int buf_pos, res; int pred_blocks = 0; init_put_bits(&pb, buf, buf_size * 8); put_bits(&pb, 4, block_width / 16 - 1); put_bits(&pb, 12, s->image_width); put_bits(&pb, 4, block_height / 16 - 1); put_bits(&pb, 12, s->image_height); flush_put_bits(&pb); buf_pos = 4; h_blocks = s->image_width / block_width; h_part = s->image_width % block_width; v_blocks = s->image_height / block_height; v_part = s->image_height % block_height; for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) { int y_pos = j * block_height; int cur_blk_height = (j < v_blocks) ? block_height : v_part; for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) { int x_pos = i * block_width; int cur_blk_width = (i < h_blocks) ? block_width : h_part; int ret = Z_OK; uint8_t *ptr = buf + buf_pos; res = copy_region_enc(p->data[0], s->tmpblock, s->image_height - (y_pos + cur_blk_height + 1), x_pos, cur_blk_height, cur_blk_width, p->linesize[0], previous_frame); if (res || *I_frame) { unsigned long zsize = 3 * block_width * block_height; ret = compress2(ptr + 2, &zsize, s->tmpblock, 3 * cur_blk_width * cur_blk_height, 9); if (ret != Z_OK) av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j); bytestream_put_be16(&ptr, zsize); buf_pos += zsize + 2; av_dlog(s->avctx, "buf_pos = %d\n", buf_pos); } else { pred_blocks++; bytestream_put_be16(&ptr, 0); buf_pos += 2; } } } if (pred_blocks) *I_frame = 0; else *I_frame = 1; return buf_pos; }
{ "code": [ " init_put_bits(&pb, buf, buf_size * 8);", " init_put_bits(&pb, buf, buf_size * 8);" ], "line_no": [ 21, 21 ] }
static int FUNC_0(FlashSVContext *VAR_0, const AVFrame *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, uint8_t *VAR_6, int *VAR_7) { PutBitContext pb; int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15; int VAR_16 = 0; init_put_bits(&pb, VAR_2, VAR_3 * 8); put_bits(&pb, 4, VAR_4 / 16 - 1); put_bits(&pb, 12, VAR_0->image_width); put_bits(&pb, 4, VAR_5 / 16 - 1); put_bits(&pb, 12, VAR_0->image_height); flush_put_bits(&pb); VAR_14 = 4; VAR_8 = VAR_0->image_width / VAR_4; VAR_10 = VAR_0->image_width % VAR_4; VAR_9 = VAR_0->image_height / VAR_5; VAR_11 = VAR_0->image_height % VAR_5; for (VAR_13 = 0; VAR_13 < VAR_9 + (VAR_11 ? 1 : 0); VAR_13++) { int VAR_17 = VAR_13 * VAR_5; int VAR_18 = (VAR_13 < VAR_9) ? VAR_5 : VAR_11; for (VAR_12 = 0; VAR_12 < VAR_8 + (VAR_10 ? 1 : 0); VAR_12++) { int VAR_19 = VAR_12 * VAR_4; int VAR_20 = (VAR_12 < VAR_8) ? VAR_4 : VAR_10; int VAR_21 = Z_OK; uint8_t *ptr = VAR_2 + VAR_14; VAR_15 = copy_region_enc(VAR_1->data[0], VAR_0->tmpblock, VAR_0->image_height - (VAR_17 + VAR_18 + 1), VAR_19, VAR_18, VAR_20, VAR_1->linesize[0], VAR_6); if (VAR_15 || *VAR_7) { unsigned long VAR_22 = 3 * VAR_4 * VAR_5; VAR_21 = compress2(ptr + 2, &VAR_22, VAR_0->tmpblock, 3 * VAR_20 * VAR_18, 9); if (VAR_21 != Z_OK) av_log(VAR_0->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", VAR_12, VAR_13); bytestream_put_be16(&ptr, VAR_22); VAR_14 += VAR_22 + 2; av_dlog(VAR_0->avctx, "VAR_14 = %d\n", VAR_14); } else { VAR_16++; bytestream_put_be16(&ptr, 0); VAR_14 += 2; } } } if (VAR_16) *VAR_7 = 0; else *VAR_7 = 1; return VAR_14; }
[ "static int FUNC_0(FlashSVContext *VAR_0, const AVFrame *VAR_1, uint8_t *VAR_2,\nint VAR_3, int VAR_4, int VAR_5,\nuint8_t *VAR_6, int *VAR_7)\n{", "PutBitContext pb;", "int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14, VAR_15;", "int VAR_16 = 0;", "init_put_bits(&pb, VAR_2, VAR_3 * 8);", ...
[ 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 ]
[ [ 1, 3, 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 55 ], [ 57...
26,339
static void usb_uas_task(UASDevice *uas, uas_ui *ui) { uint16_t tag = be16_to_cpu(ui->hdr.tag); uint64_t lun64 = be64_to_cpu(ui->task.lun); SCSIDevice *dev = usb_uas_get_dev(uas, lun64); int lun = usb_uas_get_lun(lun64); UASRequest *req; uint16_t task_tag; req = usb_uas_find_request(uas, be16_to_cpu(ui->hdr.tag)); if (req) { goto overlapped_tag; if (dev == NULL) { goto incorrect_lun; switch (ui->task.function) { case UAS_TMF_ABORT_TASK: task_tag = be16_to_cpu(ui->task.task_tag); trace_usb_uas_tmf_abort_task(uas->dev.addr, tag, task_tag); req = usb_uas_find_request(uas, task_tag); if (req && req->dev == dev) { scsi_req_cancel(req->req); usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE, 0); break; case UAS_TMF_LOGICAL_UNIT_RESET: trace_usb_uas_tmf_logical_unit_reset(uas->dev.addr, tag, lun); qdev_reset_all(&dev->qdev); usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE, 0); break; default: trace_usb_uas_tmf_unsupported(uas->dev.addr, tag, ui->task.function); usb_uas_queue_response(uas, tag, UAS_RC_TMF_NOT_SUPPORTED, 0); break; return; invalid_tag: usb_uas_queue_response(uas, tag, UAS_RC_INVALID_INFO_UNIT, 0); return; overlapped_tag: usb_uas_queue_response(uas, req->tag, UAS_RC_OVERLAPPED_TAG, 0); return; incorrect_lun: usb_uas_queue_response(uas, tag, UAS_RC_INCORRECT_LUN, 0);
true
qemu
3453f9a0dfa58578e6dadf0905ff4528b428ec73
static void usb_uas_task(UASDevice *uas, uas_ui *ui) { uint16_t tag = be16_to_cpu(ui->hdr.tag); uint64_t lun64 = be64_to_cpu(ui->task.lun); SCSIDevice *dev = usb_uas_get_dev(uas, lun64); int lun = usb_uas_get_lun(lun64); UASRequest *req; uint16_t task_tag; req = usb_uas_find_request(uas, be16_to_cpu(ui->hdr.tag)); if (req) { goto overlapped_tag; if (dev == NULL) { goto incorrect_lun; switch (ui->task.function) { case UAS_TMF_ABORT_TASK: task_tag = be16_to_cpu(ui->task.task_tag); trace_usb_uas_tmf_abort_task(uas->dev.addr, tag, task_tag); req = usb_uas_find_request(uas, task_tag); if (req && req->dev == dev) { scsi_req_cancel(req->req); usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE, 0); break; case UAS_TMF_LOGICAL_UNIT_RESET: trace_usb_uas_tmf_logical_unit_reset(uas->dev.addr, tag, lun); qdev_reset_all(&dev->qdev); usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE, 0); break; default: trace_usb_uas_tmf_unsupported(uas->dev.addr, tag, ui->task.function); usb_uas_queue_response(uas, tag, UAS_RC_TMF_NOT_SUPPORTED, 0); break; return; invalid_tag: usb_uas_queue_response(uas, tag, UAS_RC_INVALID_INFO_UNIT, 0); return; overlapped_tag: usb_uas_queue_response(uas, req->tag, UAS_RC_OVERLAPPED_TAG, 0); return; incorrect_lun: usb_uas_queue_response(uas, tag, UAS_RC_INCORRECT_LUN, 0);
{ "code": [], "line_no": [] }
static void FUNC_0(UASDevice *VAR_0, uas_ui *VAR_1) { uint16_t tag = be16_to_cpu(VAR_1->hdr.tag); uint64_t lun64 = be64_to_cpu(VAR_1->task.VAR_2); SCSIDevice *dev = usb_uas_get_dev(VAR_0, lun64); int VAR_2 = usb_uas_get_lun(lun64); UASRequest *req; uint16_t task_tag; req = usb_uas_find_request(VAR_0, be16_to_cpu(VAR_1->hdr.tag)); if (req) { goto overlapped_tag; if (dev == NULL) { goto incorrect_lun; switch (VAR_1->task.function) { case UAS_TMF_ABORT_TASK: task_tag = be16_to_cpu(VAR_1->task.task_tag); trace_usb_uas_tmf_abort_task(VAR_0->dev.addr, tag, task_tag); req = usb_uas_find_request(VAR_0, task_tag); if (req && req->dev == dev) { scsi_req_cancel(req->req); usb_uas_queue_response(VAR_0, tag, UAS_RC_TMF_COMPLETE, 0); break; case UAS_TMF_LOGICAL_UNIT_RESET: trace_usb_uas_tmf_logical_unit_reset(VAR_0->dev.addr, tag, VAR_2); qdev_reset_all(&dev->qdev); usb_uas_queue_response(VAR_0, tag, UAS_RC_TMF_COMPLETE, 0); break; default: trace_usb_uas_tmf_unsupported(VAR_0->dev.addr, tag, VAR_1->task.function); usb_uas_queue_response(VAR_0, tag, UAS_RC_TMF_NOT_SUPPORTED, 0); break; return; invalid_tag: usb_uas_queue_response(VAR_0, tag, UAS_RC_INVALID_INFO_UNIT, 0); return; overlapped_tag: usb_uas_queue_response(VAR_0, req->tag, UAS_RC_OVERLAPPED_TAG, 0); return; incorrect_lun: usb_uas_queue_response(VAR_0, tag, UAS_RC_INCORRECT_LUN, 0);
[ "static void FUNC_0(UASDevice *VAR_0, uas_ui *VAR_1)\n{", "uint16_t tag = be16_to_cpu(VAR_1->hdr.tag);", "uint64_t lun64 = be64_to_cpu(VAR_1->task.VAR_2);", "SCSIDevice *dev = usb_uas_get_dev(VAR_0, lun64);", "int VAR_2 = usb_uas_get_lun(lun64);", "UASRequest *req;", "uint16_t task_tag;", "req = usb_u...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 22 ], [ 24 ], [ 26 ], [ 29 ], [ 31 ], [ 36 ], [ 38, 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 51 ], [...
26,340
static int sch_handle_start_func_passthrough(SubchDev *sch) { PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int ret; ORB *orb = &sch->orb; if (!(s->ctrl & SCSW_ACTL_SUSP)) { assert(orb != NULL); p->intparm = orb->intparm; } /* * Only support prefetch enable mode. * Only support 64bit addressing idal. */ if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) || !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) { return -EINVAL; } ret = s390_ccw_cmd_request(orb, s, sch->driver_data); switch (ret) { /* Currently we don't update control block and just return the cc code. */ case 0: break; case -EBUSY: break; case -ENODEV: break; case -EACCES: /* Let's reflect an inaccessible host device by cc 3. */ ret = -ENODEV; break; default: /* * All other return codes will trigger a program check, * or set cc to 1. */ break; }; return ret; }
true
qemu
66dc50f7057b9a0191f54e55764412202306858d
static int sch_handle_start_func_passthrough(SubchDev *sch) { PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int ret; ORB *orb = &sch->orb; if (!(s->ctrl & SCSW_ACTL_SUSP)) { assert(orb != NULL); p->intparm = orb->intparm; } if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) || !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) { return -EINVAL; } ret = s390_ccw_cmd_request(orb, s, sch->driver_data); switch (ret) { case 0: break; case -EBUSY: break; case -ENODEV: break; case -EACCES: ret = -ENODEV; break; default: break; }; return ret; }
{ "code": [ "static int sch_handle_start_func_passthrough(SubchDev *sch)", " int ret;", " return -EINVAL;", " ret = s390_ccw_cmd_request(orb, s, sch->driver_data);", " switch (ret) {", " case 0:", " break;", " case -EBUSY:", " break;", " case -ENODEV:", " break;", " case -EACCES:", " ret = -ENODEV;", " break;", " default:", " break;", " };", " return ret;", " return ret;", " return -EINVAL;", " int ret;", " ret = -ENODEV;", " return ret;", " int ret;", " ret = -ENODEV;", " return ret;", " switch (ret) {", " case -ENODEV:", " break;", " case -EBUSY:", " break;", " case 0:", " break;", " default:", " break;", " switch (ret) {", " case -ENODEV:", " break;", " break;", " case 0:", " break;", " default:", " break;" ], "line_no": [ 1, 11, 39, 45, 47, 51, 53, 55, 53, 59, 53, 63, 67, 53, 71, 81, 83, 87, 87, 39, 11, 67, 87, 11, 67, 87, 47, 59, 53, 55, 53, 51, 53, 71, 53, 47, 59, 53, 53, 51, 53, 71, 53 ] }
static int FUNC_0(SubchDev *VAR_0) { PMCW *p = &VAR_0->curr_status.pmcw; SCSW *s = &VAR_0->curr_status.scsw; int VAR_1; ORB *orb = &VAR_0->orb; if (!(s->ctrl & SCSW_ACTL_SUSP)) { assert(orb != NULL); p->intparm = orb->intparm; } if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) || !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) { return -EINVAL; } VAR_1 = s390_ccw_cmd_request(orb, s, VAR_0->driver_data); switch (VAR_1) { case 0: break; case -EBUSY: break; case -ENODEV: break; case -EACCES: VAR_1 = -ENODEV; break; default: break; }; return VAR_1; }
[ "static int FUNC_0(SubchDev *VAR_0)\n{", "PMCW *p = &VAR_0->curr_status.pmcw;", "SCSW *s = &VAR_0->curr_status.scsw;", "int VAR_1;", "ORB *orb = &VAR_0->orb;", "if (!(s->ctrl & SCSW_ACTL_SUSP)) {", "assert(orb != NULL);", "p->intparm = orb->intparm;", "}", "if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) ...
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63...
26,341
static int cmd_valid_while_locked(SDState *sd, SDRequest *req) { /* Valid commands in locked state: * basic class (0) * lock card class (7) * CMD16 * implicitly, the ACMD prefix CMD55 * ACMD41 and ACMD42 * Anything else provokes an "illegal command" response. */ if (sd->card_status & APP_CMD) { return req->cmd == 41 || req->cmd == 42; } if (req->cmd == 16 || req->cmd == 55) { return 1; } return sd_cmd_class[req->cmd] == 0 || sd_cmd_class[req->cmd] == 7; }
true
qemu
1d06cb7ab93f879ac25c9f5ef1d1ac8d97a42dfc
static int cmd_valid_while_locked(SDState *sd, SDRequest *req) { if (sd->card_status & APP_CMD) { return req->cmd == 41 || req->cmd == 42; } if (req->cmd == 16 || req->cmd == 55) { return 1; } return sd_cmd_class[req->cmd] == 0 || sd_cmd_class[req->cmd] == 7; }
{ "code": [ " if (sd->card_status & APP_CMD) {", " if (sd->card_status & APP_CMD) {" ], "line_no": [ 21, 21 ] }
static int FUNC_0(SDState *VAR_0, SDRequest *VAR_1) { if (VAR_0->card_status & APP_CMD) { return VAR_1->cmd == 41 || VAR_1->cmd == 42; } if (VAR_1->cmd == 16 || VAR_1->cmd == 55) { return 1; } return sd_cmd_class[VAR_1->cmd] == 0 || sd_cmd_class[VAR_1->cmd] == 7; }
[ "static int FUNC_0(SDState *VAR_0, SDRequest *VAR_1)\n{", "if (VAR_0->card_status & APP_CMD) {", "return VAR_1->cmd == 41 || VAR_1->cmd == 42;", "}", "if (VAR_1->cmd == 16 || VAR_1->cmd == 55) {", "return 1;", "}", "return sd_cmd_class[VAR_1->cmd] == 0 || sd_cmd_class[VAR_1->cmd] == 7;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
26,342
static int smc_decode_init(AVCodecContext *avctx) { SmcContext *s = avctx->priv_data; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; dsputil_init(&s->dsp, avctx); s->frame.data[0] = NULL; return 0; }
false
FFmpeg
32c3047cac9294bb56d23c89a40a22409db5cc70
static int smc_decode_init(AVCodecContext *avctx) { SmcContext *s = avctx->priv_data; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; dsputil_init(&s->dsp, avctx); s->frame.data[0] = NULL; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { SmcContext *s = VAR_0->priv_data; s->VAR_0 = VAR_0; VAR_0->pix_fmt = PIX_FMT_PAL8; dsputil_init(&s->dsp, VAR_0); s->frame.data[0] = NULL; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "SmcContext *s = VAR_0->priv_data;", "s->VAR_0 = VAR_0;", "VAR_0->pix_fmt = PIX_FMT_PAL8;", "dsputil_init(&s->dsp, VAR_0);", "s->frame.data[0] = NULL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ] ]
26,343
int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, int track_index, int sample) { MOVMuxContext *mov = s->priv_data; MOVTrack *trk = &mov->tracks[track_index]; AVFormatContext *rtp_ctx = trk->rtp_ctx; uint8_t *buf = NULL; int size; AVIOContext *hintbuf = NULL; AVPacket hint_pkt; int ret = 0, count; if (!rtp_ctx) return AVERROR(ENOENT); if (!rtp_ctx->pb) return AVERROR(ENOMEM); sample_queue_push(&trk->sample_queue, pkt, sample); /* Feed the packet to the RTP muxer */ ff_write_chained(rtp_ctx, 0, pkt, s); /* Fetch the output from the RTP muxer, open a new output buffer * for next time. */ size = avio_close_dyn_buf(rtp_ctx->pb, &buf); if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb, RTP_MAX_PACKET_SIZE)) < 0) goto done; if (size <= 0) goto done; /* Open a buffer for writing the hint */ if ((ret = avio_open_dyn_buf(&hintbuf)) < 0) goto done; av_init_packet(&hint_pkt); count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts); av_freep(&buf); /* Write the hint data into the hint track */ hint_pkt.size = size = avio_close_dyn_buf(hintbuf, &buf); hint_pkt.data = buf; hint_pkt.pts = hint_pkt.dts; hint_pkt.stream_index = track_index; if (pkt->flags & AV_PKT_FLAG_KEY) hint_pkt.flags |= AV_PKT_FLAG_KEY; if (count > 0) ff_mov_write_packet(s, &hint_pkt); done: av_free(buf); sample_queue_retain(&trk->sample_queue); return ret; }
false
FFmpeg
403ee835e7913eb9536b22c2b22edfdd700166a9
int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, int track_index, int sample) { MOVMuxContext *mov = s->priv_data; MOVTrack *trk = &mov->tracks[track_index]; AVFormatContext *rtp_ctx = trk->rtp_ctx; uint8_t *buf = NULL; int size; AVIOContext *hintbuf = NULL; AVPacket hint_pkt; int ret = 0, count; if (!rtp_ctx) return AVERROR(ENOENT); if (!rtp_ctx->pb) return AVERROR(ENOMEM); sample_queue_push(&trk->sample_queue, pkt, sample); ff_write_chained(rtp_ctx, 0, pkt, s); size = avio_close_dyn_buf(rtp_ctx->pb, &buf); if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb, RTP_MAX_PACKET_SIZE)) < 0) goto done; if (size <= 0) goto done; if ((ret = avio_open_dyn_buf(&hintbuf)) < 0) goto done; av_init_packet(&hint_pkt); count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts); av_freep(&buf); hint_pkt.size = size = avio_close_dyn_buf(hintbuf, &buf); hint_pkt.data = buf; hint_pkt.pts = hint_pkt.dts; hint_pkt.stream_index = track_index; if (pkt->flags & AV_PKT_FLAG_KEY) hint_pkt.flags |= AV_PKT_FLAG_KEY; if (count > 0) ff_mov_write_packet(s, &hint_pkt); done: av_free(buf); sample_queue_retain(&trk->sample_queue); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1, int VAR_2, int VAR_3) { MOVMuxContext *mov = VAR_0->priv_data; MOVTrack *trk = &mov->tracks[VAR_2]; AVFormatContext *rtp_ctx = trk->rtp_ctx; uint8_t *buf = NULL; int VAR_4; AVIOContext *hintbuf = NULL; AVPacket hint_pkt; int VAR_5 = 0, VAR_6; if (!rtp_ctx) return AVERROR(ENOENT); if (!rtp_ctx->pb) return AVERROR(ENOMEM); sample_queue_push(&trk->sample_queue, VAR_1, VAR_3); ff_write_chained(rtp_ctx, 0, VAR_1, VAR_0); VAR_4 = avio_close_dyn_buf(rtp_ctx->pb, &buf); if ((VAR_5 = url_open_dyn_packet_buf(&rtp_ctx->pb, RTP_MAX_PACKET_SIZE)) < 0) goto done; if (VAR_4 <= 0) goto done; if ((VAR_5 = avio_open_dyn_buf(&hintbuf)) < 0) goto done; av_init_packet(&hint_pkt); VAR_6 = write_hint_packets(hintbuf, buf, VAR_4, trk, &hint_pkt.dts); av_freep(&buf); hint_pkt.VAR_4 = VAR_4 = avio_close_dyn_buf(hintbuf, &buf); hint_pkt.data = buf; hint_pkt.pts = hint_pkt.dts; hint_pkt.stream_index = VAR_2; if (VAR_1->flags & AV_PKT_FLAG_KEY) hint_pkt.flags |= AV_PKT_FLAG_KEY; if (VAR_6 > 0) ff_mov_write_packet(VAR_0, &hint_pkt); done: av_free(buf); sample_queue_retain(&trk->sample_queue); return VAR_5; }
[ "int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1,\nint VAR_2, int VAR_3)\n{", "MOVMuxContext *mov = VAR_0->priv_data;", "MOVTrack *trk = &mov->tracks[VAR_2];", "AVFormatContext *rtp_ctx = trk->rtp_ctx;", "uint8_t *buf = NULL;", "int VAR_4;", "AVIOContext *hintbuf = NULL;", "AVPacket hint_pkt;", "...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29, 31 ], [ 35 ], [ 41 ], [ 49 ], [ 51, 53, 55 ], [ 59, 61 ], [ 67,...
26,344
static void decode_lowdelay(DiracContext *s) { AVCodecContext *avctx = s->avctx; int slice_x, slice_y, bytes, bufsize; const uint8_t *buf; struct lowdelay_slice *slices; int slice_num = 0; slices = av_mallocz_array(s->lowdelay.num_x, s->lowdelay.num_y * sizeof(struct lowdelay_slice)); align_get_bits(&s->gb); /*[DIRAC_STD] 13.5.2 Slices. slice(sx,sy) */ buf = s->gb.buffer + get_bits_count(&s->gb)/8; bufsize = get_bits_left(&s->gb); for (slice_y = 0; bufsize > 0 && slice_y < s->lowdelay.num_y; slice_y++) for (slice_x = 0; bufsize > 0 && slice_x < s->lowdelay.num_x; slice_x++) { bytes = (slice_num+1) * s->lowdelay.bytes.num / s->lowdelay.bytes.den - slice_num * s->lowdelay.bytes.num / s->lowdelay.bytes.den; slices[slice_num].bytes = bytes; slices[slice_num].slice_x = slice_x; slices[slice_num].slice_y = slice_y; init_get_bits(&slices[slice_num].gb, buf, bufsize); slice_num++; buf += bytes; bufsize -= bytes*8; } avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num, sizeof(struct lowdelay_slice)); /* [DIRAC_STD] 13.5.2 Slices */ intra_dc_prediction(&s->plane[0].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ intra_dc_prediction(&s->plane[1].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ intra_dc_prediction(&s->plane[2].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ av_free(slices); }
false
FFmpeg
a4d3cf10b2ece441ae25849a66b1c11d838f9381
static void decode_lowdelay(DiracContext *s) { AVCodecContext *avctx = s->avctx; int slice_x, slice_y, bytes, bufsize; const uint8_t *buf; struct lowdelay_slice *slices; int slice_num = 0; slices = av_mallocz_array(s->lowdelay.num_x, s->lowdelay.num_y * sizeof(struct lowdelay_slice)); align_get_bits(&s->gb); buf = s->gb.buffer + get_bits_count(&s->gb)/8; bufsize = get_bits_left(&s->gb); for (slice_y = 0; bufsize > 0 && slice_y < s->lowdelay.num_y; slice_y++) for (slice_x = 0; bufsize > 0 && slice_x < s->lowdelay.num_x; slice_x++) { bytes = (slice_num+1) * s->lowdelay.bytes.num / s->lowdelay.bytes.den - slice_num * s->lowdelay.bytes.num / s->lowdelay.bytes.den; slices[slice_num].bytes = bytes; slices[slice_num].slice_x = slice_x; slices[slice_num].slice_y = slice_y; init_get_bits(&slices[slice_num].gb, buf, bufsize); slice_num++; buf += bytes; bufsize -= bytes*8; } avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num, sizeof(struct lowdelay_slice)); intra_dc_prediction(&s->plane[0].band[0][0]); intra_dc_prediction(&s->plane[1].band[0][0]); intra_dc_prediction(&s->plane[2].band[0][0]); av_free(slices); }
{ "code": [], "line_no": [] }
static void FUNC_0(DiracContext *VAR_0) { AVCodecContext *avctx = VAR_0->avctx; int VAR_1, VAR_2, VAR_3, VAR_4; const uint8_t *VAR_5; struct lowdelay_slice *VAR_6; int VAR_7 = 0; VAR_6 = av_mallocz_array(VAR_0->lowdelay.num_x, VAR_0->lowdelay.num_y * sizeof(struct lowdelay_slice)); align_get_bits(&VAR_0->gb); VAR_5 = VAR_0->gb.buffer + get_bits_count(&VAR_0->gb)/8; VAR_4 = get_bits_left(&VAR_0->gb); for (VAR_2 = 0; VAR_4 > 0 && VAR_2 < VAR_0->lowdelay.num_y; VAR_2++) for (VAR_1 = 0; VAR_4 > 0 && VAR_1 < VAR_0->lowdelay.num_x; VAR_1++) { VAR_3 = (VAR_7+1) * VAR_0->lowdelay.VAR_3.num / VAR_0->lowdelay.VAR_3.den - VAR_7 * VAR_0->lowdelay.VAR_3.num / VAR_0->lowdelay.VAR_3.den; VAR_6[VAR_7].VAR_3 = VAR_3; VAR_6[VAR_7].VAR_1 = VAR_1; VAR_6[VAR_7].VAR_2 = VAR_2; init_get_bits(&VAR_6[VAR_7].gb, VAR_5, VAR_4); VAR_7++; VAR_5 += VAR_3; VAR_4 -= VAR_3*8; } avctx->execute(avctx, decode_lowdelay_slice, VAR_6, NULL, VAR_7, sizeof(struct lowdelay_slice)); intra_dc_prediction(&VAR_0->plane[0].band[0][0]); intra_dc_prediction(&VAR_0->plane[1].band[0][0]); intra_dc_prediction(&VAR_0->plane[2].band[0][0]); av_free(VAR_6); }
[ "static void FUNC_0(DiracContext *VAR_0)\n{", "AVCodecContext *avctx = VAR_0->avctx;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "const uint8_t *VAR_5;", "struct lowdelay_slice *VAR_6;", "int VAR_7 = 0;", "VAR_6 = av_mallocz_array(VAR_0->lowdelay.num_x, VAR_0->lowdelay.num_y * sizeof(struct lowdelay_slice));",...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [...
26,345
static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) { *dst = *src; if (src->qp_table) { int qsize = src->qp_table_size; dst->qp_table = av_malloc(qsize); memcpy(dst->qp_table, src->qp_table, qsize); } }
true
FFmpeg
b7e7ee6231bc1f3608ed4005c3e7550ec4815296
static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) { *dst = *src; if (src->qp_table) { int qsize = src->qp_table_size; dst->qp_table = av_malloc(qsize); memcpy(dst->qp_table, src->qp_table, qsize); } }
{ "code": [ "static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) {" ], "line_no": [ 1 ] }
static void FUNC_0(AVFilterBufferRefVideoProps *VAR_0, AVFilterBufferRefVideoProps *VAR_1) { *VAR_0 = *VAR_1; if (VAR_1->qp_table) { int VAR_2 = VAR_1->qp_table_size; VAR_0->qp_table = av_malloc(VAR_2); memcpy(VAR_0->qp_table, VAR_1->qp_table, VAR_2); } }
[ "static void FUNC_0(AVFilterBufferRefVideoProps *VAR_0, AVFilterBufferRefVideoProps *VAR_1) {", "*VAR_0 = *VAR_1;", "if (VAR_1->qp_table) {", "int VAR_2 = VAR_1->qp_table_size;", "VAR_0->qp_table = av_malloc(VAR_2);", "memcpy(VAR_0->qp_table, VAR_1->qp_table, VAR_2);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
26,347
void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp) { do_blockdev_backup(arg, NULL, errp); }
true
qemu
111049a4ecefc9cf1ac75c773f4c5c165f27fe63
void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp) { do_blockdev_backup(arg, NULL, errp); }
{ "code": [ " do_blockdev_backup(arg, NULL, errp);" ], "line_no": [ 5 ] }
void FUNC_0(BlockdevBackup *VAR_0, Error **VAR_1) { do_blockdev_backup(VAR_0, NULL, VAR_1); }
[ "void FUNC_0(BlockdevBackup *VAR_0, Error **VAR_1)\n{", "do_blockdev_backup(VAR_0, NULL, VAR_1);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,348
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; int user_packet = !!avpkt->data; int nb_samples; *got_packet_ptr = 0; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); avpkt->size = 0; return 0; } /* check for valid frame size */ if (frame) { nb_samples = frame->nb_samples; if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { if (nb_samples > avctx->frame_size) return AVERROR(EINVAL); } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { if (nb_samples != avctx->frame_size) return AVERROR(EINVAL); } } else { nb_samples = avctx->frame_size; } if (avctx->codec->encode2) { ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret && *got_packet_ptr) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (avpkt->pts == AV_NOPTS_VALUE) avpkt->pts = frame->pts; if (!avpkt->duration) avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); } avpkt->dts = avpkt->pts; } else { avpkt->size = 0; } } else { /* for compatibility with encoders not supporting encode2(), we need to allocate a packet buffer if the user has not provided one or check the size otherwise */ int fs_tmp = 0; int buf_size = avpkt->size; if (!user_packet) { if (avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) { av_assert0(av_get_bits_per_sample(avctx->codec_id) != 0); buf_size = nb_samples * avctx->channels * av_get_bits_per_sample(avctx->codec_id) / 8; } else { /* this is a guess as to the required size. if an encoder needs more than this, it should probably implement encode2() */ buf_size = 2 * avctx->frame_size * avctx->channels * av_get_bytes_per_sample(avctx->sample_fmt); buf_size += FF_MIN_BUFFER_SIZE; } } if ((ret = ff_alloc_packet(avpkt, buf_size))) return ret; /* Encoders using AVCodec.encode() that support CODEC_CAP_SMALL_LAST_FRAME require avctx->frame_size to be set to the smaller size when encoding the last frame. This code can be removed once all encoders supporting CODEC_CAP_SMALL_LAST_FRAME use encode2() */ if ((avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) && nb_samples < avctx->frame_size) { fs_tmp = avctx->frame_size; avctx->frame_size = nb_samples; } /* encode the frame */ ret = avctx->codec->encode(avctx, avpkt->data, avpkt->size, frame ? frame->data[0] : NULL); if (ret >= 0) { if (!ret) { /* no output. if the packet data was allocated by libavcodec, free it */ if (!user_packet) av_freep(&avpkt->data); } else { if (avctx->coded_frame) avpkt->pts = avpkt->dts = avctx->coded_frame->pts; /* Set duration for final small packet. This can be removed once all encoders supporting CODEC_CAP_SMALL_LAST_FRAME use encode2() */ if (fs_tmp) { avpkt->duration = ff_samples_to_time_base(avctx, avctx->frame_size); } } avpkt->size = ret; *got_packet_ptr = (ret > 0); ret = 0; } if (fs_tmp) avctx->frame_size = fs_tmp; } if (!ret) { if (!user_packet && avpkt->data) { uint8_t *new_data = av_realloc(avpkt->data, avpkt->size); if (new_data) avpkt->data = new_data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) av_free_packet(avpkt); /* NOTE: if we add any audio encoders which output non-keyframe packets, this needs to be moved to the encoders, but for now we can do it here to simplify things */ avpkt->flags |= AV_PKT_FLAG_KEY; return ret; }
true
FFmpeg
3c6607eb6f946ed3e108db3f0694cab7e5a5df7e
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; int user_packet = !!avpkt->data; int nb_samples; *got_packet_ptr = 0; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); avpkt->size = 0; return 0; } if (frame) { nb_samples = frame->nb_samples; if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { if (nb_samples > avctx->frame_size) return AVERROR(EINVAL); } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { if (nb_samples != avctx->frame_size) return AVERROR(EINVAL); } } else { nb_samples = avctx->frame_size; } if (avctx->codec->encode2) { ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret && *got_packet_ptr) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (avpkt->pts == AV_NOPTS_VALUE) avpkt->pts = frame->pts; if (!avpkt->duration) avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); } avpkt->dts = avpkt->pts; } else { avpkt->size = 0; } } else { int fs_tmp = 0; int buf_size = avpkt->size; if (!user_packet) { if (avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) { av_assert0(av_get_bits_per_sample(avctx->codec_id) != 0); buf_size = nb_samples * avctx->channels * av_get_bits_per_sample(avctx->codec_id) / 8; } else { buf_size = 2 * avctx->frame_size * avctx->channels * av_get_bytes_per_sample(avctx->sample_fmt); buf_size += FF_MIN_BUFFER_SIZE; } } if ((ret = ff_alloc_packet(avpkt, buf_size))) return ret; if ((avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) && nb_samples < avctx->frame_size) { fs_tmp = avctx->frame_size; avctx->frame_size = nb_samples; } ret = avctx->codec->encode(avctx, avpkt->data, avpkt->size, frame ? frame->data[0] : NULL); if (ret >= 0) { if (!ret) { if (!user_packet) av_freep(&avpkt->data); } else { if (avctx->coded_frame) avpkt->pts = avpkt->dts = avctx->coded_frame->pts; if (fs_tmp) { avpkt->duration = ff_samples_to_time_base(avctx, avctx->frame_size); } } avpkt->size = ret; *got_packet_ptr = (ret > 0); ret = 0; } if (fs_tmp) avctx->frame_size = fs_tmp; } if (!ret) { if (!user_packet && avpkt->data) { uint8_t *new_data = av_realloc(avpkt->data, avpkt->size); if (new_data) avpkt->data = new_data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) av_free_packet(avpkt); avpkt->flags |= AV_PKT_FLAG_KEY; return ret; }
{ "code": [ " if (!user_packet && avpkt->data) {", " if (!user_packet && avpkt->data) {" ], "line_no": [ 219, 219 ] }
int VAR_0 avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; int user_packet = !!avpkt->data; int nb_samples; *got_packet_ptr = 0; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); avpkt->size = 0; return 0; } if (frame) { nb_samples = frame->nb_samples; if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { if (nb_samples > avctx->frame_size) return AVERROR(EINVAL); } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { if (nb_samples != avctx->frame_size) return AVERROR(EINVAL); } } else { nb_samples = avctx->frame_size; } if (avctx->codec->encode2) { ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret && *got_packet_ptr) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (avpkt->pts == AV_NOPTS_VALUE) avpkt->pts = frame->pts; if (!avpkt->duration) avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); } avpkt->dts = avpkt->pts; } else { avpkt->size = 0; } } else { int fs_tmp = 0; int buf_size = avpkt->size; if (!user_packet) { if (avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) { av_assert0(av_get_bits_per_sample(avctx->codec_id) != 0); buf_size = nb_samples * avctx->channels * av_get_bits_per_sample(avctx->codec_id) / 8; } else { buf_size = 2 * avctx->frame_size * avctx->channels * av_get_bytes_per_sample(avctx->sample_fmt); buf_size += FF_MIN_BUFFER_SIZE; } } if ((ret = ff_alloc_packet(avpkt, buf_size))) return ret; if ((avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) && nb_samples < avctx->frame_size) { fs_tmp = avctx->frame_size; avctx->frame_size = nb_samples; } ret = avctx->codec->encode(avctx, avpkt->data, avpkt->size, frame ? frame->data[0] : NULL); if (ret >= 0) { if (!ret) { if (!user_packet) av_freep(&avpkt->data); } else { if (avctx->coded_frame) avpkt->pts = avpkt->dts = avctx->coded_frame->pts; if (fs_tmp) { avpkt->duration = ff_samples_to_time_base(avctx, avctx->frame_size); } } avpkt->size = ret; *got_packet_ptr = (ret > 0); ret = 0; } if (fs_tmp) avctx->frame_size = fs_tmp; } if (!ret) { if (!user_packet && avpkt->data) { uint8_t *new_data = av_realloc(avpkt->data, avpkt->size); if (new_data) avpkt->data = new_data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) av_free_packet(avpkt); avpkt->flags |= AV_PKT_FLAG_KEY; return ret; }
[ "int VAR_0 avcodec_encode_audio2(AVCodecContext *avctx,\nAVPacket *avpkt,\nconst AVFrame *frame,\nint *got_packet_ptr)\n{", "int ret;", "int user_packet = !!avpkt->data;", "int nb_samples;", "*got_packet_ptr = 0;", "if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {", "av_free_packet(avpkt...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [...
26,349
static void fsl_imx6_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = fsl_imx6_realize; dc->desc = "i.MX6 SOC"; }
true
qemu
70fbd3c4bf9850fce733eea2c910c397905fb9a3
static void fsl_imx6_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = fsl_imx6_realize; dc->desc = "i.MX6 SOC"; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = fsl_imx6_realize; dc->desc = "i.MX6 SOC"; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = fsl_imx6_realize;", "dc->desc = \"i.MX6 SOC\";", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ] ]
26,350
static void test_endianness_split(gconstpointer data) { const TestCase *test = data; char *args; args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", test->machine, test->superio ? " -device " : "", test->superio ?: ""); qtest_start(args); isa_outl(test, 0xe8, 0x87654321); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); isa_outw(test, 0xea, 0x8866); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); isa_outw(test, 0xe8, 0x4422); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422); isa_outb(test, 0xeb, 0x87); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87664422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8766); isa_outb(test, 0xea, 0x65); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422); isa_outb(test, 0xe9, 0x43); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654322); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4322); isa_outb(test, 0xe8, 0x21); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); qtest_quit(global_qtest); g_free(args); }
true
qemu
2ad645d2854746b55ddfd1d8e951f689cca5d78f
static void test_endianness_split(gconstpointer data) { const TestCase *test = data; char *args; args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", test->machine, test->superio ? " -device " : "", test->superio ?: ""); qtest_start(args); isa_outl(test, 0xe8, 0x87654321); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); isa_outw(test, 0xea, 0x8866); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); isa_outw(test, 0xe8, 0x4422); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x88664422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422); isa_outb(test, 0xeb, 0x87); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87664422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8766); isa_outb(test, 0xea, 0x65); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654422); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4422); isa_outb(test, 0xe9, 0x43); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654322); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4322); isa_outb(test, 0xe8, 0x21); g_assert_cmphex(isa_inl(test, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe0), ==, 0x4321); qtest_quit(global_qtest); g_free(args); }
{ "code": [ " args = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\",", " args = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\",", " args = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\"," ], "line_no": [ 11, 11, 11 ] }
static void FUNC_0(gconstpointer VAR_0) { const TestCase *VAR_1 = VAR_0; char *VAR_2; VAR_2 = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", VAR_1->machine, VAR_1->superio ? " -device " : "", VAR_1->superio ?: ""); qtest_start(VAR_2); isa_outl(VAR_1, 0xe8, 0x87654321); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe0), ==, 0x4321); isa_outw(VAR_1, 0xea, 0x8866); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x88664321); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(VAR_1, 0xe0), ==, 0x4321); isa_outw(VAR_1, 0xe8, 0x4422); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x88664422); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8866); g_assert_cmphex(isa_inw(VAR_1, 0xe0), ==, 0x4422); isa_outb(VAR_1, 0xeb, 0x87); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x87664422); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8766); isa_outb(VAR_1, 0xea, 0x65); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x87654422); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe0), ==, 0x4422); isa_outb(VAR_1, 0xe9, 0x43); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x87654322); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe0), ==, 0x4322); isa_outb(VAR_1, 0xe8, 0x21); g_assert_cmphex(isa_inl(VAR_1, 0xe0), ==, 0x87654321); g_assert_cmphex(isa_inw(VAR_1, 0xe2), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe0), ==, 0x4321); qtest_quit(global_qtest); g_free(VAR_2); }
[ "static void FUNC_0(gconstpointer VAR_0)\n{", "const TestCase *VAR_1 = VAR_0;", "char *VAR_2;", "VAR_2 = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\",\nVAR_1->machine,\nVAR_1->superio ? \" -device \" : \"\",\nVAR_1->superio ?: \"\");", "qtest_start(VAR_2);", "isa_outl(VAR_1, 0xe8, 0x8765...
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], ...
26,351
static void test_qemu_strtoull_whitespace(void) { const char *str = " \t "; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0); g_assert(endptr == str); }
true
qemu
47d4be12c3997343e436c6cca89aefbbbeb70863
static void test_qemu_strtoull_whitespace(void) { const char *str = " \t "; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0); g_assert(endptr == str); }
{ "code": [ " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert(endptr == str);", " g_assert_cmpint(err, ==, 0);", " g_assert_cmpint(res, ==, 0);" ], "line_no": [ 21, 23, 25, 21, 23, 25, 21, 23, 25, 21, 23, 21, 23, 25, 21, 23, 25, 21, 25, 21, 23, 21, 23, 25, 21, 23, 25, 21, 25, 21, 23, 21, 23, 25, 21, 23, 25, 21, 25, 21, 23 ] }
static void FUNC_0(void) { const char *VAR_0 = " \t "; char VAR_1 = 'X'; const char *VAR_2 = &VAR_1; uint64_t res = 999; int VAR_3; VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res); g_assert_cmpint(VAR_3, ==, 0); g_assert_cmpint(res, ==, 0); g_assert(VAR_2 == VAR_0); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \" \\t \";", "char VAR_1 = 'X';", "const char *VAR_2 = &VAR_1;", "uint64_t res = 999;", "int VAR_3;", "VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res);", "g_assert_cmpint(VAR_3, ==, 0);", "g_assert_cmpint(res, ==, 0);", "g_assert(VAR_2 == VAR_0);...
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
26,352
static int matroska_parse_frame(MatroskaDemuxContext *matroska, MatroskaTrack *track, AVStream *st, uint8_t *data, int pkt_size, uint64_t timecode, uint64_t duration, int64_t pos, int is_keyframe) { MatroskaTrackEncoding *encodings = track->encodings.elem; uint8_t *pkt_data = data; int offset = 0, res; AVPacket *pkt; if (encodings && encodings->scope & 1) { res = matroska_decode_buffer(&pkt_data, &pkt_size, track); if (res < 0) return res; } if (st->codec->codec_id == AV_CODEC_ID_WAVPACK) { uint8_t *wv_data; res = matroska_parse_wavpack(track, pkt_data, &wv_data, &pkt_size); if (res < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "Error parsing a wavpack block.\n"); goto fail; } if (pkt_data != data) pkt_data = wv_data; } if (st->codec->codec_id == AV_CODEC_ID_PRORES) offset = 8; pkt = av_mallocz(sizeof(AVPacket)); /* XXX: prevent data copy... */ if (av_new_packet(pkt, pkt_size + offset) < 0) { av_free(pkt); return AVERROR(ENOMEM); } if (st->codec->codec_id == AV_CODEC_ID_PRORES) { uint8_t *buf = pkt->data; bytestream_put_be32(&buf, pkt_size); bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f')); } memcpy(pkt->data + offset, pkt_data, pkt_size); if (pkt_data != data) av_free(pkt_data); pkt->flags = is_keyframe; pkt->stream_index = st->index; if (track->ms_compat) pkt->dts = timecode; else pkt->pts = timecode; pkt->pos = pos; if (st->codec->codec_id == AV_CODEC_ID_TEXT) pkt->convergence_duration = duration; else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE) pkt->duration = duration; if (st->codec->codec_id == AV_CODEC_ID_SSA) matroska_fix_ass_packet(matroska, pkt, duration); if (matroska->prev_pkt && timecode != AV_NOPTS_VALUE && matroska->prev_pkt->pts == timecode && matroska->prev_pkt->stream_index == st->index && st->codec->codec_id == AV_CODEC_ID_SSA) matroska_merge_packets(matroska->prev_pkt, pkt); else { dynarray_add(&matroska->packets, &matroska->num_packets, pkt); matroska->prev_pkt = pkt; } return 0; fail: if (pkt_data != data) return res; }
true
FFmpeg
3c1199c3c4cbdb4ffff0de89f06d5a08acefe356
static int matroska_parse_frame(MatroskaDemuxContext *matroska, MatroskaTrack *track, AVStream *st, uint8_t *data, int pkt_size, uint64_t timecode, uint64_t duration, int64_t pos, int is_keyframe) { MatroskaTrackEncoding *encodings = track->encodings.elem; uint8_t *pkt_data = data; int offset = 0, res; AVPacket *pkt; if (encodings && encodings->scope & 1) { res = matroska_decode_buffer(&pkt_data, &pkt_size, track); if (res < 0) return res; } if (st->codec->codec_id == AV_CODEC_ID_WAVPACK) { uint8_t *wv_data; res = matroska_parse_wavpack(track, pkt_data, &wv_data, &pkt_size); if (res < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "Error parsing a wavpack block.\n"); goto fail; } if (pkt_data != data) pkt_data = wv_data; } if (st->codec->codec_id == AV_CODEC_ID_PRORES) offset = 8; pkt = av_mallocz(sizeof(AVPacket)); if (av_new_packet(pkt, pkt_size + offset) < 0) { av_free(pkt); return AVERROR(ENOMEM); } if (st->codec->codec_id == AV_CODEC_ID_PRORES) { uint8_t *buf = pkt->data; bytestream_put_be32(&buf, pkt_size); bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f')); } memcpy(pkt->data + offset, pkt_data, pkt_size); if (pkt_data != data) av_free(pkt_data); pkt->flags = is_keyframe; pkt->stream_index = st->index; if (track->ms_compat) pkt->dts = timecode; else pkt->pts = timecode; pkt->pos = pos; if (st->codec->codec_id == AV_CODEC_ID_TEXT) pkt->convergence_duration = duration; else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE) pkt->duration = duration; if (st->codec->codec_id == AV_CODEC_ID_SSA) matroska_fix_ass_packet(matroska, pkt, duration); if (matroska->prev_pkt && timecode != AV_NOPTS_VALUE && matroska->prev_pkt->pts == timecode && matroska->prev_pkt->stream_index == st->index && st->codec->codec_id == AV_CODEC_ID_SSA) matroska_merge_packets(matroska->prev_pkt, pkt); else { dynarray_add(&matroska->packets, &matroska->num_packets, pkt); matroska->prev_pkt = pkt; } return 0; fail: if (pkt_data != data) return res; }
{ "code": [], "line_no": [] }
static int FUNC_0(MatroskaDemuxContext *VAR_0, MatroskaTrack *VAR_1, AVStream *VAR_2, uint8_t *VAR_3, int VAR_4, uint64_t VAR_5, uint64_t VAR_6, int64_t VAR_7, int VAR_8) { MatroskaTrackEncoding *encodings = VAR_1->encodings.elem; uint8_t *pkt_data = VAR_3; int VAR_9 = 0, VAR_10; AVPacket *pkt; if (encodings && encodings->scope & 1) { VAR_10 = matroska_decode_buffer(&pkt_data, &VAR_4, VAR_1); if (VAR_10 < 0) return VAR_10; } if (VAR_2->codec->codec_id == AV_CODEC_ID_WAVPACK) { uint8_t *wv_data; VAR_10 = matroska_parse_wavpack(VAR_1, pkt_data, &wv_data, &VAR_4); if (VAR_10 < 0) { av_log(VAR_0->ctx, AV_LOG_ERROR, "Error parsing a wavpack block.\n"); goto fail; } if (pkt_data != VAR_3) pkt_data = wv_data; } if (VAR_2->codec->codec_id == AV_CODEC_ID_PRORES) VAR_9 = 8; pkt = av_mallocz(sizeof(AVPacket)); if (av_new_packet(pkt, VAR_4 + VAR_9) < 0) { av_free(pkt); return AVERROR(ENOMEM); } if (VAR_2->codec->codec_id == AV_CODEC_ID_PRORES) { uint8_t *buf = pkt->VAR_3; bytestream_put_be32(&buf, VAR_4); bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f')); } memcpy(pkt->VAR_3 + VAR_9, pkt_data, VAR_4); if (pkt_data != VAR_3) av_free(pkt_data); pkt->flags = VAR_8; pkt->stream_index = VAR_2->index; if (VAR_1->ms_compat) pkt->dts = VAR_5; else pkt->pts = VAR_5; pkt->VAR_7 = VAR_7; if (VAR_2->codec->codec_id == AV_CODEC_ID_TEXT) pkt->convergence_duration = VAR_6; else if (VAR_1->type != MATROSKA_TRACK_TYPE_SUBTITLE) pkt->VAR_6 = VAR_6; if (VAR_2->codec->codec_id == AV_CODEC_ID_SSA) matroska_fix_ass_packet(VAR_0, pkt, VAR_6); if (VAR_0->prev_pkt && VAR_5 != AV_NOPTS_VALUE && VAR_0->prev_pkt->pts == VAR_5 && VAR_0->prev_pkt->stream_index == VAR_2->index && VAR_2->codec->codec_id == AV_CODEC_ID_SSA) matroska_merge_packets(VAR_0->prev_pkt, pkt); else { dynarray_add(&VAR_0->packets, &VAR_0->num_packets, pkt); VAR_0->prev_pkt = pkt; } return 0; fail: if (pkt_data != VAR_3) return VAR_10; }
[ "static int FUNC_0(MatroskaDemuxContext *VAR_0,\nMatroskaTrack *VAR_1, AVStream *VAR_2,\nuint8_t *VAR_3, int VAR_4,\nuint64_t VAR_5, uint64_t VAR_6,\nint64_t VAR_7, int VAR_8)\n{", "MatroskaTrackEncoding *encodings = VAR_1->encodings.elem;", "uint8_t *pkt_data = VAR_3;", "int VAR_9 = 0, VAR_10;", "AVPacket ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51,...
26,353
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) { if(min_size < *size) return ptr; *size= 17*min_size/16 + 32; return av_realloc(ptr, *size); }
true
FFmpeg
0ecca7a49f8e254c12a3a1de048d738bfbb614c6
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) { if(min_size < *size) return ptr; *size= 17*min_size/16 + 32; return av_realloc(ptr, *size); }
{ "code": [ " *size= 17*min_size/16 + 32;" ], "line_no": [ 11 ] }
void *FUNC_0(void *VAR_0, unsigned int *VAR_1, unsigned int VAR_2) { if(VAR_2 < *VAR_1) return VAR_0; *VAR_1= 17*VAR_2/16 + 32; return av_realloc(VAR_0, *VAR_1); }
[ "void *FUNC_0(void *VAR_0, unsigned int *VAR_1, unsigned int VAR_2)\n{", "if(VAR_2 < *VAR_1)\nreturn VAR_0;", "*VAR_1= 17*VAR_2/16 + 32;", "return av_realloc(VAR_0, *VAR_1);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 15 ], [ 17 ] ]
26,354
static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt, int *serial) { int got_picture; if (packet_queue_get(&is->videoq, pkt, 1, serial) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(is->video_st->codec); SDL_LockMutex(is->pictq_mutex); // Make sure there are no long delay timers (ideally we should just flush the queue but that's harder) while (is->pictq_size && !is->videoq.abort_request) { SDL_CondWait(is->pictq_cond, is->pictq_mutex); } is->video_current_pos = -1; is->frame_last_pts = AV_NOPTS_VALUE; is->frame_last_duration = 0; is->frame_timer = (double)av_gettime() / 1000000.0; is->frame_last_dropped_pts = AV_NOPTS_VALUE; SDL_UnlockMutex(is->pictq_mutex); return 0; } if(avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt) < 0) return 0; if (got_picture) { int ret = 1; if (decoder_reorder_pts == -1) { *pts = av_frame_get_best_effort_timestamp(frame); } else if (decoder_reorder_pts) { *pts = frame->pkt_pts; } else { *pts = frame->pkt_dts; } if (*pts == AV_NOPTS_VALUE) { *pts = 0; } if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) { SDL_LockMutex(is->pictq_mutex); if (is->frame_last_pts != AV_NOPTS_VALUE && *pts) { double clockdiff = get_video_clock(is) - get_master_clock(is); double dpts = av_q2d(is->video_st->time_base) * *pts; double ptsdiff = dpts - is->frame_last_pts; if (fabs(clockdiff) < AV_NOSYNC_THRESHOLD && ptsdiff > 0 && ptsdiff < AV_NOSYNC_THRESHOLD && clockdiff + ptsdiff - is->frame_last_filter_delay < 0) { is->frame_last_dropped_pos = pkt->pos; is->frame_last_dropped_pts = dpts; is->frame_drops_early++; ret = 0; } } SDL_UnlockMutex(is->pictq_mutex); } return ret; } return 0; }
false
FFmpeg
26c208cf0ff59efd7786528884a64d35fc42e9bf
static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt, int *serial) { int got_picture; if (packet_queue_get(&is->videoq, pkt, 1, serial) < 0) return -1; if (pkt->data == flush_pkt.data) { avcodec_flush_buffers(is->video_st->codec); SDL_LockMutex(is->pictq_mutex); while (is->pictq_size && !is->videoq.abort_request) { SDL_CondWait(is->pictq_cond, is->pictq_mutex); } is->video_current_pos = -1; is->frame_last_pts = AV_NOPTS_VALUE; is->frame_last_duration = 0; is->frame_timer = (double)av_gettime() / 1000000.0; is->frame_last_dropped_pts = AV_NOPTS_VALUE; SDL_UnlockMutex(is->pictq_mutex); return 0; } if(avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt) < 0) return 0; if (got_picture) { int ret = 1; if (decoder_reorder_pts == -1) { *pts = av_frame_get_best_effort_timestamp(frame); } else if (decoder_reorder_pts) { *pts = frame->pkt_pts; } else { *pts = frame->pkt_dts; } if (*pts == AV_NOPTS_VALUE) { *pts = 0; } if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) { SDL_LockMutex(is->pictq_mutex); if (is->frame_last_pts != AV_NOPTS_VALUE && *pts) { double clockdiff = get_video_clock(is) - get_master_clock(is); double dpts = av_q2d(is->video_st->time_base) * *pts; double ptsdiff = dpts - is->frame_last_pts; if (fabs(clockdiff) < AV_NOSYNC_THRESHOLD && ptsdiff > 0 && ptsdiff < AV_NOSYNC_THRESHOLD && clockdiff + ptsdiff - is->frame_last_filter_delay < 0) { is->frame_last_dropped_pos = pkt->pos; is->frame_last_dropped_pts = dpts; is->frame_drops_early++; ret = 0; } } SDL_UnlockMutex(is->pictq_mutex); } return ret; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VideoState *VAR_0, AVFrame *VAR_1, int64_t *VAR_2, AVPacket *VAR_3, int *VAR_4) { int VAR_5; if (packet_queue_get(&VAR_0->videoq, VAR_3, 1, VAR_4) < 0) return -1; if (VAR_3->data == flush_pkt.data) { avcodec_flush_buffers(VAR_0->video_st->codec); SDL_LockMutex(VAR_0->pictq_mutex); while (VAR_0->pictq_size && !VAR_0->videoq.abort_request) { SDL_CondWait(VAR_0->pictq_cond, VAR_0->pictq_mutex); } VAR_0->video_current_pos = -1; VAR_0->frame_last_pts = AV_NOPTS_VALUE; VAR_0->frame_last_duration = 0; VAR_0->frame_timer = (double)av_gettime() / 1000000.0; VAR_0->frame_last_dropped_pts = AV_NOPTS_VALUE; SDL_UnlockMutex(VAR_0->pictq_mutex); return 0; } if(avcodec_decode_video2(VAR_0->video_st->codec, VAR_1, &VAR_5, VAR_3) < 0) return 0; if (VAR_5) { int VAR_6 = 1; if (decoder_reorder_pts == -1) { *VAR_2 = av_frame_get_best_effort_timestamp(VAR_1); } else if (decoder_reorder_pts) { *VAR_2 = VAR_1->pkt_pts; } else { *VAR_2 = VAR_1->pkt_dts; } if (*VAR_2 == AV_NOPTS_VALUE) { *VAR_2 = 0; } if (framedrop>0 || (framedrop && get_master_sync_type(VAR_0) != AV_SYNC_VIDEO_MASTER)) { SDL_LockMutex(VAR_0->pictq_mutex); if (VAR_0->frame_last_pts != AV_NOPTS_VALUE && *VAR_2) { double VAR_7 = get_video_clock(VAR_0) - get_master_clock(VAR_0); double VAR_8 = av_q2d(VAR_0->video_st->time_base) * *VAR_2; double VAR_9 = VAR_8 - VAR_0->frame_last_pts; if (fabs(VAR_7) < AV_NOSYNC_THRESHOLD && VAR_9 > 0 && VAR_9 < AV_NOSYNC_THRESHOLD && VAR_7 + VAR_9 - VAR_0->frame_last_filter_delay < 0) { VAR_0->frame_last_dropped_pos = VAR_3->pos; VAR_0->frame_last_dropped_pts = VAR_8; VAR_0->frame_drops_early++; VAR_6 = 0; } } SDL_UnlockMutex(VAR_0->pictq_mutex); } return VAR_6; } return 0; }
[ "static int FUNC_0(VideoState *VAR_0, AVFrame *VAR_1, int64_t *VAR_2, AVPacket *VAR_3, int *VAR_4)\n{", "int VAR_5;", "if (packet_queue_get(&VAR_0->videoq, VAR_3, 1, VAR_4) < 0)\nreturn -1;", "if (VAR_3->data == flush_pkt.data) {", "avcodec_flush_buffers(VAR_0->video_st->codec);", "SDL_LockMutex(VAR_0->pi...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57...
26,355
static void msix_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3; int vector = offset / PCI_MSIX_ENTRY_SIZE; pci_set_long(dev->msix_table_page + offset, val); msix_handle_mask_update(dev, vector);
true
qemu
9a93b61730e3b46ef1c01ca522c6abe80ec13832
static void msix_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3; int vector = offset / PCI_MSIX_ENTRY_SIZE; pci_set_long(dev->msix_table_page + offset, val); msix_handle_mask_update(dev, vector);
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { PCIDevice *dev = VAR_0; unsigned int VAR_4 = VAR_1 & (MSIX_PAGE_SIZE - 1) & ~0x3; int VAR_5 = VAR_4 / PCI_MSIX_ENTRY_SIZE; pci_set_long(dev->msix_table_page + VAR_4, VAR_2); msix_handle_mask_update(dev, VAR_5);
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PCIDevice *dev = VAR_0;", "unsigned int VAR_4 = VAR_1 & (MSIX_PAGE_SIZE - 1) & ~0x3;", "int VAR_5 = VAR_4 / PCI_MSIX_ENTRY_SIZE;", "pci_set_long(dev->msix_table_page + VAR_4, VAR_2);", "msix_handle_mask_updat...
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ] ]
26,356
static void vfio_msix_enable(VFIOPCIDevice *vdev) { vfio_disable_interrupts(vdev); vdev->msi_vectors = g_malloc0(vdev->msix->entries * sizeof(VFIOMSIVector)); vdev->interrupt = VFIO_INT_MSIX; /* * Some communication channels between VF & PF or PF & fw rely on the * physical state of the device and expect that enabling MSI-X from the * guest enables the same on the host. When our guest is Linux, the * guest driver call to pci_enable_msix() sets the enabling bit in the * MSI-X capability, but leaves the vector table masked. We therefore * can't rely on a vector_use callback (from request_irq() in the guest) * to switch the physical device into MSI-X mode because that may come a * long time after pci_enable_msix(). This code enables vector 0 with * triggering to userspace, then immediately release the vector, leaving * the physical device with no vectors enabled, but MSI-X enabled, just * like the guest view. */ vfio_msix_vector_do_use(&vdev->pdev, 0, NULL, NULL); vfio_msix_vector_release(&vdev->pdev, 0); if (msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use, vfio_msix_vector_release, NULL)) { error_report("vfio: msix_set_vector_notifiers failed"); } trace_vfio_msix_enable(vdev->vbasedev.name); }
true
qemu
bdd81addf4033ce26e6cd180b060f63095f3ded9
static void vfio_msix_enable(VFIOPCIDevice *vdev) { vfio_disable_interrupts(vdev); vdev->msi_vectors = g_malloc0(vdev->msix->entries * sizeof(VFIOMSIVector)); vdev->interrupt = VFIO_INT_MSIX; vfio_msix_vector_do_use(&vdev->pdev, 0, NULL, NULL); vfio_msix_vector_release(&vdev->pdev, 0); if (msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use, vfio_msix_vector_release, NULL)) { error_report("vfio: msix_set_vector_notifiers failed"); } trace_vfio_msix_enable(vdev->vbasedev.name); }
{ "code": [ " vdev->msi_vectors = g_malloc0(vdev->msix->entries * sizeof(VFIOMSIVector));" ], "line_no": [ 9 ] }
static void FUNC_0(VFIOPCIDevice *VAR_0) { vfio_disable_interrupts(VAR_0); VAR_0->msi_vectors = g_malloc0(VAR_0->msix->entries * sizeof(VFIOMSIVector)); VAR_0->interrupt = VFIO_INT_MSIX; vfio_msix_vector_do_use(&VAR_0->pdev, 0, NULL, NULL); vfio_msix_vector_release(&VAR_0->pdev, 0); if (msix_set_vector_notifiers(&VAR_0->pdev, vfio_msix_vector_use, vfio_msix_vector_release, NULL)) { error_report("vfio: msix_set_vector_notifiers failed"); } trace_vfio_msix_enable(VAR_0->vbasedev.name); }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0)\n{", "vfio_disable_interrupts(VAR_0);", "VAR_0->msi_vectors = g_malloc0(VAR_0->msix->entries * sizeof(VFIOMSIVector));", "VAR_0->interrupt = VFIO_INT_MSIX;", "vfio_msix_vector_do_use(&VAR_0->pdev, 0, NULL, NULL);", "vfio_msix_vector_release(&VAR_0->pdev, 0);", "...
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ] ]
26,357
static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto) { int fd; fd = socket(sa->sa_family, SOCK_STREAM, 0); if (fd < 0) { return -1; } if (bind(fd, sa, salen) < 0) { close(fd); if (errno == EADDRNOTAVAIL) { *has_proto = false; return 0; } return -1; } close(fd); *has_proto = true; return 0; }
true
qemu
cfd47a71df51047833d182e9e97244e7816b57da
static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto) { int fd; fd = socket(sa->sa_family, SOCK_STREAM, 0); if (fd < 0) { return -1; } if (bind(fd, sa, salen) < 0) { close(fd); if (errno == EADDRNOTAVAIL) { *has_proto = false; return 0; } return -1; } close(fd); *has_proto = true; return 0; }
{ "code": [ "static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto)", " int fd;", " fd = socket(sa->sa_family, SOCK_STREAM, 0);", " return -1;", " if (bind(fd, sa, salen) < 0) {", " close(fd);", " return 0;", " return -1;", " close(fd);", " return 0;" ], "line_no": [ 1, 5, 9, 13, 19, 21, 27, 13, 37, 41 ] }
static int FUNC_0(struct sockaddr *VAR_0, socklen_t VAR_1, bool *VAR_2) { int VAR_3; VAR_3 = socket(VAR_0->sa_family, SOCK_STREAM, 0); if (VAR_3 < 0) { return -1; } if (bind(VAR_3, VAR_0, VAR_1) < 0) { close(VAR_3); if (errno == EADDRNOTAVAIL) { *VAR_2 = false; return 0; } return -1; } close(VAR_3); *VAR_2 = true; return 0; }
[ "static int FUNC_0(struct sockaddr *VAR_0, socklen_t VAR_1, bool *VAR_2)\n{", "int VAR_3;", "VAR_3 = socket(VAR_0->sa_family, SOCK_STREAM, 0);", "if (VAR_3 < 0) {", "return -1;", "}", "if (bind(VAR_3, VAR_0, VAR_1) < 0) {", "close(VAR_3);", "if (errno == EADDRNOTAVAIL) {", "*VAR_2 = false;", "re...
[ 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
26,358
int ff_fft_init(FFTContext *s, int nbits, int inverse) { int i, j, m, n; float alpha, c1, s1, s2; int shuffle = 0; int av_unused has_vectors; s->nbits = nbits; n = 1 << nbits; s->exptab = av_malloc((n / 2) * sizeof(FFTComplex)); if (!s->exptab) goto fail; s->revtab = av_malloc(n * sizeof(uint16_t)); if (!s->revtab) goto fail; s->inverse = inverse; s2 = inverse ? 1.0 : -1.0; for(i=0;i<(n/2);i++) { alpha = 2 * M_PI * (float)i / (float)n; c1 = cos(alpha); s1 = sin(alpha) * s2; s->exptab[i].re = c1; s->exptab[i].im = s1; } s->fft_calc = ff_fft_calc_c; s->imdct_calc = ff_imdct_calc; s->imdct_half = ff_imdct_half; s->exptab1 = NULL; #ifdef HAVE_MMX has_vectors = mm_support(); shuffle = 1; if (has_vectors & MM_3DNOWEXT) { /* 3DNowEx for K7/K8 */ s->imdct_calc = ff_imdct_calc_3dn2; s->fft_calc = ff_fft_calc_3dn2; } else if (has_vectors & MM_3DNOW) { /* 3DNow! for K6-2/3 */ s->fft_calc = ff_fft_calc_3dn; } else if (has_vectors & MM_SSE) { /* SSE for P3/P4 */ s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_calc = ff_fft_calc_sse; } else { shuffle = 0; } #elif defined HAVE_ALTIVEC && !defined ALTIVEC_USE_REFERENCE_C_CODE has_vectors = mm_support(); if (has_vectors & MM_ALTIVEC) { s->fft_calc = ff_fft_calc_altivec; shuffle = 1; } #endif /* compute constant table for HAVE_SSE version */ if (shuffle) { int np, nblocks, np2, l; FFTComplex *q; np = 1 << nbits; nblocks = np >> 3; np2 = np >> 1; s->exptab1 = av_malloc(np * 2 * sizeof(FFTComplex)); if (!s->exptab1) goto fail; q = s->exptab1; do { for(l = 0; l < np2; l += 2 * nblocks) { *q++ = s->exptab[l]; *q++ = s->exptab[l + nblocks]; q->re = -s->exptab[l].im; q->im = s->exptab[l].re; q++; q->re = -s->exptab[l + nblocks].im; q->im = s->exptab[l + nblocks].re; q++; } nblocks = nblocks >> 1; } while (nblocks != 0); av_freep(&s->exptab); } /* compute bit reverse table */ for(i=0;i<n;i++) { m=0; for(j=0;j<nbits;j++) { m |= ((i >> j) & 1) << (nbits-j-1); } s->revtab[i]=m; } return 0; fail: av_freep(&s->revtab); av_freep(&s->exptab); av_freep(&s->exptab1); return -1; }
true
FFmpeg
b9fa32082c71013e90eab9e9997967d2939cf4a6
int ff_fft_init(FFTContext *s, int nbits, int inverse) { int i, j, m, n; float alpha, c1, s1, s2; int shuffle = 0; int av_unused has_vectors; s->nbits = nbits; n = 1 << nbits; s->exptab = av_malloc((n / 2) * sizeof(FFTComplex)); if (!s->exptab) goto fail; s->revtab = av_malloc(n * sizeof(uint16_t)); if (!s->revtab) goto fail; s->inverse = inverse; s2 = inverse ? 1.0 : -1.0; for(i=0;i<(n/2);i++) { alpha = 2 * M_PI * (float)i / (float)n; c1 = cos(alpha); s1 = sin(alpha) * s2; s->exptab[i].re = c1; s->exptab[i].im = s1; } s->fft_calc = ff_fft_calc_c; s->imdct_calc = ff_imdct_calc; s->imdct_half = ff_imdct_half; s->exptab1 = NULL; #ifdef HAVE_MMX has_vectors = mm_support(); shuffle = 1; if (has_vectors & MM_3DNOWEXT) { s->imdct_calc = ff_imdct_calc_3dn2; s->fft_calc = ff_fft_calc_3dn2; } else if (has_vectors & MM_3DNOW) { s->fft_calc = ff_fft_calc_3dn; } else if (has_vectors & MM_SSE) { s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_calc = ff_fft_calc_sse; } else { shuffle = 0; } #elif defined HAVE_ALTIVEC && !defined ALTIVEC_USE_REFERENCE_C_CODE has_vectors = mm_support(); if (has_vectors & MM_ALTIVEC) { s->fft_calc = ff_fft_calc_altivec; shuffle = 1; } #endif if (shuffle) { int np, nblocks, np2, l; FFTComplex *q; np = 1 << nbits; nblocks = np >> 3; np2 = np >> 1; s->exptab1 = av_malloc(np * 2 * sizeof(FFTComplex)); if (!s->exptab1) goto fail; q = s->exptab1; do { for(l = 0; l < np2; l += 2 * nblocks) { *q++ = s->exptab[l]; *q++ = s->exptab[l + nblocks]; q->re = -s->exptab[l].im; q->im = s->exptab[l].re; q++; q->re = -s->exptab[l + nblocks].im; q->im = s->exptab[l + nblocks].re; q++; } nblocks = nblocks >> 1; } while (nblocks != 0); av_freep(&s->exptab); } for(i=0;i<n;i++) { m=0; for(j=0;j<nbits;j++) { m |= ((i >> j) & 1) << (nbits-j-1); } s->revtab[i]=m; } return 0; fail: av_freep(&s->revtab); av_freep(&s->exptab); av_freep(&s->exptab1); return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(FFTContext *VAR_0, int VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; float VAR_7, VAR_8, VAR_9, VAR_10; int VAR_11 = 0; int VAR_12 has_vectors; VAR_0->VAR_1 = VAR_1; VAR_6 = 1 << VAR_1; VAR_0->exptab = av_malloc((VAR_6 / 2) * sizeof(FFTComplex)); if (!VAR_0->exptab) goto fail; VAR_0->revtab = av_malloc(VAR_6 * sizeof(uint16_t)); if (!VAR_0->revtab) goto fail; VAR_0->VAR_2 = VAR_2; VAR_10 = VAR_2 ? 1.0 : -1.0; for(VAR_3=0;VAR_3<(VAR_6/2);VAR_3++) { VAR_7 = 2 * M_PI * (float)VAR_3 / (float)VAR_6; VAR_8 = cos(VAR_7); VAR_9 = sin(VAR_7) * VAR_10; VAR_0->exptab[VAR_3].re = VAR_8; VAR_0->exptab[VAR_3].im = VAR_9; } VAR_0->fft_calc = ff_fft_calc_c; VAR_0->imdct_calc = ff_imdct_calc; VAR_0->imdct_half = ff_imdct_half; VAR_0->exptab1 = NULL; #ifdef HAVE_MMX has_vectors = mm_support(); VAR_11 = 1; if (has_vectors & MM_3DNOWEXT) { VAR_0->imdct_calc = ff_imdct_calc_3dn2; VAR_0->fft_calc = ff_fft_calc_3dn2; } else if (has_vectors & MM_3DNOW) { VAR_0->fft_calc = ff_fft_calc_3dn; } else if (has_vectors & MM_SSE) { VAR_0->imdct_calc = ff_imdct_calc_sse; VAR_0->imdct_half = ff_imdct_half_sse; VAR_0->fft_calc = ff_fft_calc_sse; } else { VAR_11 = 0; } #elif defined HAVE_ALTIVEC && !defined ALTIVEC_USE_REFERENCE_C_CODE has_vectors = mm_support(); if (has_vectors & MM_ALTIVEC) { VAR_0->fft_calc = ff_fft_calc_altivec; VAR_11 = 1; } #endif if (VAR_11) { int VAR_13, VAR_14, VAR_15, VAR_16; FFTComplex *q; VAR_13 = 1 << VAR_1; VAR_14 = VAR_13 >> 3; VAR_15 = VAR_13 >> 1; VAR_0->exptab1 = av_malloc(VAR_13 * 2 * sizeof(FFTComplex)); if (!VAR_0->exptab1) goto fail; q = VAR_0->exptab1; do { for(VAR_16 = 0; VAR_16 < VAR_15; VAR_16 += 2 * VAR_14) { *q++ = VAR_0->exptab[VAR_16]; *q++ = VAR_0->exptab[VAR_16 + VAR_14]; q->re = -VAR_0->exptab[VAR_16].im; q->im = VAR_0->exptab[VAR_16].re; q++; q->re = -VAR_0->exptab[VAR_16 + VAR_14].im; q->im = VAR_0->exptab[VAR_16 + VAR_14].re; q++; } VAR_14 = VAR_14 >> 1; } while (VAR_14 != 0); av_freep(&VAR_0->exptab); } for(VAR_3=0;VAR_3<VAR_6;VAR_3++) { VAR_5=0; for(VAR_4=0;VAR_4<VAR_1;VAR_4++) { VAR_5 |= ((VAR_3 >> VAR_4) & 1) << (VAR_1-VAR_4-1); } VAR_0->revtab[VAR_3]=VAR_5; } return 0; fail: av_freep(&VAR_0->revtab); av_freep(&VAR_0->exptab); av_freep(&VAR_0->exptab1); return -1; }
[ "int FUNC_0(FFTContext *VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "float VAR_7, VAR_8, VAR_9, VAR_10;", "int VAR_11 = 0;", "int VAR_12 has_vectors;", "VAR_0->VAR_1 = VAR_1;", "VAR_6 = 1 << VAR_1;", "VAR_0->exptab = av_malloc((VAR_6 / 2) * sizeof(FFTComplex));", "if (!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...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ...
26,359
static void write_mainheader(NUTContext *nut, AVIOContext *bc) { int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx; int64_t tmp_match; ff_put_v(bc, nut->version); if (nut->version > 3) ff_put_v(bc, nut->minor_version); ff_put_v(bc, nut->avf->nb_streams); ff_put_v(bc, nut->max_distance); ff_put_v(bc, nut->time_base_count); for (i = 0; i < nut->time_base_count; i++) { ff_put_v(bc, nut->time_base[i].num); ff_put_v(bc, nut->time_base[i].den); } tmp_pts = 0; tmp_mul = 1; tmp_stream = 0; tmp_match = 1 - (1LL << 62); tmp_head_idx = 0; for (i = 0; i < 256; ) { tmp_fields = 0; tmp_size = 0; // tmp_res=0; if (tmp_pts != nut->frame_code[i].pts_delta ) tmp_fields = 1; if (tmp_mul != nut->frame_code[i].size_mul ) tmp_fields = 2; if (tmp_stream != nut->frame_code[i].stream_id ) tmp_fields = 3; if (tmp_size != nut->frame_code[i].size_lsb ) tmp_fields = 4; // if (tmp_res != nut->frame_code[i].res ) tmp_fields=5; if (tmp_head_idx != nut->frame_code[i].header_idx) tmp_fields = 8; tmp_pts = nut->frame_code[i].pts_delta; tmp_flags = nut->frame_code[i].flags; tmp_stream = nut->frame_code[i].stream_id; tmp_mul = nut->frame_code[i].size_mul; tmp_size = nut->frame_code[i].size_lsb; // tmp_res = nut->frame_code[i].res; tmp_head_idx = nut->frame_code[i].header_idx; for (j = 0; i < 256; j++, i++) { if (i == 'N') { j--; continue; } if (nut->frame_code[i].pts_delta != tmp_pts || nut->frame_code[i].flags != tmp_flags || nut->frame_code[i].stream_id != tmp_stream || nut->frame_code[i].size_mul != tmp_mul || nut->frame_code[i].size_lsb != tmp_size + j || // nut->frame_code[i].res != tmp_res || nut->frame_code[i].header_idx != tmp_head_idx) break; } if (j != tmp_mul - tmp_size) tmp_fields = 6; ff_put_v(bc, tmp_flags); ff_put_v(bc, tmp_fields); if (tmp_fields > 0) put_s(bc, tmp_pts); if (tmp_fields > 1) ff_put_v(bc, tmp_mul); if (tmp_fields > 2) ff_put_v(bc, tmp_stream); if (tmp_fields > 3) ff_put_v(bc, tmp_size); if (tmp_fields > 4) ff_put_v(bc, 0 /*tmp_res*/); if (tmp_fields > 5) ff_put_v(bc, j); if (tmp_fields > 6) ff_put_v(bc, tmp_match); if (tmp_fields > 7) ff_put_v(bc, tmp_head_idx); } ff_put_v(bc, nut->header_count - 1); for (i = 1; i < nut->header_count; i++) { ff_put_v(bc, nut->header_len[i]); avio_write(bc, nut->header[i], nut->header_len[i]); } // flags had been effectively introduced in version 4 if (nut->version > NUT_STABLE_VERSION) ff_put_v(bc, nut->flags); }
false
FFmpeg
45daae06fd6f05baddb897686a6fa90cda3abb49
static void write_mainheader(NUTContext *nut, AVIOContext *bc) { int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx; int64_t tmp_match; ff_put_v(bc, nut->version); if (nut->version > 3) ff_put_v(bc, nut->minor_version); ff_put_v(bc, nut->avf->nb_streams); ff_put_v(bc, nut->max_distance); ff_put_v(bc, nut->time_base_count); for (i = 0; i < nut->time_base_count; i++) { ff_put_v(bc, nut->time_base[i].num); ff_put_v(bc, nut->time_base[i].den); } tmp_pts = 0; tmp_mul = 1; tmp_stream = 0; tmp_match = 1 - (1LL << 62); tmp_head_idx = 0; for (i = 0; i < 256; ) { tmp_fields = 0; tmp_size = 0; if (tmp_pts != nut->frame_code[i].pts_delta ) tmp_fields = 1; if (tmp_mul != nut->frame_code[i].size_mul ) tmp_fields = 2; if (tmp_stream != nut->frame_code[i].stream_id ) tmp_fields = 3; if (tmp_size != nut->frame_code[i].size_lsb ) tmp_fields = 4; if (tmp_head_idx != nut->frame_code[i].header_idx) tmp_fields = 8; tmp_pts = nut->frame_code[i].pts_delta; tmp_flags = nut->frame_code[i].flags; tmp_stream = nut->frame_code[i].stream_id; tmp_mul = nut->frame_code[i].size_mul; tmp_size = nut->frame_code[i].size_lsb; tmp_head_idx = nut->frame_code[i].header_idx; for (j = 0; i < 256; j++, i++) { if (i == 'N') { j--; continue; } if (nut->frame_code[i].pts_delta != tmp_pts || nut->frame_code[i].flags != tmp_flags || nut->frame_code[i].stream_id != tmp_stream || nut->frame_code[i].size_mul != tmp_mul || nut->frame_code[i].size_lsb != tmp_size + j || nut->frame_code[i].header_idx != tmp_head_idx) break; } if (j != tmp_mul - tmp_size) tmp_fields = 6; ff_put_v(bc, tmp_flags); ff_put_v(bc, tmp_fields); if (tmp_fields > 0) put_s(bc, tmp_pts); if (tmp_fields > 1) ff_put_v(bc, tmp_mul); if (tmp_fields > 2) ff_put_v(bc, tmp_stream); if (tmp_fields > 3) ff_put_v(bc, tmp_size); if (tmp_fields > 4) ff_put_v(bc, 0 ); if (tmp_fields > 5) ff_put_v(bc, j); if (tmp_fields > 6) ff_put_v(bc, tmp_match); if (tmp_fields > 7) ff_put_v(bc, tmp_head_idx); } ff_put_v(bc, nut->header_count - 1); for (i = 1; i < nut->header_count; i++) { ff_put_v(bc, nut->header_len[i]); avio_write(bc, nut->header[i], nut->header_len[i]); } if (nut->version > NUT_STABLE_VERSION) ff_put_v(bc, nut->flags); }
{ "code": [], "line_no": [] }
static void FUNC_0(NUTContext *VAR_0, AVIOContext *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int64_t tmp_match; ff_put_v(VAR_1, VAR_0->version); if (VAR_0->version > 3) ff_put_v(VAR_1, VAR_0->minor_version); ff_put_v(VAR_1, VAR_0->avf->nb_streams); ff_put_v(VAR_1, VAR_0->max_distance); ff_put_v(VAR_1, VAR_0->time_base_count); for (VAR_2 = 0; VAR_2 < VAR_0->time_base_count; VAR_2++) { ff_put_v(VAR_1, VAR_0->time_base[VAR_2].num); ff_put_v(VAR_1, VAR_0->time_base[VAR_2].den); } VAR_4 = 0; VAR_7 = 1; VAR_6 = 0; tmp_match = 1 - (1LL << 62); VAR_10 = 0; for (VAR_2 = 0; VAR_2 < 256; ) { VAR_9 = 0; VAR_8 = 0; if (VAR_4 != VAR_0->frame_code[VAR_2].pts_delta ) VAR_9 = 1; if (VAR_7 != VAR_0->frame_code[VAR_2].size_mul ) VAR_9 = 2; if (VAR_6 != VAR_0->frame_code[VAR_2].stream_id ) VAR_9 = 3; if (VAR_8 != VAR_0->frame_code[VAR_2].size_lsb ) VAR_9 = 4; if (VAR_10 != VAR_0->frame_code[VAR_2].header_idx) VAR_9 = 8; VAR_4 = VAR_0->frame_code[VAR_2].pts_delta; VAR_5 = VAR_0->frame_code[VAR_2].flags; VAR_6 = VAR_0->frame_code[VAR_2].stream_id; VAR_7 = VAR_0->frame_code[VAR_2].size_mul; VAR_8 = VAR_0->frame_code[VAR_2].size_lsb; VAR_10 = VAR_0->frame_code[VAR_2].header_idx; for (VAR_3 = 0; VAR_2 < 256; VAR_3++, VAR_2++) { if (VAR_2 == 'N') { VAR_3--; continue; } if (VAR_0->frame_code[VAR_2].pts_delta != VAR_4 || VAR_0->frame_code[VAR_2].flags != VAR_5 || VAR_0->frame_code[VAR_2].stream_id != VAR_6 || VAR_0->frame_code[VAR_2].size_mul != VAR_7 || VAR_0->frame_code[VAR_2].size_lsb != VAR_8 + VAR_3 || VAR_0->frame_code[VAR_2].header_idx != VAR_10) break; } if (VAR_3 != VAR_7 - VAR_8) VAR_9 = 6; ff_put_v(VAR_1, VAR_5); ff_put_v(VAR_1, VAR_9); if (VAR_9 > 0) put_s(VAR_1, VAR_4); if (VAR_9 > 1) ff_put_v(VAR_1, VAR_7); if (VAR_9 > 2) ff_put_v(VAR_1, VAR_6); if (VAR_9 > 3) ff_put_v(VAR_1, VAR_8); if (VAR_9 > 4) ff_put_v(VAR_1, 0 ); if (VAR_9 > 5) ff_put_v(VAR_1, VAR_3); if (VAR_9 > 6) ff_put_v(VAR_1, tmp_match); if (VAR_9 > 7) ff_put_v(VAR_1, VAR_10); } ff_put_v(VAR_1, VAR_0->header_count - 1); for (VAR_2 = 1; VAR_2 < VAR_0->header_count; VAR_2++) { ff_put_v(VAR_1, VAR_0->header_len[VAR_2]); avio_write(VAR_1, VAR_0->header[VAR_2], VAR_0->header_len[VAR_2]); } if (VAR_0->version > NUT_STABLE_VERSION) ff_put_v(VAR_1, VAR_0->flags); }
[ "static void FUNC_0(NUTContext *VAR_0, AVIOContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9,\nVAR_10;", "int64_t tmp_match;", "ff_put_v(VAR_1, VAR_0->version);", "if (VAR_0->version > 3)\nff_put_v(VAR_1, VAR_0->minor_version);", "ff_put_v(VAR_1, VAR_0->avf->nb_streams);", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ...
26,361
static void mmubooke_create_initial_mapping(CPUPPCState *env, target_ulong va, hwaddr pa) { ppcemb_tlb_t *tlb = &env->tlb.tlbe[0]; tlb->attr = 0; tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4); tlb->size = 1 << 31; /* up to 0x80000000 */ tlb->EPN = va & TARGET_PAGE_MASK; tlb->RPN = pa & TARGET_PAGE_MASK; tlb->PID = 0; tlb = &env->tlb.tlbe[1]; tlb->attr = 0; tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4); tlb->size = 1 << 31; /* up to 0xffffffff */ tlb->EPN = 0x80000000 & TARGET_PAGE_MASK; tlb->RPN = 0x80000000 & TARGET_PAGE_MASK; tlb->PID = 0; }
true
qemu
a1f7f97b950a46393b0e55a9a0082e70f540cbbd
static void mmubooke_create_initial_mapping(CPUPPCState *env, target_ulong va, hwaddr pa) { ppcemb_tlb_t *tlb = &env->tlb.tlbe[0]; tlb->attr = 0; tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4); tlb->size = 1 << 31; tlb->EPN = va & TARGET_PAGE_MASK; tlb->RPN = pa & TARGET_PAGE_MASK; tlb->PID = 0; tlb = &env->tlb.tlbe[1]; tlb->attr = 0; tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4); tlb->size = 1 << 31; tlb->EPN = 0x80000000 & TARGET_PAGE_MASK; tlb->RPN = 0x80000000 & TARGET_PAGE_MASK; tlb->PID = 0; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1, hwaddr VAR_2) { ppcemb_tlb_t *tlb = &VAR_0->tlb.tlbe[0]; tlb->attr = 0; tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4); tlb->size = 1 << 31; tlb->EPN = VAR_1 & TARGET_PAGE_MASK; tlb->RPN = VAR_2 & TARGET_PAGE_MASK; tlb->PID = 0; tlb = &VAR_0->tlb.tlbe[1]; tlb->attr = 0; tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4); tlb->size = 1 << 31; tlb->EPN = 0x80000000 & TARGET_PAGE_MASK; tlb->RPN = 0x80000000 & TARGET_PAGE_MASK; tlb->PID = 0; }
[ "static void FUNC_0(CPUPPCState *VAR_0,\ntarget_ulong VAR_1,\nhwaddr VAR_2)\n{", "ppcemb_tlb_t *tlb = &VAR_0->tlb.tlbe[0];", "tlb->attr = 0;", "tlb->prot = PAGE_VALID | ((PAGE_READ | PAGE_WRITE | PAGE_EXEC) << 4);", "tlb->size = 1 << 31;", "tlb->EPN = VAR_1 & TARGET_PAGE_MASK;", "tlb->RPN = VAR_2 & TARG...
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
26,362
struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base) { int iomemtype; struct pxa2xx_pcmcia_s *s; s = (struct pxa2xx_pcmcia_s *) qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s)); /* Socket I/O Memory Space */ s->io_base = base | 0x00000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn, pxa2xx_pcmcia_io_writefn, s); cpu_register_physical_memory(s->io_base, 0x03ffffff, iomemtype); /* Then next 64 MB is reserved */ /* Socket Attribute Memory Space */ s->attr_base = base | 0x08000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_attr_readfn, pxa2xx_pcmcia_attr_writefn, s); cpu_register_physical_memory(s->attr_base, 0x03ffffff, iomemtype); /* Socket Common Memory Space */ s->common_base = base | 0x0c000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_common_readfn, pxa2xx_pcmcia_common_writefn, s); cpu_register_physical_memory(s->common_base, 0x03ffffff, iomemtype); if (base == 0x30000000) s->slot.slot_string = "PXA PC Card Socket 1"; else s->slot.slot_string = "PXA PC Card Socket 0"; s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0]; pcmcia_socket_register(&s->slot); return s; }
true
qemu
187337f8b0ec0813dd3876d1efe37d415fb81c2e
struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base) { int iomemtype; struct pxa2xx_pcmcia_s *s; s = (struct pxa2xx_pcmcia_s *) qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s)); s->io_base = base | 0x00000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn, pxa2xx_pcmcia_io_writefn, s); cpu_register_physical_memory(s->io_base, 0x03ffffff, iomemtype); s->attr_base = base | 0x08000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_attr_readfn, pxa2xx_pcmcia_attr_writefn, s); cpu_register_physical_memory(s->attr_base, 0x03ffffff, iomemtype); s->common_base = base | 0x0c000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_common_readfn, pxa2xx_pcmcia_common_writefn, s); cpu_register_physical_memory(s->common_base, 0x03ffffff, iomemtype); if (base == 0x30000000) s->slot.slot_string = "PXA PC Card Socket 1"; else s->slot.slot_string = "PXA PC Card Socket 0"; s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0]; pcmcia_socket_register(&s->slot); return s; }
{ "code": [ " cpu_register_physical_memory(s->io_base, 0x03ffffff, iomemtype);", " cpu_register_physical_memory(s->attr_base, 0x03ffffff, iomemtype);", " cpu_register_physical_memory(s->common_base, 0x03ffffff, iomemtype);" ], "line_no": [ 25, 41, 53 ] }
struct pxa2xx_pcmcia_s *FUNC_0(target_phys_addr_t VAR_0) { int VAR_1; struct pxa2xx_pcmcia_s *VAR_2; VAR_2 = (struct pxa2xx_pcmcia_s *) qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s)); VAR_2->io_base = VAR_0 | 0x00000000; VAR_1 = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn, pxa2xx_pcmcia_io_writefn, VAR_2); cpu_register_physical_memory(VAR_2->io_base, 0x03ffffff, VAR_1); VAR_2->attr_base = VAR_0 | 0x08000000; VAR_1 = cpu_register_io_memory(0, pxa2xx_pcmcia_attr_readfn, pxa2xx_pcmcia_attr_writefn, VAR_2); cpu_register_physical_memory(VAR_2->attr_base, 0x03ffffff, VAR_1); VAR_2->common_base = VAR_0 | 0x0c000000; VAR_1 = cpu_register_io_memory(0, pxa2xx_pcmcia_common_readfn, pxa2xx_pcmcia_common_writefn, VAR_2); cpu_register_physical_memory(VAR_2->common_base, 0x03ffffff, VAR_1); if (VAR_0 == 0x30000000) VAR_2->slot.slot_string = "PXA PC Card Socket 1"; else VAR_2->slot.slot_string = "PXA PC Card Socket 0"; VAR_2->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, VAR_2, 1)[0]; pcmcia_socket_register(&VAR_2->slot); return VAR_2; }
[ "struct pxa2xx_pcmcia_s *FUNC_0(target_phys_addr_t VAR_0)\n{", "int VAR_1;", "struct pxa2xx_pcmcia_s *VAR_2;", "VAR_2 = (struct pxa2xx_pcmcia_s *)\nqemu_mallocz(sizeof(struct pxa2xx_pcmcia_s));", "VAR_2->io_base = VAR_0 | 0x00000000;", "VAR_1 = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn,\npxa2xx_pc...
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67...
26,363
static int mov_text_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { AVSubtitle *sub = data; MovTextContext *m = avctx->priv_data; int ret; AVBPrint buf; char *ptr = avpkt->data; char *end; int text_length, tsmb_type, ret_tsmb; uint64_t tsmb_size; const uint8_t *tsmb; if (!ptr || avpkt->size < 2) return AVERROR_INVALIDDATA; /* * A packet of size two with value zero is an empty subtitle * used to mark the end of the previous non-empty subtitle. * We can just drop them here as we have duration information * already. If the value is non-zero, then it's technically a * bad packet. */ if (avpkt->size == 2) return AV_RB16(ptr) == 0 ? 0 : AVERROR_INVALIDDATA; /* * The first two bytes of the packet are the length of the text string * In complex cases, there are style descriptors appended to the string * so we can't just assume the packet size is the string size. */ text_length = AV_RB16(ptr); end = ptr + FFMIN(2 + text_length, avpkt->size); ptr += 2; tsmb_size = 0; m->tracksize = 2 + text_length; m->style_entries = 0; m->box_flags = 0; m->count_s = 0; // Note that the spec recommends lines be no longer than 2048 characters. av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); if (text_length + 2 != avpkt->size) { while (m->tracksize + 8 <= avpkt->size) { // A box is a minimum of 8 bytes. tsmb = ptr + m->tracksize - 2; tsmb_size = AV_RB32(tsmb); tsmb += 4; tsmb_type = AV_RB32(tsmb); tsmb += 4; if (tsmb_size == 1) { if (m->tracksize + 16 > avpkt->size) break; tsmb_size = AV_RB64(tsmb); tsmb += 8; m->size_var = 16; } else m->size_var = 8; //size_var is equal to 8 or 16 depending on the size of box if (tsmb_size == 0) { av_log(avctx, AV_LOG_ERROR, "tsmb_size is 0\n"); return AVERROR_INVALIDDATA; } if (tsmb_size > avpkt->size - m->tracksize) break; for (size_t i = 0; i < box_count; i++) { if (tsmb_type == box_types[i].type) { if (m->tracksize + m->size_var + box_types[i].base_size > avpkt->size) break; ret_tsmb = box_types[i].decode(tsmb, m, avpkt); if (ret_tsmb == -1) break; } } m->tracksize = m->tracksize + tsmb_size; } text_to_ass(&buf, ptr, end, m); } else text_to_ass(&buf, ptr, end, m); ret = ff_ass_add_rect(sub, buf.str, m->readorder++, 0, NULL, NULL); av_bprint_finalize(&buf, NULL); if (ret < 0) return ret; *got_sub_ptr = sub->num_rects > 0; return avpkt->size; }
true
FFmpeg
bac9c03ed9328c63aba46e280ba408431b53fcb4
static int mov_text_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { AVSubtitle *sub = data; MovTextContext *m = avctx->priv_data; int ret; AVBPrint buf; char *ptr = avpkt->data; char *end; int text_length, tsmb_type, ret_tsmb; uint64_t tsmb_size; const uint8_t *tsmb; if (!ptr || avpkt->size < 2) return AVERROR_INVALIDDATA; if (avpkt->size == 2) return AV_RB16(ptr) == 0 ? 0 : AVERROR_INVALIDDATA; text_length = AV_RB16(ptr); end = ptr + FFMIN(2 + text_length, avpkt->size); ptr += 2; tsmb_size = 0; m->tracksize = 2 + text_length; m->style_entries = 0; m->box_flags = 0; m->count_s = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); if (text_length + 2 != avpkt->size) { while (m->tracksize + 8 <= avpkt->size) { tsmb = ptr + m->tracksize - 2; tsmb_size = AV_RB32(tsmb); tsmb += 4; tsmb_type = AV_RB32(tsmb); tsmb += 4; if (tsmb_size == 1) { if (m->tracksize + 16 > avpkt->size) break; tsmb_size = AV_RB64(tsmb); tsmb += 8; m->size_var = 16; } else m->size_var = 8; if (tsmb_size == 0) { av_log(avctx, AV_LOG_ERROR, "tsmb_size is 0\n"); return AVERROR_INVALIDDATA; } if (tsmb_size > avpkt->size - m->tracksize) break; for (size_t i = 0; i < box_count; i++) { if (tsmb_type == box_types[i].type) { if (m->tracksize + m->size_var + box_types[i].base_size > avpkt->size) break; ret_tsmb = box_types[i].decode(tsmb, m, avpkt); if (ret_tsmb == -1) break; } } m->tracksize = m->tracksize + tsmb_size; } text_to_ass(&buf, ptr, end, m); } else text_to_ass(&buf, ptr, end, m); ret = ff_ass_add_rect(sub, buf.str, m->readorder++, 0, NULL, NULL); av_bprint_finalize(&buf, NULL); if (ret < 0) return ret; *got_sub_ptr = sub->num_rects > 0; return avpkt->size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVSubtitle *sub = VAR_1; MovTextContext *m = VAR_0->priv_data; int VAR_4; AVBPrint buf; char *VAR_5 = VAR_3->VAR_1; char *VAR_6; int VAR_7, VAR_8, VAR_9; uint64_t tsmb_size; const uint8_t *VAR_10; if (!VAR_5 || VAR_3->size < 2) return AVERROR_INVALIDDATA; if (VAR_3->size == 2) return AV_RB16(VAR_5) == 0 ? 0 : AVERROR_INVALIDDATA; VAR_7 = AV_RB16(VAR_5); VAR_6 = VAR_5 + FFMIN(2 + VAR_7, VAR_3->size); VAR_5 += 2; tsmb_size = 0; m->tracksize = 2 + VAR_7; m->style_entries = 0; m->box_flags = 0; m->count_s = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); if (VAR_7 + 2 != VAR_3->size) { while (m->tracksize + 8 <= VAR_3->size) { VAR_10 = VAR_5 + m->tracksize - 2; tsmb_size = AV_RB32(VAR_10); VAR_10 += 4; VAR_8 = AV_RB32(VAR_10); VAR_10 += 4; if (tsmb_size == 1) { if (m->tracksize + 16 > VAR_3->size) break; tsmb_size = AV_RB64(VAR_10); VAR_10 += 8; m->size_var = 16; } else m->size_var = 8; if (tsmb_size == 0) { av_log(VAR_0, AV_LOG_ERROR, "tsmb_size is 0\n"); return AVERROR_INVALIDDATA; } if (tsmb_size > VAR_3->size - m->tracksize) break; for (size_t i = 0; i < box_count; i++) { if (VAR_8 == box_types[i].type) { if (m->tracksize + m->size_var + box_types[i].base_size > VAR_3->size) break; VAR_9 = box_types[i].decode(VAR_10, m, VAR_3); if (VAR_9 == -1) break; } } m->tracksize = m->tracksize + tsmb_size; } text_to_ass(&buf, VAR_5, VAR_6, m); } else text_to_ass(&buf, VAR_5, VAR_6, m); VAR_4 = ff_ass_add_rect(sub, buf.str, m->readorder++, 0, NULL, NULL); av_bprint_finalize(&buf, NULL); if (VAR_4 < 0) return VAR_4; *VAR_2 = sub->num_rects > 0; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "AVSubtitle *sub = VAR_1;", "MovTextContext *m = VAR_0->priv_data;", "int VAR_4;", "AVBPrint buf;", "char *VAR_5 = VAR_3->VAR_1;", "char *VAR_6;", "int VAR_7, VAR_8, VAR_9;", "uint64_t tsmb_size;", "const uin...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 22, 23 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ ...
26,364
static int ra144_decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; static const uint8_t sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int refl_rms[NBLOCKS]; // RMS of the reflection coefficients int16_t block_coefs[NBLOCKS][LPC_ORDER]; // LPC coefficients of each sub-block unsigned int lpc_refl[LPC_ORDER]; // LPC reflection coefficients of the frame int i, j; int ret; int16_t *samples; unsigned int energy; RA144Context *ractx = avctx->priv_data; GetBitContext gb; if (buf_size < FRAME_SIZE) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); *got_frame_ptr = 0; return AVERROR_INVALIDDATA; } /* get output buffer */ frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; samples = (int16_t *)frame->data[0]; init_get_bits8(&gb, buf, FRAME_SIZE); for (i = 0; i < LPC_ORDER; i++) lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(&gb, sizes[i])]; ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); energy = ff_energy_tab[get_bits(&gb, 5)]; refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy*ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (i=0; i < NBLOCKS; i++) { do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb); for (j=0; j < BLOCKSIZE; j++) *samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2); } ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *got_frame_ptr = 1; return FRAME_SIZE; }
true
FFmpeg
53c0c637d36c1de9ea461a8d863e8703da090894
static int ra144_decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; static const uint8_t sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int refl_rms[NBLOCKS]; int16_t block_coefs[NBLOCKS][LPC_ORDER]; unsigned int lpc_refl[LPC_ORDER]; int i, j; int ret; int16_t *samples; unsigned int energy; RA144Context *ractx = avctx->priv_data; GetBitContext gb; if (buf_size < FRAME_SIZE) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); *got_frame_ptr = 0; return AVERROR_INVALIDDATA; } frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; samples = (int16_t *)frame->data[0]; init_get_bits8(&gb, buf, FRAME_SIZE); for (i = 0; i < LPC_ORDER; i++) lpc_refl[i] = ff_lpc_refl_cb[i][get_bits(&gb, sizes[i])]; ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); energy = ff_energy_tab[get_bits(&gb, 5)]; refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy*ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (i=0; i < NBLOCKS; i++) { do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb); for (j=0; j < BLOCKSIZE; j++) *samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2); } ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *got_frame_ptr = 1; return FRAME_SIZE; }
{ "code": [ " *samples++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);" ], "line_no": [ 109 ] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVFrame *frame = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; static const uint8_t VAR_6[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int VAR_7[NBLOCKS]; int16_t block_coefs[NBLOCKS][LPC_ORDER]; unsigned int VAR_8[LPC_ORDER]; int VAR_9, VAR_10; int VAR_11; int16_t *samples; unsigned int VAR_12; RA144Context *ractx = VAR_0->priv_data; GetBitContext gb; if (VAR_5 < FRAME_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", VAR_5); *VAR_2 = 0; return AVERROR_INVALIDDATA; } frame->nb_samples = NBLOCKS * BLOCKSIZE; if ((VAR_11 = ff_get_buffer(VAR_0, frame, 0)) < 0) return VAR_11; samples = (int16_t *)frame->VAR_1[0]; init_get_bits8(&gb, VAR_4, FRAME_SIZE); for (VAR_9 = 0; VAR_9 < LPC_ORDER; VAR_9++) VAR_8[VAR_9] = ff_lpc_refl_cb[VAR_9][get_bits(&gb, VAR_6[VAR_9])]; ff_eval_coefs(ractx->lpc_coef[0], VAR_8); ractx->lpc_refl_rms[0] = ff_rms(VAR_8); VAR_12 = ff_energy_tab[get_bits(&gb, 5)]; VAR_7[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); VAR_7[1] = ff_interp(ractx, block_coefs[1], 2, VAR_12 <= ractx->old_energy, ff_t_sqrt(VAR_12*ractx->old_energy) >> 12); VAR_7[2] = ff_interp(ractx, block_coefs[2], 3, 0, VAR_12); VAR_7[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], VAR_12); ff_int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (VAR_9=0; VAR_9 < NBLOCKS; VAR_9++) { do_output_subblock(ractx, block_coefs[VAR_9], VAR_7[VAR_9], &gb); for (VAR_10=0; VAR_10 < BLOCKSIZE; VAR_10++) *samples++ = av_clip_int16(ractx->curr_sblock[VAR_10 + 10] << 2); } ractx->old_energy = VAR_12; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *VAR_2 = 1; return FRAME_SIZE; }
[ "static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "AVFrame *frame = VAR_1;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "static const uint8_t VAR_6[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};", "unsigned int VAR_7[NBLOCKS];", "int16_...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ...
26,365
static void iscsi_timed_set_events(void *opaque) { IscsiLun *iscsilun = opaque; iscsi_set_events(iscsilun); }
true
qemu
5dd7a535b71a0f2f8e7af75c5d694174359ce323
static void iscsi_timed_set_events(void *opaque) { IscsiLun *iscsilun = opaque; iscsi_set_events(iscsilun); }
{ "code": [ "static void iscsi_timed_set_events(void *opaque)" ], "line_no": [ 1 ] }
static void FUNC_0(void *VAR_0) { IscsiLun *iscsilun = VAR_0; iscsi_set_events(iscsilun); }
[ "static void FUNC_0(void *VAR_0)\n{", "IscsiLun *iscsilun = VAR_0;", "iscsi_set_events(iscsilun);", "}" ]
[ 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,366
void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, int flags) { MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; int i; cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx " LO=0x" TARGET_FMT_lx " ds %04x " TARGET_FMT_lx " " TARGET_FMT_ld "\n", env->active_tc.PC, env->active_tc.HI[0], env->active_tc.LO[0], env->hflags, env->btarget, env->bcond); for (i = 0; i < 32; i++) { if ((i & 3) == 0) cpu_fprintf(f, "GPR%02d:", i); cpu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->active_tc.gpr[i]); if ((i & 3) == 3) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "CP0 Status 0x%08x Cause 0x%08x EPC 0x" TARGET_FMT_lx "\n", env->CP0_Status, env->CP0_Cause, env->CP0_EPC); cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x%016" PRIx64 "\n", env->CP0_Config0, env->CP0_Config1, env->lladdr); cpu_fprintf(f, " Config2 0x%08x Config3 0x%08x\n", env->CP0_Config2, env->CP0_Config3); cpu_fprintf(f, " Config4 0x%08x Config5 0x%08x\n", env->CP0_Config4, env->CP0_Config5); if (env->hflags & MIPS_HFLAG_FPU) fpu_dump_state(env, f, cpu_fprintf, flags); #if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS) cpu_mips_check_sign_extensions(env, f, cpu_fprintf, flags); #endif }
true
qemu
b307446e04232b3a87e9da04886895a8e5a4a407
void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, int flags) { MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; int i; cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx " LO=0x" TARGET_FMT_lx " ds %04x " TARGET_FMT_lx " " TARGET_FMT_ld "\n", env->active_tc.PC, env->active_tc.HI[0], env->active_tc.LO[0], env->hflags, env->btarget, env->bcond); for (i = 0; i < 32; i++) { if ((i & 3) == 0) cpu_fprintf(f, "GPR%02d:", i); cpu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->active_tc.gpr[i]); if ((i & 3) == 3) cpu_fprintf(f, "\n"); } cpu_fprintf(f, "CP0 Status 0x%08x Cause 0x%08x EPC 0x" TARGET_FMT_lx "\n", env->CP0_Status, env->CP0_Cause, env->CP0_EPC); cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x%016" PRIx64 "\n", env->CP0_Config0, env->CP0_Config1, env->lladdr); cpu_fprintf(f, " Config2 0x%08x Config3 0x%08x\n", env->CP0_Config2, env->CP0_Config3); cpu_fprintf(f, " Config4 0x%08x Config5 0x%08x\n", env->CP0_Config4, env->CP0_Config5); if (env->hflags & MIPS_HFLAG_FPU) fpu_dump_state(env, f, cpu_fprintf, flags); #if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS) cpu_mips_check_sign_extensions(env, f, cpu_fprintf, flags); #endif }
{ "code": [ "#if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS)", " int i;", " for (i = 0; i < 32; i++) {", "#endif", "#if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS)", " cpu_mips_check_sign_extensions(env, f, cpu_fprintf, flags);", "#endif" ], "line_no": [ 63, 11, 25, 67, 63, 65, 67 ] }
void FUNC_0(CPUState *VAR_0, FILE *VAR_1, fprintf_function VAR_2, int VAR_3) { MIPSCPU *cpu = MIPS_CPU(VAR_0); CPUMIPSState *env = &cpu->env; int VAR_4; VAR_2(VAR_1, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx " LO=0x" TARGET_FMT_lx " ds %04x " TARGET_FMT_lx " " TARGET_FMT_ld "\n", env->active_tc.PC, env->active_tc.HI[0], env->active_tc.LO[0], env->hflags, env->btarget, env->bcond); for (VAR_4 = 0; VAR_4 < 32; VAR_4++) { if ((VAR_4 & 3) == 0) VAR_2(VAR_1, "GPR%02d:", VAR_4); VAR_2(VAR_1, " %s " TARGET_FMT_lx, regnames[VAR_4], env->active_tc.gpr[VAR_4]); if ((VAR_4 & 3) == 3) VAR_2(VAR_1, "\n"); } VAR_2(VAR_1, "CP0 Status 0x%08x Cause 0x%08x EPC 0x" TARGET_FMT_lx "\n", env->CP0_Status, env->CP0_Cause, env->CP0_EPC); VAR_2(VAR_1, " Config0 0x%08x Config1 0x%08x LLAddr 0x%016" PRIx64 "\n", env->CP0_Config0, env->CP0_Config1, env->lladdr); VAR_2(VAR_1, " Config2 0x%08x Config3 0x%08x\n", env->CP0_Config2, env->CP0_Config3); VAR_2(VAR_1, " Config4 0x%08x Config5 0x%08x\n", env->CP0_Config4, env->CP0_Config5); if (env->hflags & MIPS_HFLAG_FPU) fpu_dump_state(env, VAR_1, VAR_2, VAR_3); #if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS) cpu_mips_check_sign_extensions(env, VAR_1, VAR_2, VAR_3); #endif }
[ "void FUNC_0(CPUState *VAR_0, FILE *VAR_1, fprintf_function VAR_2,\nint VAR_3)\n{", "MIPSCPU *cpu = MIPS_CPU(VAR_0);", "CPUMIPSState *env = &cpu->env;", "int VAR_4;", "VAR_2(VAR_1, \"pc=0x\" TARGET_FMT_lx \" HI=0x\" TARGET_FMT_lx\n\" LO=0x\" TARGET_FMT_lx \" ds %04x \"\nTARGET_FMT_lx \" \" TARGET_FMT_ld \"\...
[ 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19, 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41, 43 ], [ 45, 47, 49 ], [ 51, 53 ], [ 55, 57 ...
26,369
static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque) { SerialState *s = opaque; do { if (s->tsr_retry <= 0) { if (s->fcr & UART_FCR_FE) { if (fifo8_is_empty(&s->xmit_fifo)) { return FALSE; } s->tsr = fifo8_pop(&s->xmit_fifo); if (!s->xmit_fifo.num) { s->lsr |= UART_LSR_THRE; } } else if ((s->lsr & UART_LSR_THRE)) { return FALSE; } else { s->tsr = s->thr; s->lsr |= UART_LSR_THRE; s->lsr &= ~UART_LSR_TEMT; } } if (s->mcr & UART_MCR_LOOP) { /* in loopback mode, say that we just received a char */ serial_receive1(s, &s->tsr, 1); } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) { if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY && qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s) > 0) { s->tsr_retry++; return FALSE; } s->tsr_retry = 0; } else { s->tsr_retry = 0; } /* Transmit another byte if it is already available. It is only possible when FIFO is enabled and not empty. */ } while ((s->fcr & UART_FCR_FE) && !fifo8_is_empty(&s->xmit_fifo)); s->last_xmit_ts = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (s->lsr & UART_LSR_THRE) { s->lsr |= UART_LSR_TEMT; s->thr_ipending = 1; serial_update_irq(s); } return FALSE; }
true
qemu
0d931d706266d6ada3bf22d3afca1afdc8d12fa9
static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque) { SerialState *s = opaque; do { if (s->tsr_retry <= 0) { if (s->fcr & UART_FCR_FE) { if (fifo8_is_empty(&s->xmit_fifo)) { return FALSE; } s->tsr = fifo8_pop(&s->xmit_fifo); if (!s->xmit_fifo.num) { s->lsr |= UART_LSR_THRE; } } else if ((s->lsr & UART_LSR_THRE)) { return FALSE; } else { s->tsr = s->thr; s->lsr |= UART_LSR_THRE; s->lsr &= ~UART_LSR_TEMT; } } if (s->mcr & UART_MCR_LOOP) { serial_receive1(s, &s->tsr, 1); } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) { if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY && qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s) > 0) { s->tsr_retry++; return FALSE; } s->tsr_retry = 0; } else { s->tsr_retry = 0; } } while ((s->fcr & UART_FCR_FE) && !fifo8_is_empty(&s->xmit_fifo)); s->last_xmit_ts = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (s->lsr & UART_LSR_THRE) { s->lsr |= UART_LSR_TEMT; s->thr_ipending = 1; serial_update_irq(s); } return FALSE; }
{ "code": [ " if (fifo8_is_empty(&s->xmit_fifo)) {", " return FALSE;", " } else if ((s->lsr & UART_LSR_THRE)) {", " return FALSE;", " s->lsr &= ~UART_LSR_TEMT;", " } while ((s->fcr & UART_FCR_FE) && !fifo8_is_empty(&s->xmit_fifo));", " if (s->lsr & UART_LSR_THRE) {", " s->lsr |= UART_LSR_TEMT;", " s->thr_ipending = 1;", " serial_update_irq(s);", " s->lsr &= ~UART_LSR_TEMT;" ], "line_no": [ 15, 17, 29, 31, 39, 79, 87, 89, 91, 93, 39 ] }
static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, void *opaque) { SerialState *s = opaque; do { if (s->tsr_retry <= 0) { if (s->fcr & UART_FCR_FE) { if (fifo8_is_empty(&s->xmit_fifo)) { return FALSE; } s->tsr = fifo8_pop(&s->xmit_fifo); if (!s->xmit_fifo.num) { s->lsr |= UART_LSR_THRE; } } else if ((s->lsr & UART_LSR_THRE)) { return FALSE; } else { s->tsr = s->thr; s->lsr |= UART_LSR_THRE; s->lsr &= ~UART_LSR_TEMT; } } if (s->mcr & UART_MCR_LOOP) { serial_receive1(s, &s->tsr, 1); } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) { if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY && qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, FUNC_0, s) > 0) { s->tsr_retry++; return FALSE; } s->tsr_retry = 0; } else { s->tsr_retry = 0; } } while ((s->fcr & UART_FCR_FE) && !fifo8_is_empty(&s->xmit_fifo)); s->last_xmit_ts = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (s->lsr & UART_LSR_THRE) { s->lsr |= UART_LSR_TEMT; s->thr_ipending = 1; serial_update_irq(s); } return FALSE; }
[ "static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, void *opaque)\n{", "SerialState *s = opaque;", "do {", "if (s->tsr_retry <= 0) {", "if (s->fcr & UART_FCR_FE) {", "if (fifo8_is_empty(&s->xmit_fifo)) {", "return FALSE;", "}", "s->tsr = fifo8_pop(&s->xmit_fifo);", "if (!s->xmit_fifo.num)...
[ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43...
26,370
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) { v->res_rtm_flag = 1; v->level = get_bits(gb, 3); if (v->level >= 5) { av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level); } v->chromaformat = get_bits(gb, 2); if (v->chromaformat != 1) { av_log(v->s.avctx, AV_LOG_ERROR, "Only 4:2:0 chroma format supported\n"); return -1; } // (fps-2)/4 (->30) v->frmrtq_postproc = get_bits(gb, 3); //common // (bitrate-32kbps)/64kbps v->bitrtq_postproc = get_bits(gb, 5); //common v->postprocflag = get_bits1(gb); //common v->s.avctx->coded_width = (get_bits(gb, 12) + 1) << 1; v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1; v->s.avctx->width = v->s.avctx->coded_width; v->s.avctx->height = v->s.avctx->coded_height; v->broadcast = get_bits1(gb); v->interlace = get_bits1(gb); v->tfcntrflag = get_bits1(gb); v->finterpflag = get_bits1(gb); skip_bits1(gb); // reserved av_log(v->s.avctx, AV_LOG_DEBUG, "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n" "TFCTRflag=%i, FINTERPflag=%i\n", v->level, v->frmrtq_postproc, v->bitrtq_postproc, v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace, v->tfcntrflag, v->finterpflag); v->psf = get_bits1(gb); if (v->psf) { //PsF, 6.1.13 av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); return -1; } v->s.max_b_frames = v->s.avctx->max_b_frames = 7; if (get_bits1(gb)) { //Display Info - decoding is not affected by it int w, h, ar = 0; av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n"); w = get_bits(gb, 14) + 1; h = get_bits(gb, 14) + 1; av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h); if (get_bits1(gb)) ar = get_bits(gb, 4); if (ar && ar < 14) { v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar]; } else if (ar == 15) { w = get_bits(gb, 8) + 1; h = get_bits(gb, 8) + 1; v->s.avctx->sample_aspect_ratio = (AVRational){w, h}; } else { av_reduce(&v->s.avctx->sample_aspect_ratio.num, &v->s.avctx->sample_aspect_ratio.den, v->s.avctx->height * w, v->s.avctx->width * h, 1 << 30); } av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n", v->s.avctx->sample_aspect_ratio.num, v->s.avctx->sample_aspect_ratio.den); if (get_bits1(gb)) { //framerate stuff if (get_bits1(gb)) { v->s.avctx->time_base.num = 32; v->s.avctx->time_base.den = get_bits(gb, 16) + 1; } else { int nr, dr; nr = get_bits(gb, 8); dr = get_bits(gb, 4); if (nr && nr < 8 && dr && dr < 3) { v->s.avctx->time_base.num = ff_vc1_fps_dr[dr - 1]; v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000; } } if (v->broadcast) { // Pulldown may be present v->s.avctx->time_base.den *= 2; v->s.avctx->ticks_per_frame = 2; } } if (get_bits1(gb)) { v->color_prim = get_bits(gb, 8); v->transfer_char = get_bits(gb, 8); v->matrix_coef = get_bits(gb, 8); } } v->hrd_param_flag = get_bits1(gb); if (v->hrd_param_flag) { int i; v->hrd_num_leaky_buckets = get_bits(gb, 5); skip_bits(gb, 4); //bitrate exponent skip_bits(gb, 4); //buffer size exponent for (i = 0; i < v->hrd_num_leaky_buckets; i++) { skip_bits(gb, 16); //hrd_rate[n] skip_bits(gb, 16); //hrd_buffer[n] } } return 0; }
false
FFmpeg
95b192de5d05f3e1542e7b2378cdefbc195f5185
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) { v->res_rtm_flag = 1; v->level = get_bits(gb, 3); if (v->level >= 5) { av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level); } v->chromaformat = get_bits(gb, 2); if (v->chromaformat != 1) { av_log(v->s.avctx, AV_LOG_ERROR, "Only 4:2:0 chroma format supported\n"); return -1; } v->frmrtq_postproc = get_bits(gb, 3); v->bitrtq_postproc = get_bits(gb, 5); v->postprocflag = get_bits1(gb); v->s.avctx->coded_width = (get_bits(gb, 12) + 1) << 1; v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1; v->s.avctx->width = v->s.avctx->coded_width; v->s.avctx->height = v->s.avctx->coded_height; v->broadcast = get_bits1(gb); v->interlace = get_bits1(gb); v->tfcntrflag = get_bits1(gb); v->finterpflag = get_bits1(gb); skip_bits1(gb); av_log(v->s.avctx, AV_LOG_DEBUG, "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n" "TFCTRflag=%i, FINTERPflag=%i\n", v->level, v->frmrtq_postproc, v->bitrtq_postproc, v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace, v->tfcntrflag, v->finterpflag); v->psf = get_bits1(gb); if (v->psf) { av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); return -1; } v->s.max_b_frames = v->s.avctx->max_b_frames = 7; if (get_bits1(gb)) { int w, h, ar = 0; av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n"); w = get_bits(gb, 14) + 1; h = get_bits(gb, 14) + 1; av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h); if (get_bits1(gb)) ar = get_bits(gb, 4); if (ar && ar < 14) { v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar]; } else if (ar == 15) { w = get_bits(gb, 8) + 1; h = get_bits(gb, 8) + 1; v->s.avctx->sample_aspect_ratio = (AVRational){w, h}; } else { av_reduce(&v->s.avctx->sample_aspect_ratio.num, &v->s.avctx->sample_aspect_ratio.den, v->s.avctx->height * w, v->s.avctx->width * h, 1 << 30); } av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n", v->s.avctx->sample_aspect_ratio.num, v->s.avctx->sample_aspect_ratio.den); if (get_bits1(gb)) { if (get_bits1(gb)) { v->s.avctx->time_base.num = 32; v->s.avctx->time_base.den = get_bits(gb, 16) + 1; } else { int nr, dr; nr = get_bits(gb, 8); dr = get_bits(gb, 4); if (nr && nr < 8 && dr && dr < 3) { v->s.avctx->time_base.num = ff_vc1_fps_dr[dr - 1]; v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000; } } if (v->broadcast) { v->s.avctx->time_base.den *= 2; v->s.avctx->ticks_per_frame = 2; } } if (get_bits1(gb)) { v->color_prim = get_bits(gb, 8); v->transfer_char = get_bits(gb, 8); v->matrix_coef = get_bits(gb, 8); } } v->hrd_param_flag = get_bits1(gb); if (v->hrd_param_flag) { int i; v->hrd_num_leaky_buckets = get_bits(gb, 5); skip_bits(gb, 4); skip_bits(gb, 4); for (i = 0; i < v->hrd_num_leaky_buckets; i++) { skip_bits(gb, 16); skip_bits(gb, 16); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VC1Context *VAR_0, GetBitContext *VAR_1) { VAR_0->res_rtm_flag = 1; VAR_0->level = get_bits(VAR_1, 3); if (VAR_0->level >= 5) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %VAR_7\n",VAR_0->level); } VAR_0->chromaformat = get_bits(VAR_1, 2); if (VAR_0->chromaformat != 1) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Only 4:2:0 chroma format supported\n"); return -1; } VAR_0->frmrtq_postproc = get_bits(VAR_1, 3); VAR_0->bitrtq_postproc = get_bits(VAR_1, 5); VAR_0->postprocflag = get_bits1(VAR_1); VAR_0->s.avctx->coded_width = (get_bits(VAR_1, 12) + 1) << 1; VAR_0->s.avctx->coded_height = (get_bits(VAR_1, 12) + 1) << 1; VAR_0->s.avctx->width = VAR_0->s.avctx->coded_width; VAR_0->s.avctx->height = VAR_0->s.avctx->coded_height; VAR_0->broadcast = get_bits1(VAR_1); VAR_0->interlace = get_bits1(VAR_1); VAR_0->tfcntrflag = get_bits1(VAR_1); VAR_0->finterpflag = get_bits1(VAR_1); skip_bits1(VAR_1); av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "Advanced Profile level %VAR_7:\nfrmrtq_postproc=%VAR_7, bitrtq_postproc=%VAR_7\n" "LoopFilter=%VAR_7, ChromaFormat=%VAR_7, Pulldown=%VAR_7, Interlace: %VAR_7\n" "TFCTRflag=%VAR_7, FINTERPflag=%VAR_7\n", VAR_0->level, VAR_0->frmrtq_postproc, VAR_0->bitrtq_postproc, VAR_0->s.loop_filter, VAR_0->chromaformat, VAR_0->broadcast, VAR_0->interlace, VAR_0->tfcntrflag, VAR_0->finterpflag); VAR_0->psf = get_bits1(VAR_1); if (VAR_0->psf) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); return -1; } VAR_0->s.max_b_frames = VAR_0->s.avctx->max_b_frames = 7; if (get_bits1(VAR_1)) { int VAR_2, VAR_3, VAR_4 = 0; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "Display extended info:\n"); VAR_2 = get_bits(VAR_1, 14) + 1; VAR_3 = get_bits(VAR_1, 14) + 1; av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%VAR_7\n", VAR_2, VAR_3); if (get_bits1(VAR_1)) VAR_4 = get_bits(VAR_1, 4); if (VAR_4 && VAR_4 < 14) { VAR_0->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[VAR_4]; } else if (VAR_4 == 15) { VAR_2 = get_bits(VAR_1, 8) + 1; VAR_3 = get_bits(VAR_1, 8) + 1; VAR_0->s.avctx->sample_aspect_ratio = (AVRational){VAR_2, VAR_3}; } else { av_reduce(&VAR_0->s.avctx->sample_aspect_ratio.num, &VAR_0->s.avctx->sample_aspect_ratio.den, VAR_0->s.avctx->height * VAR_2, VAR_0->s.avctx->width * VAR_3, 1 << 30); } av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "Aspect: %VAR_7:%VAR_7\n", VAR_0->s.avctx->sample_aspect_ratio.num, VAR_0->s.avctx->sample_aspect_ratio.den); if (get_bits1(VAR_1)) { if (get_bits1(VAR_1)) { VAR_0->s.avctx->time_base.num = 32; VAR_0->s.avctx->time_base.den = get_bits(VAR_1, 16) + 1; } else { int VAR_5, VAR_6; VAR_5 = get_bits(VAR_1, 8); VAR_6 = get_bits(VAR_1, 4); if (VAR_5 && VAR_5 < 8 && VAR_6 && VAR_6 < 3) { VAR_0->s.avctx->time_base.num = ff_vc1_fps_dr[VAR_6 - 1]; VAR_0->s.avctx->time_base.den = ff_vc1_fps_nr[VAR_5 - 1] * 1000; } } if (VAR_0->broadcast) { VAR_0->s.avctx->time_base.den *= 2; VAR_0->s.avctx->ticks_per_frame = 2; } } if (get_bits1(VAR_1)) { VAR_0->color_prim = get_bits(VAR_1, 8); VAR_0->transfer_char = get_bits(VAR_1, 8); VAR_0->matrix_coef = get_bits(VAR_1, 8); } } VAR_0->hrd_param_flag = get_bits1(VAR_1); if (VAR_0->hrd_param_flag) { int VAR_7; VAR_0->hrd_num_leaky_buckets = get_bits(VAR_1, 5); skip_bits(VAR_1, 4); skip_bits(VAR_1, 4); for (VAR_7 = 0; VAR_7 < VAR_0->hrd_num_leaky_buckets; VAR_7++) { skip_bits(VAR_1, 16); skip_bits(VAR_1, 16); } } return 0; }
[ "static int FUNC_0(VC1Context *VAR_0, GetBitContext *VAR_1)\n{", "VAR_0->res_rtm_flag = 1;", "VAR_0->level = get_bits(VAR_1, 3);", "if (VAR_0->level >= 5) {", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"Reserved LEVEL %VAR_7\\n\",VAR_0->level);", "}", "VAR_0->chromaformat = get_bits(VAR_1, 2);", "if (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...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [...