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
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
3,300
static always_inline void gen_arith3 (void *helper, int ra, int rb, int rc, int islit, uint8_t lit) { if (unlikely(rc == 31)) return; if (ra != 31) { if (islit) { TCGv tmp = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], tmp); tcg_temp_free(tmp); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { TCGv tmp1 = tcg_const_i64(0); if (islit) { TCGv tmp2 = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, tmp2); tcg_temp_free(tmp2); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, cpu_ir[rb]); tcg_temp_free(tmp1); } }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static always_inline void gen_arith3 (void *helper, int ra, int rb, int rc, int islit, uint8_t lit) { if (unlikely(rc == 31)) return; if (ra != 31) { if (islit) { TCGv tmp = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], tmp); tcg_temp_free(tmp); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { TCGv tmp1 = tcg_const_i64(0); if (islit) { TCGv tmp2 = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, tmp2); tcg_temp_free(tmp2); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, cpu_ir[rb]); tcg_temp_free(tmp1); } }
{ "code": [], "line_no": [] }
static always_inline void FUNC_0 (void *helper, int ra, int rb, int rc, int islit, uint8_t lit) { if (unlikely(rc == 31)) return; if (ra != 31) { if (islit) { TCGv tmp = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], tmp); tcg_temp_free(tmp); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { TCGv tmp1 = tcg_const_i64(0); if (islit) { TCGv tmp2 = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, tmp2); tcg_temp_free(tmp2); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, cpu_ir[rb]); tcg_temp_free(tmp1); } }
[ "static always_inline void FUNC_0 (void *helper,\nint ra, int rb, int rc,\nint islit, uint8_t lit)\n{", "if (unlikely(rc == 31))\nreturn;", "if (ra != 31) {", "if (islit) {", "TCGv tmp = tcg_const_i64(lit);", "tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], tmp);", "tcg_temp_free(tmp);", "} else", "tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "TCGv tmp1 = tcg_const_i64(0);", "if (islit) {", "TCGv tmp2 = tcg_const_i64(lit);", "tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, tmp2);", "tcg_temp_free(tmp2);", "} else", "tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, cpu_ir[rb]);", "tcg_temp_free(tmp1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
3,301
int cpu_get_dump_info(ArchDumpInfo *info, const struct GuestPhysBlockList *guest_phys_blocks) { PowerPCCPU *cpu = POWERPC_CPU(first_cpu); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); info->d_machine = PPC_ELF_MACHINE; info->d_class = ELFCLASS; if ((*pcc->interrupts_big_endian)(cpu)) { info->d_endian = ELFDATA2MSB; } else { info->d_endian = ELFDATA2LSB; } /* 64KB is the max page size for pseries kernel */ if (strncmp(object_get_typename(qdev_get_machine()), "pseries-", 8) == 0) { info->page_size = (1U << 16); } return 0; }
false
qemu
b1fde1ef5106c92dd12f1f0cfcb8c76e57d7f681
int cpu_get_dump_info(ArchDumpInfo *info, const struct GuestPhysBlockList *guest_phys_blocks) { PowerPCCPU *cpu = POWERPC_CPU(first_cpu); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); info->d_machine = PPC_ELF_MACHINE; info->d_class = ELFCLASS; if ((*pcc->interrupts_big_endian)(cpu)) { info->d_endian = ELFDATA2MSB; } else { info->d_endian = ELFDATA2LSB; } if (strncmp(object_get_typename(qdev_get_machine()), "pseries-", 8) == 0) { info->page_size = (1U << 16); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(ArchDumpInfo *VAR_0, const struct GuestPhysBlockList *VAR_1) { PowerPCCPU *cpu = POWERPC_CPU(first_cpu); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); VAR_0->d_machine = PPC_ELF_MACHINE; VAR_0->d_class = ELFCLASS; if ((*pcc->interrupts_big_endian)(cpu)) { VAR_0->d_endian = ELFDATA2MSB; } else { VAR_0->d_endian = ELFDATA2LSB; } if (strncmp(object_get_typename(qdev_get_machine()), "pseries-", 8) == 0) { VAR_0->page_size = (1U << 16); } return 0; }
[ "int FUNC_0(ArchDumpInfo *VAR_0,\nconst struct GuestPhysBlockList *VAR_1)\n{", "PowerPCCPU *cpu = POWERPC_CPU(first_cpu);", "PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);", "VAR_0->d_machine = PPC_ELF_MACHINE;", "VAR_0->d_class = ELFCLASS;", "if ((*pcc->interrupts_big_endian)(cpu)) {", "VAR_0->d_endian = ELFDATA2MSB;", "} else {", "VAR_0->d_endian = ELFDATA2LSB;", "}", "if (strncmp(object_get_typename(qdev_get_machine()),\n\"pseries-\", 8) == 0) {", "VAR_0->page_size = (1U << 16);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
3,303
static CharDriverState *qemu_chr_open_pty(QemuOpts *opts) { CharDriverState *chr; PtyCharDriver *s; struct termios tty; const char *label; int master_fd, slave_fd, len; #if defined(__OpenBSD__) || defined(__DragonFly__) char pty_name[PATH_MAX]; #define q_ptsname(x) pty_name #else char *pty_name = NULL; #define q_ptsname(x) ptsname(x) #endif if (openpty(&master_fd, &slave_fd, pty_name, NULL, NULL) < 0) { return NULL; } /* Set raw attributes on the pty. */ tcgetattr(slave_fd, &tty); cfmakeraw(&tty); tcsetattr(slave_fd, TCSAFLUSH, &tty); close(slave_fd); chr = g_malloc0(sizeof(CharDriverState)); len = strlen(q_ptsname(master_fd)) + 5; chr->filename = g_malloc(len); snprintf(chr->filename, len, "pty:%s", q_ptsname(master_fd)); qemu_opt_set(opts, "path", q_ptsname(master_fd)); label = qemu_opts_id(opts); fprintf(stderr, "char device redirected to %s%s%s%s\n", q_ptsname(master_fd), label ? " (label " : "", label ? label : "", label ? ")" : ""); s = g_malloc0(sizeof(PtyCharDriver)); chr->opaque = s; chr->chr_write = pty_chr_write; chr->chr_update_read_handler = pty_chr_update_read_handler; chr->chr_close = pty_chr_close; chr->chr_add_watch = pty_chr_add_watch; s->fd = io_channel_from_fd(master_fd); s->timer_tag = 0; return chr; }
false
qemu
e68c5958668596a5023e30ddf8368410878f7682
static CharDriverState *qemu_chr_open_pty(QemuOpts *opts) { CharDriverState *chr; PtyCharDriver *s; struct termios tty; const char *label; int master_fd, slave_fd, len; #if defined(__OpenBSD__) || defined(__DragonFly__) char pty_name[PATH_MAX]; #define q_ptsname(x) pty_name #else char *pty_name = NULL; #define q_ptsname(x) ptsname(x) #endif if (openpty(&master_fd, &slave_fd, pty_name, NULL, NULL) < 0) { return NULL; } tcgetattr(slave_fd, &tty); cfmakeraw(&tty); tcsetattr(slave_fd, TCSAFLUSH, &tty); close(slave_fd); chr = g_malloc0(sizeof(CharDriverState)); len = strlen(q_ptsname(master_fd)) + 5; chr->filename = g_malloc(len); snprintf(chr->filename, len, "pty:%s", q_ptsname(master_fd)); qemu_opt_set(opts, "path", q_ptsname(master_fd)); label = qemu_opts_id(opts); fprintf(stderr, "char device redirected to %s%s%s%s\n", q_ptsname(master_fd), label ? " (label " : "", label ? label : "", label ? ")" : ""); s = g_malloc0(sizeof(PtyCharDriver)); chr->opaque = s; chr->chr_write = pty_chr_write; chr->chr_update_read_handler = pty_chr_update_read_handler; chr->chr_close = pty_chr_close; chr->chr_add_watch = pty_chr_add_watch; s->fd = io_channel_from_fd(master_fd); s->timer_tag = 0; return chr; }
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(QemuOpts *opts) { CharDriverState *chr; PtyCharDriver *s; struct termios VAR_0; const char *VAR_1; int VAR_2, VAR_3, VAR_4; #if defined(__OpenBSD__) || defined(__DragonFly__) char VAR_5[PATH_MAX]; #define q_ptsname(x) VAR_5 #else char *VAR_5 = NULL; #define q_ptsname(x) ptsname(x) #endif if (openpty(&VAR_2, &VAR_3, VAR_5, NULL, NULL) < 0) { return NULL; } tcgetattr(VAR_3, &VAR_0); cfmakeraw(&VAR_0); tcsetattr(VAR_3, TCSAFLUSH, &VAR_0); close(VAR_3); chr = g_malloc0(sizeof(CharDriverState)); VAR_4 = strlen(q_ptsname(VAR_2)) + 5; chr->filename = g_malloc(VAR_4); snprintf(chr->filename, VAR_4, "pty:%s", q_ptsname(VAR_2)); qemu_opt_set(opts, "path", q_ptsname(VAR_2)); VAR_1 = qemu_opts_id(opts); fprintf(stderr, "char device redirected to %s%s%s%s\n", q_ptsname(VAR_2), VAR_1 ? " (VAR_1 " : "", VAR_1 ? VAR_1 : "", VAR_1 ? ")" : ""); s = g_malloc0(sizeof(PtyCharDriver)); chr->opaque = s; chr->chr_write = pty_chr_write; chr->chr_update_read_handler = pty_chr_update_read_handler; chr->chr_close = pty_chr_close; chr->chr_add_watch = pty_chr_add_watch; s->fd = io_channel_from_fd(VAR_2); s->timer_tag = 0; return chr; }
[ "static CharDriverState *FUNC_0(QemuOpts *opts)\n{", "CharDriverState *chr;", "PtyCharDriver *s;", "struct termios VAR_0;", "const char *VAR_1;", "int VAR_2, VAR_3, VAR_4;", "#if defined(__OpenBSD__) || defined(__DragonFly__)\nchar VAR_5[PATH_MAX];", "#define q_ptsname(x) VAR_5\n#else\nchar *VAR_5 = NULL;", "#define q_ptsname(x) ptsname(x)\n#endif\nif (openpty(&VAR_2, &VAR_3, VAR_5, NULL, NULL) < 0) {", "return NULL;", "}", "tcgetattr(VAR_3, &VAR_0);", "cfmakeraw(&VAR_0);", "tcsetattr(VAR_3, TCSAFLUSH, &VAR_0);", "close(VAR_3);", "chr = g_malloc0(sizeof(CharDriverState));", "VAR_4 = strlen(q_ptsname(VAR_2)) + 5;", "chr->filename = g_malloc(VAR_4);", "snprintf(chr->filename, VAR_4, \"pty:%s\", q_ptsname(VAR_2));", "qemu_opt_set(opts, \"path\", q_ptsname(VAR_2));", "VAR_1 = qemu_opts_id(opts);", "fprintf(stderr, \"char device redirected to %s%s%s%s\\n\",\nq_ptsname(VAR_2),\nVAR_1 ? \" (VAR_1 \" : \"\",\nVAR_1 ? VAR_1 : \"\",\nVAR_1 ? \")\" : \"\");", "s = g_malloc0(sizeof(PtyCharDriver));", "chr->opaque = s;", "chr->chr_write = pty_chr_write;", "chr->chr_update_read_handler = pty_chr_update_read_handler;", "chr->chr_close = pty_chr_close;", "chr->chr_add_watch = pty_chr_add_watch;", "s->fd = io_channel_from_fd(VAR_2);", "s->timer_tag = 0;", "return chr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69, 71, 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
3,304
static void put_frame( AVFormatContext *s, ASFStream *stream, int timestamp, const uint8_t *buf, int m_obj_size ) { ASFContext *asf = s->priv_data; int m_obj_offset, payload_len, frag_len1; m_obj_offset = 0; while (m_obj_offset < m_obj_size) { payload_len = m_obj_size - m_obj_offset; if (asf->packet_timestamp_start == -1) { asf->multi_payloads_present = (payload_len < MULTI_PAYLOAD_CONSTANT); if (asf->multi_payloads_present){ asf->packet_size_left = PACKET_SIZE; //For debug asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE - 1; frag_len1 = MULTI_PAYLOAD_CONSTANT - 1; } else { asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE; frag_len1 = SINGLE_PAYLOAD_DATA_LENGTH; } if (asf->prev_packet_sent_time > timestamp) asf->packet_timestamp_start = asf->prev_packet_sent_time; else asf->packet_timestamp_start = timestamp; } else { // multi payloads frag_len1 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS; if (asf->prev_packet_sent_time > timestamp) asf->packet_timestamp_start = asf->prev_packet_sent_time; else if (asf->packet_timestamp_start >= timestamp) asf->packet_timestamp_start = timestamp; } if (frag_len1 > 0) { if (payload_len > frag_len1) payload_len = frag_len1; else if (payload_len == (frag_len1 - 1)) payload_len = frag_len1 - 2; //additional byte need to put padding length put_payload_header(s, stream, timestamp+preroll_time, m_obj_size, m_obj_offset, payload_len); put_buffer(&asf->pb, buf, payload_len); if (asf->multi_payloads_present) asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); else asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD); asf->packet_timestamp_end = timestamp; asf->packet_nb_payloads++; } else { payload_len = 0; } m_obj_offset += payload_len; buf += payload_len; if (!asf->multi_payloads_present) flush_packet(s); else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + 1)) flush_packet(s); } stream->seq++; }
false
FFmpeg
3c895fc098f7637f6d5ec3a9d6766e724a8b9e41
static void put_frame( AVFormatContext *s, ASFStream *stream, int timestamp, const uint8_t *buf, int m_obj_size ) { ASFContext *asf = s->priv_data; int m_obj_offset, payload_len, frag_len1; m_obj_offset = 0; while (m_obj_offset < m_obj_size) { payload_len = m_obj_size - m_obj_offset; if (asf->packet_timestamp_start == -1) { asf->multi_payloads_present = (payload_len < MULTI_PAYLOAD_CONSTANT); if (asf->multi_payloads_present){ asf->packet_size_left = PACKET_SIZE; asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE - 1; frag_len1 = MULTI_PAYLOAD_CONSTANT - 1; } else { asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE; frag_len1 = SINGLE_PAYLOAD_DATA_LENGTH; } if (asf->prev_packet_sent_time > timestamp) asf->packet_timestamp_start = asf->prev_packet_sent_time; else asf->packet_timestamp_start = timestamp; } else { frag_len1 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS; if (asf->prev_packet_sent_time > timestamp) asf->packet_timestamp_start = asf->prev_packet_sent_time; else if (asf->packet_timestamp_start >= timestamp) asf->packet_timestamp_start = timestamp; } if (frag_len1 > 0) { if (payload_len > frag_len1) payload_len = frag_len1; else if (payload_len == (frag_len1 - 1)) payload_len = frag_len1 - 2; put_payload_header(s, stream, timestamp+preroll_time, m_obj_size, m_obj_offset, payload_len); put_buffer(&asf->pb, buf, payload_len); if (asf->multi_payloads_present) asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); else asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD); asf->packet_timestamp_end = timestamp; asf->packet_nb_payloads++; } else { payload_len = 0; } m_obj_offset += payload_len; buf += payload_len; if (!asf->multi_payloads_present) flush_packet(s); else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + 1)) flush_packet(s); } stream->seq++; }
{ "code": [], "line_no": [] }
static void FUNC_0( AVFormatContext *VAR_0, ASFStream *VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4 ) { ASFContext *asf = VAR_0->priv_data; int VAR_5, VAR_6, VAR_7; VAR_5 = 0; while (VAR_5 < VAR_4) { VAR_6 = VAR_4 - VAR_5; if (asf->packet_timestamp_start == -1) { asf->multi_payloads_present = (VAR_6 < MULTI_PAYLOAD_CONSTANT); if (asf->multi_payloads_present){ asf->packet_size_left = PACKET_SIZE; asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE - 1; VAR_7 = MULTI_PAYLOAD_CONSTANT - 1; } else { asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE; VAR_7 = SINGLE_PAYLOAD_DATA_LENGTH; } if (asf->prev_packet_sent_time > VAR_2) asf->packet_timestamp_start = asf->prev_packet_sent_time; else asf->packet_timestamp_start = VAR_2; } else { VAR_7 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS; if (asf->prev_packet_sent_time > VAR_2) asf->packet_timestamp_start = asf->prev_packet_sent_time; else if (asf->packet_timestamp_start >= VAR_2) asf->packet_timestamp_start = VAR_2; } if (VAR_7 > 0) { if (VAR_6 > VAR_7) VAR_6 = VAR_7; else if (VAR_6 == (VAR_7 - 1)) VAR_6 = VAR_7 - 2; put_payload_header(VAR_0, VAR_1, VAR_2+preroll_time, VAR_4, VAR_5, VAR_6); put_buffer(&asf->pb, VAR_3, VAR_6); if (asf->multi_payloads_present) asf->packet_size_left -= (VAR_6 + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); else asf->packet_size_left -= (VAR_6 + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD); asf->packet_timestamp_end = VAR_2; asf->packet_nb_payloads++; } else { VAR_6 = 0; } VAR_5 += VAR_6; VAR_3 += VAR_6; if (!asf->multi_payloads_present) flush_packet(VAR_0); else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + 1)) flush_packet(VAR_0); } VAR_1->seq++; }
[ "static void FUNC_0(\nAVFormatContext *VAR_0,\nASFStream *VAR_1,\nint VAR_2,\nconst uint8_t *VAR_3,\nint VAR_4\n)\n{", "ASFContext *asf = VAR_0->priv_data;", "int VAR_5, VAR_6, VAR_7;", "VAR_5 = 0;", "while (VAR_5 < VAR_4) {", "VAR_6 = VAR_4 - VAR_5;", "if (asf->packet_timestamp_start == -1) {", "asf->multi_payloads_present = (VAR_6 < MULTI_PAYLOAD_CONSTANT);", "if (asf->multi_payloads_present){", "asf->packet_size_left = PACKET_SIZE;", "asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE - 1;", "VAR_7 = MULTI_PAYLOAD_CONSTANT - 1;", "}", "else {", "asf->packet_size_left = PACKET_SIZE - PACKET_HEADER_MIN_SIZE;", "VAR_7 = SINGLE_PAYLOAD_DATA_LENGTH;", "}", "if (asf->prev_packet_sent_time > VAR_2)\nasf->packet_timestamp_start = asf->prev_packet_sent_time;", "else\nasf->packet_timestamp_start = VAR_2;", "}", "else {", "VAR_7 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS;", "if (asf->prev_packet_sent_time > VAR_2)\nasf->packet_timestamp_start = asf->prev_packet_sent_time;", "else if (asf->packet_timestamp_start >= VAR_2)\nasf->packet_timestamp_start = VAR_2;", "}", "if (VAR_7 > 0) {", "if (VAR_6 > VAR_7)\nVAR_6 = VAR_7;", "else if (VAR_6 == (VAR_7 - 1))\nVAR_6 = VAR_7 - 2;", "put_payload_header(VAR_0, VAR_1, VAR_2+preroll_time, VAR_4, VAR_5, VAR_6);", "put_buffer(&asf->pb, VAR_3, VAR_6);", "if (asf->multi_payloads_present)\nasf->packet_size_left -= (VAR_6 + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS);", "else\nasf->packet_size_left -= (VAR_6 + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD);", "asf->packet_timestamp_end = VAR_2;", "asf->packet_nb_payloads++;", "} else {", "VAR_6 = 0;", "}", "VAR_5 += VAR_6;", "VAR_3 += VAR_6;", "if (!asf->multi_payloads_present)\nflush_packet(VAR_0);", "else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + 1))\nflush_packet(VAR_0);", "}", "VAR_1->seq++;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ] ]
3,305
static char *print_drive(void *ptr) { return g_strdup(bdrv_get_device_name(ptr)); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static char *print_drive(void *ptr) { return g_strdup(bdrv_get_device_name(ptr)); }
{ "code": [], "line_no": [] }
static char *FUNC_0(void *VAR_0) { return g_strdup(bdrv_get_device_name(VAR_0)); }
[ "static char *FUNC_0(void *VAR_0)\n{", "return g_strdup(bdrv_get_device_name(VAR_0));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
3,306
static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) { int op; int q; int rd, rn, rm; int size; int shift; int pass; int count; int pairwise; int u; uint32_t imm, mask; TCGv tmp, tmp2, tmp3, tmp4, tmp5; TCGv_i64 tmp64; if (!s->vfp_enabled) return 1; q = (insn & (1 << 6)) != 0; u = (insn >> 24) & 1; VFP_DREG_D(rd, insn); VFP_DREG_N(rn, insn); VFP_DREG_M(rm, insn); size = (insn >> 20) & 3; if ((insn & (1 << 23)) == 0) { /* Three register same length. */ op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1); /* Catch invalid op and bad size combinations: UNDEF */ if ((neon_3r_sizes[op] & (1 << size)) == 0) { return 1; } /* All insns of this form UNDEF for either this condition or the * superset of cases "Q==1"; we catch the latter later. */ if (q && ((rd | rn | rm) & 1)) { return 1; } if (size == 3 && op != NEON_3R_LOGIC) { /* 64-bit element instructions. */ for (pass = 0; pass < (q ? 2 : 1); pass++) { neon_load_reg64(cpu_V0, rn + pass); neon_load_reg64(cpu_V1, rm + pass); switch (op) { case NEON_3R_VQADD: if (u) { gen_helper_neon_qadd_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qadd_s64(cpu_V0, cpu_V0, cpu_V1); } break; case NEON_3R_VQSUB: if (u) { gen_helper_neon_qsub_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qsub_s64(cpu_V0, cpu_V0, cpu_V1); } break; case NEON_3R_VSHL: if (u) { gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQSHL: if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VRSHL: if (u) { gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQRSHL: if (u) { gen_helper_neon_qrshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_qrshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VADD_VSUB: if (u) { tcg_gen_sub_i64(CPU_V001); } else { tcg_gen_add_i64(CPU_V001); } break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } return 0; } pairwise = 0; switch (op) { case NEON_3R_VSHL: case NEON_3R_VQSHL: case NEON_3R_VRSHL: case NEON_3R_VQRSHL: { int rtmp; /* Shift instruction operands are reversed. */ rtmp = rn; rn = rm; rm = rtmp; } break; case NEON_3R_VPADD: if (u) { return 1; } /* Fall through */ case NEON_3R_VPMAX: case NEON_3R_VPMIN: pairwise = 1; break; case NEON_3R_FLOAT_ARITH: pairwise = (u && size < 2); /* if VPADD (float) */ break; case NEON_3R_FLOAT_MINMAX: pairwise = u; /* if VPMIN/VPMAX (float) */ break; case NEON_3R_FLOAT_CMP: if (!u && size) { /* no encoding for U=0 C=1x */ return 1; } break; case NEON_3R_FLOAT_ACMP: if (!u) { return 1; } break; case NEON_3R_VRECPS_VRSQRTS: if (u) { return 1; } break; case NEON_3R_VMUL: if (u && (size != 0)) { /* UNDEF on invalid size for polynomial subcase */ return 1; } break; default: break; } if (pairwise && q) { /* All the pairwise insns UNDEF if Q is set */ return 1; } for (pass = 0; pass < (q ? 4 : 2); pass++) { if (pairwise) { /* Pairwise. */ if (pass < 1) { tmp = neon_load_reg(rn, 0); tmp2 = neon_load_reg(rn, 1); } else { tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); } } else { /* Elementwise. */ tmp = neon_load_reg(rn, pass); tmp2 = neon_load_reg(rm, pass); } switch (op) { case NEON_3R_VHADD: GEN_NEON_INTEGER_OP(hadd); break; case NEON_3R_VQADD: GEN_NEON_INTEGER_OP(qadd); break; case NEON_3R_VRHADD: GEN_NEON_INTEGER_OP(rhadd); break; case NEON_3R_LOGIC: /* Logic ops. */ switch ((u << 2) | size) { case 0: /* VAND */ tcg_gen_and_i32(tmp, tmp, tmp2); break; case 1: /* BIC */ tcg_gen_andc_i32(tmp, tmp, tmp2); break; case 2: /* VORR */ tcg_gen_or_i32(tmp, tmp, tmp2); break; case 3: /* VORN */ tcg_gen_orc_i32(tmp, tmp, tmp2); break; case 4: /* VEOR */ tcg_gen_xor_i32(tmp, tmp, tmp2); break; case 5: /* VBSL */ tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp2, tmp3); tcg_temp_free_i32(tmp3); break; case 6: /* VBIT */ tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp3, tmp2); tcg_temp_free_i32(tmp3); break; case 7: /* VBIF */ tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); break; } break; case NEON_3R_VHSUB: GEN_NEON_INTEGER_OP(hsub); break; case NEON_3R_VQSUB: GEN_NEON_INTEGER_OP(qsub); break; case NEON_3R_VCGT: GEN_NEON_INTEGER_OP(cgt); break; case NEON_3R_VCGE: GEN_NEON_INTEGER_OP(cge); break; case NEON_3R_VSHL: GEN_NEON_INTEGER_OP(shl); break; case NEON_3R_VQSHL: GEN_NEON_INTEGER_OP(qshl); break; case NEON_3R_VRSHL: GEN_NEON_INTEGER_OP(rshl); break; case NEON_3R_VQRSHL: GEN_NEON_INTEGER_OP(qrshl); break; case NEON_3R_VMAX: GEN_NEON_INTEGER_OP(max); break; case NEON_3R_VMIN: GEN_NEON_INTEGER_OP(min); break; case NEON_3R_VABD: GEN_NEON_INTEGER_OP(abd); break; case NEON_3R_VABA: GEN_NEON_INTEGER_OP(abd); tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); break; case NEON_3R_VADD_VSUB: if (!u) { /* VADD */ gen_neon_add(size, tmp, tmp2); } else { /* VSUB */ switch (size) { case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VTST_VCEQ: if (!u) { /* VTST */ switch (size) { case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break; default: abort(); } } else { /* VCEQ */ switch (size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VML: /* VMLA, VMLAL, VMLS,VMLSL */ switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (u) { /* VMLS */ gen_neon_rsb(size, tmp, tmp2); } else { /* VMLA */ gen_neon_add(size, tmp, tmp2); } break; case NEON_3R_VMUL: if (u) { /* polynomial */ gen_helper_neon_mul_p8(tmp, tmp, tmp2); } else { /* Integer */ switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPMAX: GEN_NEON_INTEGER_OP(pmax); break; case NEON_3R_VPMIN: GEN_NEON_INTEGER_OP(pmin); break; case NEON_3R_VQDMULH_VQRDMULH: /* Multiply high. */ if (!u) { /* VQDMULH */ switch (size) { case 1: gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); break; default: abort(); } } else { /* VQRDMULH */ switch (size) { case 1: gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPADD: switch (size) { case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_ARITH: /* Floating point arithmetic. */ switch ((u << 2) | size) { case 0: /* VADD */ gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 2: /* VSUB */ gen_helper_neon_sub_f32(tmp, tmp, tmp2); break; case 4: /* VPADD */ gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 6: /* VABD */ gen_helper_neon_abd_f32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_MULTIPLY: gen_helper_neon_mul_f32(tmp, tmp, tmp2); if (!u) { tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (size == 0) { gen_helper_neon_add_f32(tmp, tmp, tmp2); } else { gen_helper_neon_sub_f32(tmp, tmp2, tmp); } } break; case NEON_3R_FLOAT_CMP: if (!u) { gen_helper_neon_ceq_f32(tmp, tmp, tmp2); } else { if (size == 0) gen_helper_neon_cge_f32(tmp, tmp, tmp2); else gen_helper_neon_cgt_f32(tmp, tmp, tmp2); } break; case NEON_3R_FLOAT_ACMP: if (size == 0) gen_helper_neon_acge_f32(tmp, tmp, tmp2); else gen_helper_neon_acgt_f32(tmp, tmp, tmp2); break; case NEON_3R_FLOAT_MINMAX: if (size == 0) gen_helper_neon_max_f32(tmp, tmp, tmp2); else gen_helper_neon_min_f32(tmp, tmp, tmp2); break; case NEON_3R_VRECPS_VRSQRTS: if (size == 0) gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env); else gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env); break; default: abort(); } tcg_temp_free_i32(tmp2); /* Save the result. For elementwise operations we can put it straight into the destination register. For pairwise operations we have to be careful to avoid clobbering the source operands. */ if (pairwise && rd == rm) { neon_store_scratch(pass, tmp); } else { neon_store_reg(rd, pass, tmp); } } /* for pass */ if (pairwise && rd == rm) { for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp = neon_load_scratch(pass); neon_store_reg(rd, pass, tmp); } } /* End of 3 register same size operations. */ } else if (insn & (1 << 4)) { if ((insn & 0x00380080) != 0) { /* Two registers and shift. */ op = (insn >> 8) & 0xf; if (insn & (1 << 7)) { /* 64-bit shift. */ if (op > 7) { return 1; } size = 3; } else { size = 2; while ((insn & (1 << (size + 19))) == 0) size--; } shift = (insn >> 16) & ((1 << (3 + size)) - 1); /* To avoid excessive dumplication of ops we implement shift by immediate using the variable shift operations. */ if (op < 8) { /* Shift by immediate: VSHR, VSRA, VRSHR, VRSRA, VSRI, VSHL, VQSHL, VQSHLU. */ if (q && ((rd | rm) & 1)) { return 1; } if (!u && (op == 4 || op == 6)) { return 1; } /* Right shifts are encoded as N - shift, where N is the element size in bits. */ if (op <= 4) shift = shift - (1 << (size + 3)); if (size == 3) { count = q + 1; } else { count = q ? 4: 2; } switch (size) { case 0: imm = (uint8_t) shift; imm |= imm << 8; imm |= imm << 16; break; case 1: imm = (uint16_t) shift; imm |= imm << 16; break; case 2: case 3: imm = shift; break; default: abort(); } for (pass = 0; pass < count; pass++) { if (size == 3) { neon_load_reg64(cpu_V0, rm + pass); tcg_gen_movi_i64(cpu_V1, imm); switch (op) { case 0: /* VSHR */ case 1: /* VSRA */ if (u) gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 2: /* VRSHR */ case 3: /* VRSRA */ if (u) gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 4: /* VSRI */ case 5: /* VSHL, VSLI */ gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); break; case 6: /* VQSHLU */ gen_helper_neon_qshlu_s64(cpu_V0, cpu_V0, cpu_V1); break; case 7: /* VQSHL */ if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_V0, cpu_V1); } break; } if (op == 1 || op == 3) { /* Accumulate. */ neon_load_reg64(cpu_V1, rd + pass); tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1); } else if (op == 4 || (op == 5 && u)) { /* Insert */ neon_load_reg64(cpu_V1, rd + pass); uint64_t mask; if (shift < -63 || shift > 63) { mask = 0; } else { if (op == 4) { mask = 0xffffffffffffffffull >> -shift; } else { mask = 0xffffffffffffffffull << shift; } } tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd + pass); } else { /* size < 3 */ /* Operands in T0 and T1. */ tmp = neon_load_reg(rm, pass); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); switch (op) { case 0: /* VSHR */ case 1: /* VSRA */ GEN_NEON_INTEGER_OP(shl); break; case 2: /* VRSHR */ case 3: /* VRSRA */ GEN_NEON_INTEGER_OP(rshl); break; case 4: /* VSRI */ case 5: /* VSHL, VSLI */ switch (size) { case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break; default: abort(); } break; case 6: /* VQSHLU */ switch (size) { case 0: gen_helper_neon_qshlu_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_qshlu_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qshlu_s32(tmp, tmp, tmp2); break; default: abort(); } break; case 7: /* VQSHL */ GEN_NEON_INTEGER_OP(qshl); break; } tcg_temp_free_i32(tmp2); if (op == 1 || op == 3) { /* Accumulate. */ tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); tcg_temp_free_i32(tmp2); } else if (op == 4 || (op == 5 && u)) { /* Insert */ switch (size) { case 0: if (op == 4) mask = 0xff >> -shift; else mask = (uint8_t)(0xff << shift); mask |= mask << 8; mask |= mask << 16; break; case 1: if (op == 4) mask = 0xffff >> -shift; else mask = (uint16_t)(0xffff << shift); mask |= mask << 16; break; case 2: if (shift < -31 || shift > 31) { mask = 0; } else { if (op == 4) mask = 0xffffffffu >> -shift; else mask = 0xffffffffu << shift; } break; default: abort(); } tmp2 = neon_load_reg(rd, pass); tcg_gen_andi_i32(tmp, tmp, mask); tcg_gen_andi_i32(tmp2, tmp2, ~mask); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } } /* for pass */ } else if (op < 10) { /* Shift by immediate and narrow: VSHRN, VRSHRN, VQSHRN, VQRSHRN. */ int input_unsigned = (op == 8) ? !u : u; if (rm & 1) { return 1; } shift = shift - (1 << (size + 3)); size++; if (size == 3) { tmp64 = tcg_const_i64(shift); neon_load_reg64(cpu_V0, rm); neon_load_reg64(cpu_V1, rm + 1); for (pass = 0; pass < 2; pass++) { TCGv_i64 in; if (pass == 0) { in = cpu_V0; } else { in = cpu_V1; } if (q) { if (input_unsigned) { gen_helper_neon_rshl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_rshl_s64(cpu_V0, in, tmp64); } } else { if (input_unsigned) { gen_helper_neon_shl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_shl_s64(cpu_V0, in, tmp64); } } tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } /* for pass */ tcg_temp_free_i64(tmp64); } else { if (size == 1) { imm = (uint16_t)shift; imm |= imm << 16; } else { /* size == 2 */ imm = (uint32_t)shift; } tmp2 = tcg_const_i32(imm); tmp4 = neon_load_reg(rm + 1, 0); tmp5 = neon_load_reg(rm + 1, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rm, 0); } else { tmp = tmp4; } gen_neon_shift_narrow(size, tmp, tmp2, q, input_unsigned); if (pass == 0) { tmp3 = neon_load_reg(rm, 1); } else { tmp3 = tmp5; } gen_neon_shift_narrow(size, tmp3, tmp2, q, input_unsigned); tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp3); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } /* for pass */ tcg_temp_free_i32(tmp2); } } else if (op == 10) { /* VSHLL, VMOVL */ if (q || (rd & 1)) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, u); if (shift != 0) { /* The shift is less than the width of the source type, so we can just shift the whole register. */ tcg_gen_shli_i64(cpu_V0, cpu_V0, shift); /* Widen the result of shift: we need to clear * the potential overflow bits resulting from * left bits of the narrow input appearing as * right bits of left the neighbour narrow * input. */ if (size < 2 || !u) { uint64_t imm64; if (size == 0) { imm = (0xffu >> (8 - shift)); imm |= imm << 16; } else if (size == 1) { imm = 0xffff >> (16 - shift); } else { /* size == 2 */ imm = 0xffffffff >> (32 - shift); } if (size < 2) { imm64 = imm | (((uint64_t)imm) << 32); } else { imm64 = imm; } tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64); } } neon_store_reg64(cpu_V0, rd + pass); } } else if (op >= 14) { /* VCVT fixed-point. */ if (!(insn & (1 << 21)) || (q && ((rd | rm) & 1))) { return 1; } /* We have already masked out the must-be-1 top bit of imm6, * hence this 32-shift where the ARM ARM has 64-imm6. */ shift = 32 - shift; for (pass = 0; pass < (q ? 4 : 2); pass++) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); if (!(op & 1)) { if (u) gen_vfp_ulto(0, shift); else gen_vfp_slto(0, shift); } else { if (u) gen_vfp_toul(0, shift); else gen_vfp_tosl(0, shift); } tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } } else { return 1; } } else { /* (insn & 0x00380080) == 0 */ int invert; if (q && (rd & 1)) { return 1; } op = (insn >> 8) & 0xf; /* One register and immediate. */ imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf); invert = (insn & (1 << 5)) != 0; /* Note that op = 2,3,4,5,6,7,10,11,12,13 imm=0 is UNPREDICTABLE. * We choose to not special-case this and will behave as if a * valid constant encoding of 0 had been given. */ switch (op) { case 0: case 1: /* no-op */ break; case 2: case 3: imm <<= 8; break; case 4: case 5: imm <<= 16; break; case 6: case 7: imm <<= 24; break; case 8: case 9: imm |= imm << 16; break; case 10: case 11: imm = (imm << 8) | (imm << 24); break; case 12: imm = (imm << 8) | 0xff; break; case 13: imm = (imm << 16) | 0xffff; break; case 14: imm |= (imm << 8) | (imm << 16) | (imm << 24); if (invert) imm = ~imm; break; case 15: if (invert) { return 1; } imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); break; } if (invert) imm = ~imm; for (pass = 0; pass < (q ? 4 : 2); pass++) { if (op & 1 && op < 12) { tmp = neon_load_reg(rd, pass); if (invert) { /* The immediate value has already been inverted, so BIC becomes AND. */ tcg_gen_andi_i32(tmp, tmp, imm); } else { tcg_gen_ori_i32(tmp, tmp, imm); } } else { /* VMOV, VMVN. */ tmp = tcg_temp_new_i32(); if (op == 14 && invert) { int n; uint32_t val; val = 0; for (n = 0; n < 4; n++) { if (imm & (1 << (n + (pass & 1) * 4))) val |= 0xff << (n * 8); } tcg_gen_movi_i32(tmp, val); } else { tcg_gen_movi_i32(tmp, imm); } } neon_store_reg(rd, pass, tmp); } } } else { /* (insn & 0x00800010 == 0x00800000) */ if (size != 3) { op = (insn >> 8) & 0xf; if ((insn & (1 << 6)) == 0) { /* Three registers of different lengths. */ int src1_wide; int src2_wide; int prewiden; /* undefreq: bit 0 : UNDEF if size != 0 * bit 1 : UNDEF if size == 0 * bit 2 : UNDEF if U == 1 * Note that [1:0] set implies 'always UNDEF' */ int undefreq; /* prewiden, src1_wide, src2_wide, undefreq */ static const int neon_3reg_wide[16][4] = { {1, 0, 0, 0}, /* VADDL */ {1, 1, 0, 0}, /* VADDW */ {1, 0, 0, 0}, /* VSUBL */ {1, 1, 0, 0}, /* VSUBW */ {0, 1, 1, 0}, /* VADDHN */ {0, 0, 0, 0}, /* VABAL */ {0, 1, 1, 0}, /* VSUBHN */ {0, 0, 0, 0}, /* VABDL */ {0, 0, 0, 0}, /* VMLAL */ {0, 0, 0, 6}, /* VQDMLAL */ {0, 0, 0, 0}, /* VMLSL */ {0, 0, 0, 6}, /* VQDMLSL */ {0, 0, 0, 0}, /* Integer VMULL */ {0, 0, 0, 2}, /* VQDMULL */ {0, 0, 0, 5}, /* Polynomial VMULL */ {0, 0, 0, 3}, /* Reserved: always UNDEF */ }; prewiden = neon_3reg_wide[op][0]; src1_wide = neon_3reg_wide[op][1]; src2_wide = neon_3reg_wide[op][2]; undefreq = neon_3reg_wide[op][3]; if (((undefreq & 1) && (size != 0)) || ((undefreq & 2) && (size == 0)) || ((undefreq & 4) && u)) { return 1; } if ((src1_wide && (rn & 1)) || (src2_wide && (rm & 1)) || (!src2_wide && (rd & 1))) { return 1; } /* Avoid overlapping operands. Wide source operands are always aligned so will never overlap with wide destinations in problematic ways. */ if (rd == rm && !src2_wide) { tmp = neon_load_reg(rm, 1); neon_store_scratch(2, tmp); } else if (rd == rn && !src1_wide) { tmp = neon_load_reg(rn, 1); neon_store_scratch(2, tmp); } TCGV_UNUSED(tmp3); for (pass = 0; pass < 2; pass++) { if (src1_wide) { neon_load_reg64(cpu_V0, rn + pass); TCGV_UNUSED(tmp); } else { if (pass == 1 && rd == rn) { tmp = neon_load_scratch(2); } else { tmp = neon_load_reg(rn, pass); } if (prewiden) { gen_neon_widen(cpu_V0, tmp, size, u); } } if (src2_wide) { neon_load_reg64(cpu_V1, rm + pass); TCGV_UNUSED(tmp2); } else { if (pass == 1 && rd == rm) { tmp2 = neon_load_scratch(2); } else { tmp2 = neon_load_reg(rm, pass); } if (prewiden) { gen_neon_widen(cpu_V1, tmp2, size, u); } } switch (op) { case 0: case 1: case 4: /* VADDL, VADDW, VADDHN, VRADDHN */ gen_neon_addl(size); break; case 2: case 3: case 6: /* VSUBL, VSUBW, VSUBHN, VRSUBHN */ gen_neon_subl(size); break; case 5: case 7: /* VABAL, VABDL */ switch ((size << 1) | u) { case 0: gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2); break; case 1: gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2); break; case 2: gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2); break; case 3: gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2); break; case 4: gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2); break; case 5: gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 8: case 9: case 10: case 11: case 12: case 13: /* VMLAL, VQDMLAL, VMLSL, VQDMLSL, VMULL, VQDMULL */ gen_neon_mull(cpu_V0, tmp, tmp2, size, u); break; case 14: /* Polynomial VMULL */ gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; default: /* 15 is RESERVED: caught earlier */ abort(); } if (op == 13) { /* VQDMULL */ gen_neon_addl_saturate(cpu_V0, cpu_V0, size); neon_store_reg64(cpu_V0, rd + pass); } else if (op == 5 || (op >= 8 && op <= 11)) { /* Accumulate. */ neon_load_reg64(cpu_V1, rd + pass); switch (op) { case 10: /* VMLSL */ gen_neon_negl(cpu_V0, size); /* Fall through */ case 5: case 8: /* VABAL, VMLAL */ gen_neon_addl(size); break; case 9: case 11: /* VQDMLAL, VQDMLSL */ gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 11) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } else if (op == 4 || op == 6) { /* Narrowing operation. */ tmp = tcg_temp_new_i32(); if (!u) { switch (size) { case 0: gen_helper_neon_narrow_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } if (pass == 0) { tmp3 = tmp; } else { neon_store_reg(rd, 0, tmp3); neon_store_reg(rd, 1, tmp); } } else { /* Write back the result. */ neon_store_reg64(cpu_V0, rd + pass); } } } else { /* Two registers and a scalar. NB that for ops of this form * the ARM ARM labels bit 24 as Q, but it is in our variable * 'u', not 'q'. */ if (size == 0) { return 1; } switch (op) { case 1: /* Float VMLA scalar */ case 5: /* Floating point VMLS scalar */ case 9: /* Floating point VMUL scalar */ if (size == 1) { return 1; } /* fall through */ case 0: /* Integer VMLA scalar */ case 4: /* Integer VMLS scalar */ case 8: /* Integer VMUL scalar */ case 12: /* VQDMULH scalar */ case 13: /* VQRDMULH scalar */ if (u && ((rd | rn) & 1)) { return 1; } tmp = neon_get_scalar(size, rm); neon_store_scratch(0, tmp); for (pass = 0; pass < (u ? 4 : 2); pass++) { tmp = neon_load_scratch(0); tmp2 = neon_load_reg(rn, pass); if (op == 12) { if (size == 1) { gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); } else { gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); } } else if (op == 13) { if (size == 1) { gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); } else { gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); } } else if (op & 1) { gen_helper_neon_mul_f32(tmp, tmp, tmp2); } else { switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp2); if (op < 8) { /* Accumulate. */ tmp2 = neon_load_reg(rd, pass); switch (op) { case 0: gen_neon_add(size, tmp, tmp2); break; case 1: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 4: gen_neon_rsb(size, tmp, tmp2); break; case 5: gen_helper_neon_sub_f32(tmp, tmp2, tmp); break; default: abort(); } tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } break; case 3: /* VQDMLAL scalar */ case 7: /* VQDMLSL scalar */ case 11: /* VQDMULL scalar */ if (u == 1) { return 1; } /* fall through */ case 2: /* VMLAL sclar */ case 6: /* VMLSL scalar */ case 10: /* VMULL scalar */ if (rd & 1) { return 1; } tmp2 = neon_get_scalar(size, rm); /* We need a copy of tmp2 because gen_neon_mull * deletes it during pass 0. */ tmp4 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(rn, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rn, 0); } else { tmp = tmp3; tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, size, u); if (op != 11) { neon_load_reg64(cpu_V1, rd + pass); } switch (op) { case 6: gen_neon_negl(cpu_V0, size); /* Fall through */ case 2: gen_neon_addl(size); break; case 3: case 7: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 7) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; case 10: /* no-op */ break; case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } break; default: /* 14 and 15 are RESERVED */ return 1; } } } else { /* size == 3 */ if (!u) { /* Extract. */ imm = (insn >> 8) & 0xf; if (imm > 7 && !q) return 1; if (q && ((rd | rn | rm) & 1)) { return 1; } if (imm == 0) { neon_load_reg64(cpu_V0, rn); if (q) { neon_load_reg64(cpu_V1, rn + 1); } } else if (imm == 8) { neon_load_reg64(cpu_V0, rn + 1); if (q) { neon_load_reg64(cpu_V1, rm); } } else if (q) { tmp64 = tcg_temp_new_i64(); if (imm < 8) { neon_load_reg64(cpu_V0, rn); neon_load_reg64(tmp64, rn + 1); } else { neon_load_reg64(cpu_V0, rn + 1); neon_load_reg64(tmp64, rm); } tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8); tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); if (imm < 8) { neon_load_reg64(cpu_V1, rm); } else { neon_load_reg64(cpu_V1, rm + 1); imm -= 8; } tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_shri_i64(tmp64, tmp64, imm * 8); tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64); tcg_temp_free_i64(tmp64); } else { /* BUGFIX */ neon_load_reg64(cpu_V0, rn); tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8); neon_load_reg64(cpu_V1, rm); tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd); if (q) { neon_store_reg64(cpu_V1, rd + 1); } } else if ((insn & (1 << 11)) == 0) { /* Two register misc. */ op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf); size = (insn >> 18) & 3; /* UNDEF for unknown op values and bad op-size combinations */ if ((neon_2rm_sizes[op] & (1 << size)) == 0) { return 1; } switch (op) { case NEON_2RM_VREV64: for (pass = 0; pass < (q ? 2 : 1); pass++) { tmp = neon_load_reg(rm, pass * 2); tmp2 = neon_load_reg(rm, pass * 2 + 1); switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; case 2: /* no-op */ break; default: abort(); } neon_store_reg(rd, pass * 2 + 1, tmp); if (size == 2) { neon_store_reg(rd, pass * 2, tmp2); } else { switch (size) { case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; case 1: gen_swap_half(tmp2); break; default: abort(); } neon_store_reg(rd, pass * 2, tmp2); } } break; case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: for (pass = 0; pass < q + 1; pass++) { tmp = neon_load_reg(rm, pass * 2); gen_neon_widen(cpu_V0, tmp, size, op & 1); tmp = neon_load_reg(rm, pass * 2 + 1); gen_neon_widen(cpu_V1, tmp, size, op & 1); switch (size) { case 0: gen_helper_neon_paddl_u16(CPU_V001); break; case 1: gen_helper_neon_paddl_u32(CPU_V001); break; case 2: tcg_gen_add_i64(CPU_V001); break; default: abort(); } if (op >= NEON_2RM_VPADAL) { /* Accumulate. */ neon_load_reg64(cpu_V1, rd + pass); gen_neon_addl(size); } neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VTRN: if (size == 2) { int n; for (n = 0; n < (q ? 4 : 2); n += 2) { tmp = neon_load_reg(rm, n); tmp2 = neon_load_reg(rd, n + 1); neon_store_reg(rm, n, tmp2); neon_store_reg(rd, n + 1, tmp); } } else { goto elementwise; } break; case NEON_2RM_VUZP: if (gen_neon_unzip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VZIP: if (gen_neon_zip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: /* also VQMOVUN; op field and mnemonics don't line up */ TCGV_UNUSED(tmp2); for (pass = 0; pass < 2; pass++) { neon_load_reg64(cpu_V0, rm + pass); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size, tmp, cpu_V0); if (pass == 0) { tmp2 = tmp; } else { neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp); } } break; case NEON_2RM_VSHLL: if (q) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, 1); tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size); neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VCVT_F16_F32: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp = tcg_temp_new_i32(); tmp2 = tcg_temp_new_i32(); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1)); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3)); neon_store_reg(rd, 0, tmp2); tmp2 = tcg_temp_new_i32(); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); neon_store_reg(rd, 1, tmp2); tcg_temp_free_i32(tmp); break; case NEON_2RM_VCVT_F32_F16: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); tcg_gen_ext16u_i32(tmp3, tmp); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_shri_i32(tmp3, tmp, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1)); tcg_temp_free_i32(tmp); tcg_gen_ext16u_i32(tmp3, tmp2); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2)); tcg_gen_shri_i32(tmp3, tmp2, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3)); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; default: elementwise: for (pass = 0; pass < (q ? 4 : 2); pass++) { if (neon_2rm_is_float_op(op)) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); TCGV_UNUSED(tmp); } else { tmp = neon_load_reg(rm, pass); } switch (op) { case NEON_2RM_VREV32: switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; default: abort(); } break; case NEON_2RM_VREV16: gen_rev16(tmp); break; case NEON_2RM_VCLS: switch (size) { case 0: gen_helper_neon_cls_s8(tmp, tmp); break; case 1: gen_helper_neon_cls_s16(tmp, tmp); break; case 2: gen_helper_neon_cls_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCLZ: switch (size) { case 0: gen_helper_neon_clz_u8(tmp, tmp); break; case 1: gen_helper_neon_clz_u16(tmp, tmp); break; case 2: gen_helper_clz(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCNT: gen_helper_neon_cnt_u8(tmp, tmp); break; case NEON_2RM_VMVN: tcg_gen_not_i32(tmp, tmp); break; case NEON_2RM_VQABS: switch (size) { case 0: gen_helper_neon_qabs_s8(tmp, tmp); break; case 1: gen_helper_neon_qabs_s16(tmp, tmp); break; case 2: gen_helper_neon_qabs_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VQNEG: switch (size) { case 0: gen_helper_neon_qneg_s8(tmp, tmp); break; case 1: gen_helper_neon_qneg_s16(tmp, tmp); break; case 2: gen_helper_neon_qneg_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCGT0: case NEON_2RM_VCLE0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); if (op == NEON_2RM_VCLE0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCGE0: case NEON_2RM_VCLT0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); if (op == NEON_2RM_VCLT0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCEQ0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); break; case NEON_2RM_VABS: switch(size) { case 0: gen_helper_neon_abs_s8(tmp, tmp); break; case 1: gen_helper_neon_abs_s16(tmp, tmp); break; case 2: tcg_gen_abs_i32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VNEG: tmp2 = tcg_const_i32(0); gen_neon_rsb(size, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCGT0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCGE0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCEQ0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_ceq_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCLE0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp2, tmp); tcg_temp_free(tmp2); break; case NEON_2RM_VCLT0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp2, tmp); tcg_temp_free(tmp2); break; case NEON_2RM_VABS_F: gen_vfp_abs(0); break; case NEON_2RM_VNEG_F: gen_vfp_neg(0); break; case NEON_2RM_VSWP: tmp2 = neon_load_reg(rd, pass); neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VTRN: tmp2 = neon_load_reg(rd, pass); switch (size) { case 0: gen_neon_trn_u8(tmp, tmp2); break; case 1: gen_neon_trn_u16(tmp, tmp2); break; default: abort(); } neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VRECPE: gen_helper_recpe_u32(tmp, tmp, cpu_env); break; case NEON_2RM_VRSQRTE: gen_helper_rsqrte_u32(tmp, tmp, cpu_env); break; case NEON_2RM_VRECPE_F: gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env); break; case NEON_2RM_VRSQRTE_F: gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env); break; case NEON_2RM_VCVT_FS: /* VCVT.F32.S32 */ gen_vfp_sito(0); break; case NEON_2RM_VCVT_FU: /* VCVT.F32.U32 */ gen_vfp_uito(0); break; case NEON_2RM_VCVT_SF: /* VCVT.S32.F32 */ gen_vfp_tosiz(0); break; case NEON_2RM_VCVT_UF: /* VCVT.U32.F32 */ gen_vfp_touiz(0); break; default: /* Reserved op values were caught by the * neon_2rm_sizes[] check earlier. */ abort(); } if (neon_2rm_is_float_op(op)) { tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } else { neon_store_reg(rd, pass, tmp); } } break; } } else if ((insn & (1 << 10)) == 0) { /* VTBL, VTBX. */ int n = ((insn >> 5) & 0x18) + 8; if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 0); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(rm, 0); tmp4 = tcg_const_i32(rn); tmp5 = tcg_const_i32(n); gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp); if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 1); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(rm, 1); gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp5); tcg_temp_free_i32(tmp4); neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp3); tcg_temp_free_i32(tmp); } else if ((insn & 0x380) == 0) { /* VDUP */ if (insn & (1 << 19)) { tmp = neon_load_reg(rm, 1); } else { tmp = neon_load_reg(rm, 0); } if (insn & (1 << 16)) { gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8); } else if (insn & (1 << 17)) { if ((insn >> 18) & 1) gen_neon_dup_high16(tmp); else gen_neon_dup_low16(tmp); } for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(rd, pass, tmp2); } tcg_temp_free_i32(tmp); } else { return 1; } } } return 0; }
false
qemu
fc2a9b37849d25d21d161c1319581420499ab4b2
static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) { int op; int q; int rd, rn, rm; int size; int shift; int pass; int count; int pairwise; int u; uint32_t imm, mask; TCGv tmp, tmp2, tmp3, tmp4, tmp5; TCGv_i64 tmp64; if (!s->vfp_enabled) return 1; q = (insn & (1 << 6)) != 0; u = (insn >> 24) & 1; VFP_DREG_D(rd, insn); VFP_DREG_N(rn, insn); VFP_DREG_M(rm, insn); size = (insn >> 20) & 3; if ((insn & (1 << 23)) == 0) { op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1); if ((neon_3r_sizes[op] & (1 << size)) == 0) { return 1; } if (q && ((rd | rn | rm) & 1)) { return 1; } if (size == 3 && op != NEON_3R_LOGIC) { for (pass = 0; pass < (q ? 2 : 1); pass++) { neon_load_reg64(cpu_V0, rn + pass); neon_load_reg64(cpu_V1, rm + pass); switch (op) { case NEON_3R_VQADD: if (u) { gen_helper_neon_qadd_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qadd_s64(cpu_V0, cpu_V0, cpu_V1); } break; case NEON_3R_VQSUB: if (u) { gen_helper_neon_qsub_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qsub_s64(cpu_V0, cpu_V0, cpu_V1); } break; case NEON_3R_VSHL: if (u) { gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQSHL: if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VRSHL: if (u) { gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQRSHL: if (u) { gen_helper_neon_qrshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_qrshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VADD_VSUB: if (u) { tcg_gen_sub_i64(CPU_V001); } else { tcg_gen_add_i64(CPU_V001); } break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } return 0; } pairwise = 0; switch (op) { case NEON_3R_VSHL: case NEON_3R_VQSHL: case NEON_3R_VRSHL: case NEON_3R_VQRSHL: { int rtmp; rtmp = rn; rn = rm; rm = rtmp; } break; case NEON_3R_VPADD: if (u) { return 1; } case NEON_3R_VPMAX: case NEON_3R_VPMIN: pairwise = 1; break; case NEON_3R_FLOAT_ARITH: pairwise = (u && size < 2); break; case NEON_3R_FLOAT_MINMAX: pairwise = u; break; case NEON_3R_FLOAT_CMP: if (!u && size) { return 1; } break; case NEON_3R_FLOAT_ACMP: if (!u) { return 1; } break; case NEON_3R_VRECPS_VRSQRTS: if (u) { return 1; } break; case NEON_3R_VMUL: if (u && (size != 0)) { return 1; } break; default: break; } if (pairwise && q) { return 1; } for (pass = 0; pass < (q ? 4 : 2); pass++) { if (pairwise) { if (pass < 1) { tmp = neon_load_reg(rn, 0); tmp2 = neon_load_reg(rn, 1); } else { tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); } } else { tmp = neon_load_reg(rn, pass); tmp2 = neon_load_reg(rm, pass); } switch (op) { case NEON_3R_VHADD: GEN_NEON_INTEGER_OP(hadd); break; case NEON_3R_VQADD: GEN_NEON_INTEGER_OP(qadd); break; case NEON_3R_VRHADD: GEN_NEON_INTEGER_OP(rhadd); break; case NEON_3R_LOGIC: switch ((u << 2) | size) { case 0: tcg_gen_and_i32(tmp, tmp, tmp2); break; case 1: tcg_gen_andc_i32(tmp, tmp, tmp2); break; case 2: tcg_gen_or_i32(tmp, tmp, tmp2); break; case 3: tcg_gen_orc_i32(tmp, tmp, tmp2); break; case 4: tcg_gen_xor_i32(tmp, tmp, tmp2); break; case 5: tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp2, tmp3); tcg_temp_free_i32(tmp3); break; case 6: tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp, tmp3, tmp2); tcg_temp_free_i32(tmp3); break; case 7: tmp3 = neon_load_reg(rd, pass); gen_neon_bsl(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); break; } break; case NEON_3R_VHSUB: GEN_NEON_INTEGER_OP(hsub); break; case NEON_3R_VQSUB: GEN_NEON_INTEGER_OP(qsub); break; case NEON_3R_VCGT: GEN_NEON_INTEGER_OP(cgt); break; case NEON_3R_VCGE: GEN_NEON_INTEGER_OP(cge); break; case NEON_3R_VSHL: GEN_NEON_INTEGER_OP(shl); break; case NEON_3R_VQSHL: GEN_NEON_INTEGER_OP(qshl); break; case NEON_3R_VRSHL: GEN_NEON_INTEGER_OP(rshl); break; case NEON_3R_VQRSHL: GEN_NEON_INTEGER_OP(qrshl); break; case NEON_3R_VMAX: GEN_NEON_INTEGER_OP(max); break; case NEON_3R_VMIN: GEN_NEON_INTEGER_OP(min); break; case NEON_3R_VABD: GEN_NEON_INTEGER_OP(abd); break; case NEON_3R_VABA: GEN_NEON_INTEGER_OP(abd); tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); break; case NEON_3R_VADD_VSUB: if (!u) { gen_neon_add(size, tmp, tmp2); } else { switch (size) { case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VTST_VCEQ: if (!u) { switch (size) { case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VML: switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (u) { gen_neon_rsb(size, tmp, tmp2); } else { gen_neon_add(size, tmp, tmp2); } break; case NEON_3R_VMUL: if (u) { gen_helper_neon_mul_p8(tmp, tmp, tmp2); } else { switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPMAX: GEN_NEON_INTEGER_OP(pmax); break; case NEON_3R_VPMIN: GEN_NEON_INTEGER_OP(pmin); break; case NEON_3R_VQDMULH_VQRDMULH: if (!u) { switch (size) { case 1: gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); break; default: abort(); } } else { switch (size) { case 1: gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPADD: switch (size) { case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_ARITH: switch ((u << 2) | size) { case 0: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 2: gen_helper_neon_sub_f32(tmp, tmp, tmp2); break; case 4: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 6: gen_helper_neon_abd_f32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_MULTIPLY: gen_helper_neon_mul_f32(tmp, tmp, tmp2); if (!u) { tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(rd, pass); if (size == 0) { gen_helper_neon_add_f32(tmp, tmp, tmp2); } else { gen_helper_neon_sub_f32(tmp, tmp2, tmp); } } break; case NEON_3R_FLOAT_CMP: if (!u) { gen_helper_neon_ceq_f32(tmp, tmp, tmp2); } else { if (size == 0) gen_helper_neon_cge_f32(tmp, tmp, tmp2); else gen_helper_neon_cgt_f32(tmp, tmp, tmp2); } break; case NEON_3R_FLOAT_ACMP: if (size == 0) gen_helper_neon_acge_f32(tmp, tmp, tmp2); else gen_helper_neon_acgt_f32(tmp, tmp, tmp2); break; case NEON_3R_FLOAT_MINMAX: if (size == 0) gen_helper_neon_max_f32(tmp, tmp, tmp2); else gen_helper_neon_min_f32(tmp, tmp, tmp2); break; case NEON_3R_VRECPS_VRSQRTS: if (size == 0) gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env); else gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env); break; default: abort(); } tcg_temp_free_i32(tmp2); if (pairwise && rd == rm) { neon_store_scratch(pass, tmp); } else { neon_store_reg(rd, pass, tmp); } } if (pairwise && rd == rm) { for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp = neon_load_scratch(pass); neon_store_reg(rd, pass, tmp); } } } else if (insn & (1 << 4)) { if ((insn & 0x00380080) != 0) { op = (insn >> 8) & 0xf; if (insn & (1 << 7)) { if (op > 7) { return 1; } size = 3; } else { size = 2; while ((insn & (1 << (size + 19))) == 0) size--; } shift = (insn >> 16) & ((1 << (3 + size)) - 1); if (op < 8) { if (q && ((rd | rm) & 1)) { return 1; } if (!u && (op == 4 || op == 6)) { return 1; } if (op <= 4) shift = shift - (1 << (size + 3)); if (size == 3) { count = q + 1; } else { count = q ? 4: 2; } switch (size) { case 0: imm = (uint8_t) shift; imm |= imm << 8; imm |= imm << 16; break; case 1: imm = (uint16_t) shift; imm |= imm << 16; break; case 2: case 3: imm = shift; break; default: abort(); } for (pass = 0; pass < count; pass++) { if (size == 3) { neon_load_reg64(cpu_V0, rm + pass); tcg_gen_movi_i64(cpu_V1, imm); switch (op) { case 0: case 1: if (u) gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 2: case 3: if (u) gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 4: case 5: gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); break; case 6: gen_helper_neon_qshlu_s64(cpu_V0, cpu_V0, cpu_V1); break; case 7: if (u) { gen_helper_neon_qshl_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_V0, cpu_V1); } break; } if (op == 1 || op == 3) { neon_load_reg64(cpu_V1, rd + pass); tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1); } else if (op == 4 || (op == 5 && u)) { neon_load_reg64(cpu_V1, rd + pass); uint64_t mask; if (shift < -63 || shift > 63) { mask = 0; } else { if (op == 4) { mask = 0xffffffffffffffffull >> -shift; } else { mask = 0xffffffffffffffffull << shift; } } tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd + pass); } else { tmp = neon_load_reg(rm, pass); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); switch (op) { case 0: case 1: GEN_NEON_INTEGER_OP(shl); break; case 2: case 3: GEN_NEON_INTEGER_OP(rshl); break; case 4: case 5: switch (size) { case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break; default: abort(); } break; case 6: switch (size) { case 0: gen_helper_neon_qshlu_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_qshlu_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qshlu_s32(tmp, tmp, tmp2); break; default: abort(); } break; case 7: GEN_NEON_INTEGER_OP(qshl); break; } tcg_temp_free_i32(tmp2); if (op == 1 || op == 3) { tmp2 = neon_load_reg(rd, pass); gen_neon_add(size, tmp, tmp2); tcg_temp_free_i32(tmp2); } else if (op == 4 || (op == 5 && u)) { switch (size) { case 0: if (op == 4) mask = 0xff >> -shift; else mask = (uint8_t)(0xff << shift); mask |= mask << 8; mask |= mask << 16; break; case 1: if (op == 4) mask = 0xffff >> -shift; else mask = (uint16_t)(0xffff << shift); mask |= mask << 16; break; case 2: if (shift < -31 || shift > 31) { mask = 0; } else { if (op == 4) mask = 0xffffffffu >> -shift; else mask = 0xffffffffu << shift; } break; default: abort(); } tmp2 = neon_load_reg(rd, pass); tcg_gen_andi_i32(tmp, tmp, mask); tcg_gen_andi_i32(tmp2, tmp2, ~mask); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } } } else if (op < 10) { int input_unsigned = (op == 8) ? !u : u; if (rm & 1) { return 1; } shift = shift - (1 << (size + 3)); size++; if (size == 3) { tmp64 = tcg_const_i64(shift); neon_load_reg64(cpu_V0, rm); neon_load_reg64(cpu_V1, rm + 1); for (pass = 0; pass < 2; pass++) { TCGv_i64 in; if (pass == 0) { in = cpu_V0; } else { in = cpu_V1; } if (q) { if (input_unsigned) { gen_helper_neon_rshl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_rshl_s64(cpu_V0, in, tmp64); } } else { if (input_unsigned) { gen_helper_neon_shl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_shl_s64(cpu_V0, in, tmp64); } } tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } tcg_temp_free_i64(tmp64); } else { if (size == 1) { imm = (uint16_t)shift; imm |= imm << 16; } else { imm = (uint32_t)shift; } tmp2 = tcg_const_i32(imm); tmp4 = neon_load_reg(rm + 1, 0); tmp5 = neon_load_reg(rm + 1, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rm, 0); } else { tmp = tmp4; } gen_neon_shift_narrow(size, tmp, tmp2, q, input_unsigned); if (pass == 0) { tmp3 = neon_load_reg(rm, 1); } else { tmp3 = tmp5; } gen_neon_shift_narrow(size, tmp3, tmp2, q, input_unsigned); tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp3); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0); neon_store_reg(rd, pass, tmp); } tcg_temp_free_i32(tmp2); } } else if (op == 10) { if (q || (rd & 1)) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, u); if (shift != 0) { tcg_gen_shli_i64(cpu_V0, cpu_V0, shift); if (size < 2 || !u) { uint64_t imm64; if (size == 0) { imm = (0xffu >> (8 - shift)); imm |= imm << 16; } else if (size == 1) { imm = 0xffff >> (16 - shift); } else { imm = 0xffffffff >> (32 - shift); } if (size < 2) { imm64 = imm | (((uint64_t)imm) << 32); } else { imm64 = imm; } tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64); } } neon_store_reg64(cpu_V0, rd + pass); } } else if (op >= 14) { if (!(insn & (1 << 21)) || (q && ((rd | rm) & 1))) { return 1; } shift = 32 - shift; for (pass = 0; pass < (q ? 4 : 2); pass++) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); if (!(op & 1)) { if (u) gen_vfp_ulto(0, shift); else gen_vfp_slto(0, shift); } else { if (u) gen_vfp_toul(0, shift); else gen_vfp_tosl(0, shift); } tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } } else { return 1; } } else { int invert; if (q && (rd & 1)) { return 1; } op = (insn >> 8) & 0xf; imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf); invert = (insn & (1 << 5)) != 0; switch (op) { case 0: case 1: break; case 2: case 3: imm <<= 8; break; case 4: case 5: imm <<= 16; break; case 6: case 7: imm <<= 24; break; case 8: case 9: imm |= imm << 16; break; case 10: case 11: imm = (imm << 8) | (imm << 24); break; case 12: imm = (imm << 8) | 0xff; break; case 13: imm = (imm << 16) | 0xffff; break; case 14: imm |= (imm << 8) | (imm << 16) | (imm << 24); if (invert) imm = ~imm; break; case 15: if (invert) { return 1; } imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); break; } if (invert) imm = ~imm; for (pass = 0; pass < (q ? 4 : 2); pass++) { if (op & 1 && op < 12) { tmp = neon_load_reg(rd, pass); if (invert) { tcg_gen_andi_i32(tmp, tmp, imm); } else { tcg_gen_ori_i32(tmp, tmp, imm); } } else { tmp = tcg_temp_new_i32(); if (op == 14 && invert) { int n; uint32_t val; val = 0; for (n = 0; n < 4; n++) { if (imm & (1 << (n + (pass & 1) * 4))) val |= 0xff << (n * 8); } tcg_gen_movi_i32(tmp, val); } else { tcg_gen_movi_i32(tmp, imm); } } neon_store_reg(rd, pass, tmp); } } } else { if (size != 3) { op = (insn >> 8) & 0xf; if ((insn & (1 << 6)) == 0) { int src1_wide; int src2_wide; int prewiden; int undefreq; static const int neon_3reg_wide[16][4] = { {1, 0, 0, 0}, {1, 1, 0, 0}, {1, 0, 0, 0}, {1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 6}, {0, 0, 0, 0}, {0, 0, 0, 6}, {0, 0, 0, 0}, {0, 0, 0, 2}, {0, 0, 0, 5}, {0, 0, 0, 3}, }; prewiden = neon_3reg_wide[op][0]; src1_wide = neon_3reg_wide[op][1]; src2_wide = neon_3reg_wide[op][2]; undefreq = neon_3reg_wide[op][3]; if (((undefreq & 1) && (size != 0)) || ((undefreq & 2) && (size == 0)) || ((undefreq & 4) && u)) { return 1; } if ((src1_wide && (rn & 1)) || (src2_wide && (rm & 1)) || (!src2_wide && (rd & 1))) { return 1; } if (rd == rm && !src2_wide) { tmp = neon_load_reg(rm, 1); neon_store_scratch(2, tmp); } else if (rd == rn && !src1_wide) { tmp = neon_load_reg(rn, 1); neon_store_scratch(2, tmp); } TCGV_UNUSED(tmp3); for (pass = 0; pass < 2; pass++) { if (src1_wide) { neon_load_reg64(cpu_V0, rn + pass); TCGV_UNUSED(tmp); } else { if (pass == 1 && rd == rn) { tmp = neon_load_scratch(2); } else { tmp = neon_load_reg(rn, pass); } if (prewiden) { gen_neon_widen(cpu_V0, tmp, size, u); } } if (src2_wide) { neon_load_reg64(cpu_V1, rm + pass); TCGV_UNUSED(tmp2); } else { if (pass == 1 && rd == rm) { tmp2 = neon_load_scratch(2); } else { tmp2 = neon_load_reg(rm, pass); } if (prewiden) { gen_neon_widen(cpu_V1, tmp2, size, u); } } switch (op) { case 0: case 1: case 4: gen_neon_addl(size); break; case 2: case 3: case 6: gen_neon_subl(size); break; case 5: case 7: switch ((size << 1) | u) { case 0: gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2); break; case 1: gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2); break; case 2: gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2); break; case 3: gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2); break; case 4: gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2); break; case 5: gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 8: case 9: case 10: case 11: case 12: case 13: gen_neon_mull(cpu_V0, tmp, tmp2, size, u); break; case 14: gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; default: abort(); } if (op == 13) { gen_neon_addl_saturate(cpu_V0, cpu_V0, size); neon_store_reg64(cpu_V0, rd + pass); } else if (op == 5 || (op >= 8 && op <= 11)) { neon_load_reg64(cpu_V1, rd + pass); switch (op) { case 10: gen_neon_negl(cpu_V0, size); case 5: case 8: gen_neon_addl(size); break; case 9: case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 11) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } else if (op == 4 || op == 6) { tmp = tcg_temp_new_i32(); if (!u) { switch (size) { case 0: gen_helper_neon_narrow_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } if (pass == 0) { tmp3 = tmp; } else { neon_store_reg(rd, 0, tmp3); neon_store_reg(rd, 1, tmp); } } else { neon_store_reg64(cpu_V0, rd + pass); } } } else { if (size == 0) { return 1; } switch (op) { case 1: case 5: case 9: if (size == 1) { return 1; } case 0: case 4: case 8: case 12: case 13: if (u && ((rd | rn) & 1)) { return 1; } tmp = neon_get_scalar(size, rm); neon_store_scratch(0, tmp); for (pass = 0; pass < (u ? 4 : 2); pass++) { tmp = neon_load_scratch(0); tmp2 = neon_load_reg(rn, pass); if (op == 12) { if (size == 1) { gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); } else { gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); } } else if (op == 13) { if (size == 1) { gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); } else { gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); } } else if (op & 1) { gen_helper_neon_mul_f32(tmp, tmp, tmp2); } else { switch (size) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp2); if (op < 8) { tmp2 = neon_load_reg(rd, pass); switch (op) { case 0: gen_neon_add(size, tmp, tmp2); break; case 1: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 4: gen_neon_rsb(size, tmp, tmp2); break; case 5: gen_helper_neon_sub_f32(tmp, tmp2, tmp); break; default: abort(); } tcg_temp_free_i32(tmp2); } neon_store_reg(rd, pass, tmp); } break; case 3: case 7: case 11: if (u == 1) { return 1; } case 2: case 6: case 10: if (rd & 1) { return 1; } tmp2 = neon_get_scalar(size, rm); tmp4 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(rn, 1); for (pass = 0; pass < 2; pass++) { if (pass == 0) { tmp = neon_load_reg(rn, 0); } else { tmp = tmp3; tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, size, u); if (op != 11) { neon_load_reg64(cpu_V1, rd + pass); } switch (op) { case 6: gen_neon_negl(cpu_V0, size); case 2: gen_neon_addl(size); break; case 3: case 7: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); if (op == 7) { gen_neon_negl(cpu_V0, size); } gen_neon_addl_saturate(cpu_V0, cpu_V1, size); break; case 10: break; case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, size); break; default: abort(); } neon_store_reg64(cpu_V0, rd + pass); } break; default: return 1; } } } else { if (!u) { imm = (insn >> 8) & 0xf; if (imm > 7 && !q) return 1; if (q && ((rd | rn | rm) & 1)) { return 1; } if (imm == 0) { neon_load_reg64(cpu_V0, rn); if (q) { neon_load_reg64(cpu_V1, rn + 1); } } else if (imm == 8) { neon_load_reg64(cpu_V0, rn + 1); if (q) { neon_load_reg64(cpu_V1, rm); } } else if (q) { tmp64 = tcg_temp_new_i64(); if (imm < 8) { neon_load_reg64(cpu_V0, rn); neon_load_reg64(tmp64, rn + 1); } else { neon_load_reg64(cpu_V0, rn + 1); neon_load_reg64(tmp64, rm); } tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8); tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); if (imm < 8) { neon_load_reg64(cpu_V1, rm); } else { neon_load_reg64(cpu_V1, rm + 1); imm -= 8; } tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_shri_i64(tmp64, tmp64, imm * 8); tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64); tcg_temp_free_i64(tmp64); } else { neon_load_reg64(cpu_V0, rn); tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8); neon_load_reg64(cpu_V1, rm); tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, rd); if (q) { neon_store_reg64(cpu_V1, rd + 1); } } else if ((insn & (1 << 11)) == 0) { op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf); size = (insn >> 18) & 3; if ((neon_2rm_sizes[op] & (1 << size)) == 0) { return 1; } switch (op) { case NEON_2RM_VREV64: for (pass = 0; pass < (q ? 2 : 1); pass++) { tmp = neon_load_reg(rm, pass * 2); tmp2 = neon_load_reg(rm, pass * 2 + 1); switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; case 2: break; default: abort(); } neon_store_reg(rd, pass * 2 + 1, tmp); if (size == 2) { neon_store_reg(rd, pass * 2, tmp2); } else { switch (size) { case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; case 1: gen_swap_half(tmp2); break; default: abort(); } neon_store_reg(rd, pass * 2, tmp2); } } break; case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: for (pass = 0; pass < q + 1; pass++) { tmp = neon_load_reg(rm, pass * 2); gen_neon_widen(cpu_V0, tmp, size, op & 1); tmp = neon_load_reg(rm, pass * 2 + 1); gen_neon_widen(cpu_V1, tmp, size, op & 1); switch (size) { case 0: gen_helper_neon_paddl_u16(CPU_V001); break; case 1: gen_helper_neon_paddl_u32(CPU_V001); break; case 2: tcg_gen_add_i64(CPU_V001); break; default: abort(); } if (op >= NEON_2RM_VPADAL) { neon_load_reg64(cpu_V1, rd + pass); gen_neon_addl(size); } neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VTRN: if (size == 2) { int n; for (n = 0; n < (q ? 4 : 2); n += 2) { tmp = neon_load_reg(rm, n); tmp2 = neon_load_reg(rd, n + 1); neon_store_reg(rm, n, tmp2); neon_store_reg(rd, n + 1, tmp); } } else { goto elementwise; } break; case NEON_2RM_VUZP: if (gen_neon_unzip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VZIP: if (gen_neon_zip(rd, rm, size, q)) { return 1; } break; case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: TCGV_UNUSED(tmp2); for (pass = 0; pass < 2; pass++) { neon_load_reg64(cpu_V0, rm + pass); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size, tmp, cpu_V0); if (pass == 0) { tmp2 = tmp; } else { neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp); } } break; case NEON_2RM_VSHLL: if (q) { return 1; } tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); for (pass = 0; pass < 2; pass++) { if (pass == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, size, 1); tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size); neon_store_reg64(cpu_V0, rd + pass); } break; case NEON_2RM_VCVT_F16_F32: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp = tcg_temp_new_i32(); tmp2 = tcg_temp_new_i32(); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1)); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3)); neon_store_reg(rd, 0, tmp2); tmp2 = tcg_temp_new_i32(); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); neon_store_reg(rd, 1, tmp2); tcg_temp_free_i32(tmp); break; case NEON_2RM_VCVT_F32_F16: if (!arm_feature(env, ARM_FEATURE_VFP_FP16)) return 1; tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(rm, 0); tmp2 = neon_load_reg(rm, 1); tcg_gen_ext16u_i32(tmp3, tmp); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0)); tcg_gen_shri_i32(tmp3, tmp, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1)); tcg_temp_free_i32(tmp); tcg_gen_ext16u_i32(tmp3, tmp2); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2)); tcg_gen_shri_i32(tmp3, tmp2, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3)); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; default: elementwise: for (pass = 0; pass < (q ? 4 : 2); pass++) { if (neon_2rm_is_float_op(op)) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass)); TCGV_UNUSED(tmp); } else { tmp = neon_load_reg(rm, pass); } switch (op) { case NEON_2RM_VREV32: switch (size) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; default: abort(); } break; case NEON_2RM_VREV16: gen_rev16(tmp); break; case NEON_2RM_VCLS: switch (size) { case 0: gen_helper_neon_cls_s8(tmp, tmp); break; case 1: gen_helper_neon_cls_s16(tmp, tmp); break; case 2: gen_helper_neon_cls_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCLZ: switch (size) { case 0: gen_helper_neon_clz_u8(tmp, tmp); break; case 1: gen_helper_neon_clz_u16(tmp, tmp); break; case 2: gen_helper_clz(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCNT: gen_helper_neon_cnt_u8(tmp, tmp); break; case NEON_2RM_VMVN: tcg_gen_not_i32(tmp, tmp); break; case NEON_2RM_VQABS: switch (size) { case 0: gen_helper_neon_qabs_s8(tmp, tmp); break; case 1: gen_helper_neon_qabs_s16(tmp, tmp); break; case 2: gen_helper_neon_qabs_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VQNEG: switch (size) { case 0: gen_helper_neon_qneg_s8(tmp, tmp); break; case 1: gen_helper_neon_qneg_s16(tmp, tmp); break; case 2: gen_helper_neon_qneg_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCGT0: case NEON_2RM_VCLE0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); if (op == NEON_2RM_VCLE0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCGE0: case NEON_2RM_VCLT0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); if (op == NEON_2RM_VCLT0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCEQ0: tmp2 = tcg_const_i32(0); switch(size) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); break; case NEON_2RM_VABS: switch(size) { case 0: gen_helper_neon_abs_s8(tmp, tmp); break; case 1: gen_helper_neon_abs_s16(tmp, tmp); break; case 2: tcg_gen_abs_i32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VNEG: tmp2 = tcg_const_i32(0); gen_neon_rsb(size, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCGT0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCGE0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCEQ0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_ceq_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCLE0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp2, tmp); tcg_temp_free(tmp2); break; case NEON_2RM_VCLT0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp2, tmp); tcg_temp_free(tmp2); break; case NEON_2RM_VABS_F: gen_vfp_abs(0); break; case NEON_2RM_VNEG_F: gen_vfp_neg(0); break; case NEON_2RM_VSWP: tmp2 = neon_load_reg(rd, pass); neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VTRN: tmp2 = neon_load_reg(rd, pass); switch (size) { case 0: gen_neon_trn_u8(tmp, tmp2); break; case 1: gen_neon_trn_u16(tmp, tmp2); break; default: abort(); } neon_store_reg(rm, pass, tmp2); break; case NEON_2RM_VRECPE: gen_helper_recpe_u32(tmp, tmp, cpu_env); break; case NEON_2RM_VRSQRTE: gen_helper_rsqrte_u32(tmp, tmp, cpu_env); break; case NEON_2RM_VRECPE_F: gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env); break; case NEON_2RM_VRSQRTE_F: gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env); break; case NEON_2RM_VCVT_FS: gen_vfp_sito(0); break; case NEON_2RM_VCVT_FU: gen_vfp_uito(0); break; case NEON_2RM_VCVT_SF: gen_vfp_tosiz(0); break; case NEON_2RM_VCVT_UF: gen_vfp_touiz(0); break; default: abort(); } if (neon_2rm_is_float_op(op)) { tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass)); } else { neon_store_reg(rd, pass, tmp); } } break; } } else if ((insn & (1 << 10)) == 0) { int n = ((insn >> 5) & 0x18) + 8; if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 0); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(rm, 0); tmp4 = tcg_const_i32(rn); tmp5 = tcg_const_i32(n); gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp); if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 1); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(rm, 1); gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp5); tcg_temp_free_i32(tmp4); neon_store_reg(rd, 0, tmp2); neon_store_reg(rd, 1, tmp3); tcg_temp_free_i32(tmp); } else if ((insn & 0x380) == 0) { if (insn & (1 << 19)) { tmp = neon_load_reg(rm, 1); } else { tmp = neon_load_reg(rm, 0); } if (insn & (1 << 16)) { gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8); } else if (insn & (1 << 17)) { if ((insn >> 18) & 1) gen_neon_dup_high16(tmp); else gen_neon_dup_low16(tmp); } for (pass = 0; pass < (q ? 4 : 2); pass++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(rd, pass, tmp2); } tcg_temp_free_i32(tmp); } else { return 1; } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState * VAR_0, DisasContext *VAR_1, uint32_t VAR_2) { int VAR_3; int VAR_4; int VAR_5, VAR_6, VAR_7; int VAR_8; int VAR_9; int VAR_10; int VAR_11; int VAR_12; int VAR_13; uint32_t imm, mask; TCGv tmp, tmp2, tmp3, tmp4, tmp5; TCGv_i64 tmp64; if (!VAR_1->vfp_enabled) return 1; VAR_4 = (VAR_2 & (1 << 6)) != 0; VAR_13 = (VAR_2 >> 24) & 1; VFP_DREG_D(VAR_5, VAR_2); VFP_DREG_N(VAR_6, VAR_2); VFP_DREG_M(VAR_7, VAR_2); VAR_8 = (VAR_2 >> 20) & 3; if ((VAR_2 & (1 << 23)) == 0) { VAR_3 = ((VAR_2 >> 7) & 0x1e) | ((VAR_2 >> 4) & 1); if ((neon_3r_sizes[VAR_3] & (1 << VAR_8)) == 0) { return 1; } if (VAR_4 && ((VAR_5 | VAR_6 | VAR_7) & 1)) { return 1; } if (VAR_8 == 3 && VAR_3 != NEON_3R_LOGIC) { for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) { neon_load_reg64(cpu_V0, VAR_6 + VAR_10); neon_load_reg64(cpu_V1, VAR_7 + VAR_10); switch (VAR_3) { case NEON_3R_VQADD: if (VAR_13) { gen_helper_neon_qadd_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qadd_s64(cpu_V0, cpu_V0, cpu_V1); } break; case NEON_3R_VQSUB: if (VAR_13) { gen_helper_neon_qsub_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qsub_s64(cpu_V0, cpu_V0, cpu_V1); } break; case NEON_3R_VSHL: if (VAR_13) { gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQSHL: if (VAR_13) { gen_helper_neon_qshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VRSHL: if (VAR_13) { gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VQRSHL: if (VAR_13) { gen_helper_neon_qrshl_u64(cpu_V0, cpu_V1, cpu_V0); } else { gen_helper_neon_qrshl_s64(cpu_V0, cpu_V1, cpu_V0); } break; case NEON_3R_VADD_VSUB: if (VAR_13) { tcg_gen_sub_i64(CPU_V001); } else { tcg_gen_add_i64(CPU_V001); } break; default: abort(); } neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } return 0; } VAR_12 = 0; switch (VAR_3) { case NEON_3R_VSHL: case NEON_3R_VQSHL: case NEON_3R_VRSHL: case NEON_3R_VQRSHL: { int VAR_14; VAR_14 = VAR_6; VAR_6 = VAR_7; VAR_7 = VAR_14; } break; case NEON_3R_VPADD: if (VAR_13) { return 1; } case NEON_3R_VPMAX: case NEON_3R_VPMIN: VAR_12 = 1; break; case NEON_3R_FLOAT_ARITH: VAR_12 = (VAR_13 && VAR_8 < 2); break; case NEON_3R_FLOAT_MINMAX: VAR_12 = VAR_13; break; case NEON_3R_FLOAT_CMP: if (!VAR_13 && VAR_8) { return 1; } break; case NEON_3R_FLOAT_ACMP: if (!VAR_13) { return 1; } break; case NEON_3R_VRECPS_VRSQRTS: if (VAR_13) { return 1; } break; case NEON_3R_VMUL: if (VAR_13 && (VAR_8 != 0)) { return 1; } break; default: break; } if (VAR_12 && VAR_4) { return 1; } for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) { if (VAR_12) { if (VAR_10 < 1) { tmp = neon_load_reg(VAR_6, 0); tmp2 = neon_load_reg(VAR_6, 1); } else { tmp = neon_load_reg(VAR_7, 0); tmp2 = neon_load_reg(VAR_7, 1); } } else { tmp = neon_load_reg(VAR_6, VAR_10); tmp2 = neon_load_reg(VAR_7, VAR_10); } switch (VAR_3) { case NEON_3R_VHADD: GEN_NEON_INTEGER_OP(hadd); break; case NEON_3R_VQADD: GEN_NEON_INTEGER_OP(qadd); break; case NEON_3R_VRHADD: GEN_NEON_INTEGER_OP(rhadd); break; case NEON_3R_LOGIC: switch ((VAR_13 << 2) | VAR_8) { case 0: tcg_gen_and_i32(tmp, tmp, tmp2); break; case 1: tcg_gen_andc_i32(tmp, tmp, tmp2); break; case 2: tcg_gen_or_i32(tmp, tmp, tmp2); break; case 3: tcg_gen_orc_i32(tmp, tmp, tmp2); break; case 4: tcg_gen_xor_i32(tmp, tmp, tmp2); break; case 5: tmp3 = neon_load_reg(VAR_5, VAR_10); gen_neon_bsl(tmp, tmp, tmp2, tmp3); tcg_temp_free_i32(tmp3); break; case 6: tmp3 = neon_load_reg(VAR_5, VAR_10); gen_neon_bsl(tmp, tmp, tmp3, tmp2); tcg_temp_free_i32(tmp3); break; case 7: tmp3 = neon_load_reg(VAR_5, VAR_10); gen_neon_bsl(tmp, tmp3, tmp, tmp2); tcg_temp_free_i32(tmp3); break; } break; case NEON_3R_VHSUB: GEN_NEON_INTEGER_OP(hsub); break; case NEON_3R_VQSUB: GEN_NEON_INTEGER_OP(qsub); break; case NEON_3R_VCGT: GEN_NEON_INTEGER_OP(cgt); break; case NEON_3R_VCGE: GEN_NEON_INTEGER_OP(cge); break; case NEON_3R_VSHL: GEN_NEON_INTEGER_OP(shl); break; case NEON_3R_VQSHL: GEN_NEON_INTEGER_OP(qshl); break; case NEON_3R_VRSHL: GEN_NEON_INTEGER_OP(rshl); break; case NEON_3R_VQRSHL: GEN_NEON_INTEGER_OP(qrshl); break; case NEON_3R_VMAX: GEN_NEON_INTEGER_OP(max); break; case NEON_3R_VMIN: GEN_NEON_INTEGER_OP(min); break; case NEON_3R_VABD: GEN_NEON_INTEGER_OP(abd); break; case NEON_3R_VABA: GEN_NEON_INTEGER_OP(abd); tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(VAR_5, VAR_10); gen_neon_add(VAR_8, tmp, tmp2); break; case NEON_3R_VADD_VSUB: if (!VAR_13) { gen_neon_add(VAR_8, tmp, tmp2); } else { switch (VAR_8) { case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VTST_VCEQ: if (!VAR_13) { switch (VAR_8) { case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break; default: abort(); } } else { switch (VAR_8) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VML: switch (VAR_8) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(VAR_5, VAR_10); if (VAR_13) { gen_neon_rsb(VAR_8, tmp, tmp2); } else { gen_neon_add(VAR_8, tmp, tmp2); } break; case NEON_3R_VMUL: if (VAR_13) { gen_helper_neon_mul_p8(tmp, tmp, tmp2); } else { switch (VAR_8) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPMAX: GEN_NEON_INTEGER_OP(pmax); break; case NEON_3R_VPMIN: GEN_NEON_INTEGER_OP(pmin); break; case NEON_3R_VQDMULH_VQRDMULH: if (!VAR_13) { switch (VAR_8) { case 1: gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); break; default: abort(); } } else { switch (VAR_8) { case 1: gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); break; default: abort(); } } break; case NEON_3R_VPADD: switch (VAR_8) { case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_ARITH: switch ((VAR_13 << 2) | VAR_8) { case 0: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 2: gen_helper_neon_sub_f32(tmp, tmp, tmp2); break; case 4: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 6: gen_helper_neon_abd_f32(tmp, tmp, tmp2); break; default: abort(); } break; case NEON_3R_FLOAT_MULTIPLY: gen_helper_neon_mul_f32(tmp, tmp, tmp2); if (!VAR_13) { tcg_temp_free_i32(tmp2); tmp2 = neon_load_reg(VAR_5, VAR_10); if (VAR_8 == 0) { gen_helper_neon_add_f32(tmp, tmp, tmp2); } else { gen_helper_neon_sub_f32(tmp, tmp2, tmp); } } break; case NEON_3R_FLOAT_CMP: if (!VAR_13) { gen_helper_neon_ceq_f32(tmp, tmp, tmp2); } else { if (VAR_8 == 0) gen_helper_neon_cge_f32(tmp, tmp, tmp2); else gen_helper_neon_cgt_f32(tmp, tmp, tmp2); } break; case NEON_3R_FLOAT_ACMP: if (VAR_8 == 0) gen_helper_neon_acge_f32(tmp, tmp, tmp2); else gen_helper_neon_acgt_f32(tmp, tmp, tmp2); break; case NEON_3R_FLOAT_MINMAX: if (VAR_8 == 0) gen_helper_neon_max_f32(tmp, tmp, tmp2); else gen_helper_neon_min_f32(tmp, tmp, tmp2); break; case NEON_3R_VRECPS_VRSQRTS: if (VAR_8 == 0) gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env); else gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env); break; default: abort(); } tcg_temp_free_i32(tmp2); if (VAR_12 && VAR_5 == VAR_7) { neon_store_scratch(VAR_10, tmp); } else { neon_store_reg(VAR_5, VAR_10, tmp); } } if (VAR_12 && VAR_5 == VAR_7) { for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) { tmp = neon_load_scratch(VAR_10); neon_store_reg(VAR_5, VAR_10, tmp); } } } else if (VAR_2 & (1 << 4)) { if ((VAR_2 & 0x00380080) != 0) { VAR_3 = (VAR_2 >> 8) & 0xf; if (VAR_2 & (1 << 7)) { if (VAR_3 > 7) { return 1; } VAR_8 = 3; } else { VAR_8 = 2; while ((VAR_2 & (1 << (VAR_8 + 19))) == 0) VAR_8--; } VAR_9 = (VAR_2 >> 16) & ((1 << (3 + VAR_8)) - 1); if (VAR_3 < 8) { if (VAR_4 && ((VAR_5 | VAR_7) & 1)) { return 1; } if (!VAR_13 && (VAR_3 == 4 || VAR_3 == 6)) { return 1; } if (VAR_3 <= 4) VAR_9 = VAR_9 - (1 << (VAR_8 + 3)); if (VAR_8 == 3) { VAR_11 = VAR_4 + 1; } else { VAR_11 = VAR_4 ? 4: 2; } switch (VAR_8) { case 0: imm = (uint8_t) VAR_9; imm |= imm << 8; imm |= imm << 16; break; case 1: imm = (uint16_t) VAR_9; imm |= imm << 16; break; case 2: case 3: imm = VAR_9; break; default: abort(); } for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10++) { if (VAR_8 == 3) { neon_load_reg64(cpu_V0, VAR_7 + VAR_10); tcg_gen_movi_i64(cpu_V1, imm); switch (VAR_3) { case 0: case 1: if (VAR_13) gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 2: case 3: if (VAR_13) gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1); else gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1); break; case 4: case 5: gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1); break; case 6: gen_helper_neon_qshlu_s64(cpu_V0, cpu_V0, cpu_V1); break; case 7: if (VAR_13) { gen_helper_neon_qshl_u64(cpu_V0, cpu_V0, cpu_V1); } else { gen_helper_neon_qshl_s64(cpu_V0, cpu_V0, cpu_V1); } break; } if (VAR_3 == 1 || VAR_3 == 3) { neon_load_reg64(cpu_V1, VAR_5 + VAR_10); tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1); } else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) { neon_load_reg64(cpu_V1, VAR_5 + VAR_10); uint64_t mask; if (VAR_9 < -63 || VAR_9 > 63) { mask = 0; } else { if (VAR_3 == 4) { mask = 0xffffffffffffffffull >> -VAR_9; } else { mask = 0xffffffffffffffffull << VAR_9; } } tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } else { tmp = neon_load_reg(VAR_7, VAR_10); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, imm); switch (VAR_3) { case 0: case 1: GEN_NEON_INTEGER_OP(shl); break; case 2: case 3: GEN_NEON_INTEGER_OP(rshl); break; case 4: case 5: switch (VAR_8) { case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break; default: abort(); } break; case 6: switch (VAR_8) { case 0: gen_helper_neon_qshlu_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_qshlu_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_qshlu_s32(tmp, tmp, tmp2); break; default: abort(); } break; case 7: GEN_NEON_INTEGER_OP(qshl); break; } tcg_temp_free_i32(tmp2); if (VAR_3 == 1 || VAR_3 == 3) { tmp2 = neon_load_reg(VAR_5, VAR_10); gen_neon_add(VAR_8, tmp, tmp2); tcg_temp_free_i32(tmp2); } else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) { switch (VAR_8) { case 0: if (VAR_3 == 4) mask = 0xff >> -VAR_9; else mask = (uint8_t)(0xff << VAR_9); mask |= mask << 8; mask |= mask << 16; break; case 1: if (VAR_3 == 4) mask = 0xffff >> -VAR_9; else mask = (uint16_t)(0xffff << VAR_9); mask |= mask << 16; break; case 2: if (VAR_9 < -31 || VAR_9 > 31) { mask = 0; } else { if (VAR_3 == 4) mask = 0xffffffffu >> -VAR_9; else mask = 0xffffffffu << VAR_9; } break; default: abort(); } tmp2 = neon_load_reg(VAR_5, VAR_10); tcg_gen_andi_i32(tmp, tmp, mask); tcg_gen_andi_i32(tmp2, tmp2, ~mask); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); } neon_store_reg(VAR_5, VAR_10, tmp); } } } else if (VAR_3 < 10) { int VAR_15 = (VAR_3 == 8) ? !VAR_13 : VAR_13; if (VAR_7 & 1) { return 1; } VAR_9 = VAR_9 - (1 << (VAR_8 + 3)); VAR_8++; if (VAR_8 == 3) { tmp64 = tcg_const_i64(VAR_9); neon_load_reg64(cpu_V0, VAR_7); neon_load_reg64(cpu_V1, VAR_7 + 1); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { TCGv_i64 in; if (VAR_10 == 0) { in = cpu_V0; } else { in = cpu_V1; } if (VAR_4) { if (VAR_15) { gen_helper_neon_rshl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_rshl_s64(cpu_V0, in, tmp64); } } else { if (VAR_15) { gen_helper_neon_shl_u64(cpu_V0, in, tmp64); } else { gen_helper_neon_shl_s64(cpu_V0, in, tmp64); } } tmp = tcg_temp_new_i32(); gen_neon_narrow_op(VAR_3 == 8, VAR_13, VAR_8 - 1, tmp, cpu_V0); neon_store_reg(VAR_5, VAR_10, tmp); } tcg_temp_free_i64(tmp64); } else { if (VAR_8 == 1) { imm = (uint16_t)VAR_9; imm |= imm << 16; } else { imm = (uint32_t)VAR_9; } tmp2 = tcg_const_i32(imm); tmp4 = neon_load_reg(VAR_7 + 1, 0); tmp5 = neon_load_reg(VAR_7 + 1, 1); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { if (VAR_10 == 0) { tmp = neon_load_reg(VAR_7, 0); } else { tmp = tmp4; } gen_neon_shift_narrow(VAR_8, tmp, tmp2, VAR_4, VAR_15); if (VAR_10 == 0) { tmp3 = neon_load_reg(VAR_7, 1); } else { tmp3 = tmp5; } gen_neon_shift_narrow(VAR_8, tmp3, tmp2, VAR_4, VAR_15); tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp3); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(VAR_3 == 8, VAR_13, VAR_8 - 1, tmp, cpu_V0); neon_store_reg(VAR_5, VAR_10, tmp); } tcg_temp_free_i32(tmp2); } } else if (VAR_3 == 10) { if (VAR_4 || (VAR_5 & 1)) { return 1; } tmp = neon_load_reg(VAR_7, 0); tmp2 = neon_load_reg(VAR_7, 1); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { if (VAR_10 == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13); if (VAR_9 != 0) { tcg_gen_shli_i64(cpu_V0, cpu_V0, VAR_9); if (VAR_8 < 2 || !VAR_13) { uint64_t imm64; if (VAR_8 == 0) { imm = (0xffu >> (8 - VAR_9)); imm |= imm << 16; } else if (VAR_8 == 1) { imm = 0xffff >> (16 - VAR_9); } else { imm = 0xffffffff >> (32 - VAR_9); } if (VAR_8 < 2) { imm64 = imm | (((uint64_t)imm) << 32); } else { imm64 = imm; } tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64); } } neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } } else if (VAR_3 >= 14) { if (!(VAR_2 & (1 << 21)) || (VAR_4 && ((VAR_5 | VAR_7) & 1))) { return 1; } VAR_9 = 32 - VAR_9; for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, VAR_10)); if (!(VAR_3 & 1)) { if (VAR_13) gen_vfp_ulto(0, VAR_9); else gen_vfp_slto(0, VAR_9); } else { if (VAR_13) gen_vfp_toul(0, VAR_9); else gen_vfp_tosl(0, VAR_9); } tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, VAR_10)); } } else { return 1; } } else { int VAR_16; if (VAR_4 && (VAR_5 & 1)) { return 1; } VAR_3 = (VAR_2 >> 8) & 0xf; imm = (VAR_13 << 7) | ((VAR_2 >> 12) & 0x70) | (VAR_2 & 0xf); VAR_16 = (VAR_2 & (1 << 5)) != 0; switch (VAR_3) { case 0: case 1: break; case 2: case 3: imm <<= 8; break; case 4: case 5: imm <<= 16; break; case 6: case 7: imm <<= 24; break; case 8: case 9: imm |= imm << 16; break; case 10: case 11: imm = (imm << 8) | (imm << 24); break; case 12: imm = (imm << 8) | 0xff; break; case 13: imm = (imm << 16) | 0xffff; break; case 14: imm |= (imm << 8) | (imm << 16) | (imm << 24); if (VAR_16) imm = ~imm; break; case 15: if (VAR_16) { return 1; } imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19) | ((imm & 0x40) ? (0x1f << 25) : (1 << 30)); break; } if (VAR_16) imm = ~imm; for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) { if (VAR_3 & 1 && VAR_3 < 12) { tmp = neon_load_reg(VAR_5, VAR_10); if (VAR_16) { tcg_gen_andi_i32(tmp, tmp, imm); } else { tcg_gen_ori_i32(tmp, tmp, imm); } } else { tmp = tcg_temp_new_i32(); if (VAR_3 == 14 && VAR_16) { int VAR_23; uint32_t val; val = 0; for (VAR_23 = 0; VAR_23 < 4; VAR_23++) { if (imm & (1 << (VAR_23 + (VAR_10 & 1) * 4))) val |= 0xff << (VAR_23 * 8); } tcg_gen_movi_i32(tmp, val); } else { tcg_gen_movi_i32(tmp, imm); } } neon_store_reg(VAR_5, VAR_10, tmp); } } } else { if (VAR_8 != 3) { VAR_3 = (VAR_2 >> 8) & 0xf; if ((VAR_2 & (1 << 6)) == 0) { int VAR_18; int VAR_19; int VAR_20; int VAR_21; static const int VAR_22[16][4] = { {1, 0, 0, 0}, {1, 1, 0, 0}, {1, 0, 0, 0}, {1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 6}, {0, 0, 0, 0}, {0, 0, 0, 6}, {0, 0, 0, 0}, {0, 0, 0, 2}, {0, 0, 0, 5}, {0, 0, 0, 3}, }; VAR_20 = VAR_22[VAR_3][0]; VAR_18 = VAR_22[VAR_3][1]; VAR_19 = VAR_22[VAR_3][2]; VAR_21 = VAR_22[VAR_3][3]; if (((VAR_21 & 1) && (VAR_8 != 0)) || ((VAR_21 & 2) && (VAR_8 == 0)) || ((VAR_21 & 4) && VAR_13)) { return 1; } if ((VAR_18 && (VAR_6 & 1)) || (VAR_19 && (VAR_7 & 1)) || (!VAR_19 && (VAR_5 & 1))) { return 1; } if (VAR_5 == VAR_7 && !VAR_19) { tmp = neon_load_reg(VAR_7, 1); neon_store_scratch(2, tmp); } else if (VAR_5 == VAR_6 && !VAR_18) { tmp = neon_load_reg(VAR_6, 1); neon_store_scratch(2, tmp); } TCGV_UNUSED(tmp3); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { if (VAR_18) { neon_load_reg64(cpu_V0, VAR_6 + VAR_10); TCGV_UNUSED(tmp); } else { if (VAR_10 == 1 && VAR_5 == VAR_6) { tmp = neon_load_scratch(2); } else { tmp = neon_load_reg(VAR_6, VAR_10); } if (VAR_20) { gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13); } } if (VAR_19) { neon_load_reg64(cpu_V1, VAR_7 + VAR_10); TCGV_UNUSED(tmp2); } else { if (VAR_10 == 1 && VAR_5 == VAR_7) { tmp2 = neon_load_scratch(2); } else { tmp2 = neon_load_reg(VAR_7, VAR_10); } if (VAR_20) { gen_neon_widen(cpu_V1, tmp2, VAR_8, VAR_13); } } switch (VAR_3) { case 0: case 1: case 4: gen_neon_addl(VAR_8); break; case 2: case 3: case 6: gen_neon_subl(VAR_8); break; case 5: case 7: switch ((VAR_8 << 1) | VAR_13) { case 0: gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2); break; case 1: gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2); break; case 2: gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2); break; case 3: gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2); break; case 4: gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2); break; case 5: gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2); break; default: abort(); } tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 8: case 9: case 10: case 11: case 12: case 13: gen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13); break; case 14: gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; default: abort(); } if (VAR_3 == 13) { gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8); neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } else if (VAR_3 == 5 || (VAR_3 >= 8 && VAR_3 <= 11)) { neon_load_reg64(cpu_V1, VAR_5 + VAR_10); switch (VAR_3) { case 10: gen_neon_negl(cpu_V0, VAR_8); case 5: case 8: gen_neon_addl(VAR_8); break; case 9: case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8); if (VAR_3 == 11) { gen_neon_negl(cpu_V0, VAR_8); } gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8); break; default: abort(); } neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } else if (VAR_3 == 4 || VAR_3 == 6) { tmp = tcg_temp_new_i32(); if (!VAR_13) { switch (VAR_8) { case 0: gen_helper_neon_narrow_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } else { switch (VAR_8) { case 0: gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0); break; case 1: gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0); break; case 2: tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); tcg_gen_trunc_i64_i32(tmp, cpu_V0); break; default: abort(); } } if (VAR_10 == 0) { tmp3 = tmp; } else { neon_store_reg(VAR_5, 0, tmp3); neon_store_reg(VAR_5, 1, tmp); } } else { neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } } } else { if (VAR_8 == 0) { return 1; } switch (VAR_3) { case 1: case 5: case 9: if (VAR_8 == 1) { return 1; } case 0: case 4: case 8: case 12: case 13: if (VAR_13 && ((VAR_5 | VAR_6) & 1)) { return 1; } tmp = neon_get_scalar(VAR_8, VAR_7); neon_store_scratch(0, tmp); for (VAR_10 = 0; VAR_10 < (VAR_13 ? 4 : 2); VAR_10++) { tmp = neon_load_scratch(0); tmp2 = neon_load_reg(VAR_6, VAR_10); if (VAR_3 == 12) { if (VAR_8 == 1) { gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); } else { gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); } } else if (VAR_3 == 13) { if (VAR_8 == 1) { gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); } else { gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); } } else if (VAR_3 & 1) { gen_helper_neon_mul_f32(tmp, tmp, tmp2); } else { switch (VAR_8) { case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break; case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp2); if (VAR_3 < 8) { tmp2 = neon_load_reg(VAR_5, VAR_10); switch (VAR_3) { case 0: gen_neon_add(VAR_8, tmp, tmp2); break; case 1: gen_helper_neon_add_f32(tmp, tmp, tmp2); break; case 4: gen_neon_rsb(VAR_8, tmp, tmp2); break; case 5: gen_helper_neon_sub_f32(tmp, tmp2, tmp); break; default: abort(); } tcg_temp_free_i32(tmp2); } neon_store_reg(VAR_5, VAR_10, tmp); } break; case 3: case 7: case 11: if (VAR_13 == 1) { return 1; } case 2: case 6: case 10: if (VAR_5 & 1) { return 1; } tmp2 = neon_get_scalar(VAR_8, VAR_7); tmp4 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp4, tmp2); tmp3 = neon_load_reg(VAR_6, 1); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { if (VAR_10 == 0) { tmp = neon_load_reg(VAR_6, 0); } else { tmp = tmp3; tmp2 = tmp4; } gen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13); if (VAR_3 != 11) { neon_load_reg64(cpu_V1, VAR_5 + VAR_10); } switch (VAR_3) { case 6: gen_neon_negl(cpu_V0, VAR_8); case 2: gen_neon_addl(VAR_8); break; case 3: case 7: gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8); if (VAR_3 == 7) { gen_neon_negl(cpu_V0, VAR_8); } gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8); break; case 10: break; case 11: gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8); break; default: abort(); } neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } break; default: return 1; } } } else { if (!VAR_13) { imm = (VAR_2 >> 8) & 0xf; if (imm > 7 && !VAR_4) return 1; if (VAR_4 && ((VAR_5 | VAR_6 | VAR_7) & 1)) { return 1; } if (imm == 0) { neon_load_reg64(cpu_V0, VAR_6); if (VAR_4) { neon_load_reg64(cpu_V1, VAR_6 + 1); } } else if (imm == 8) { neon_load_reg64(cpu_V0, VAR_6 + 1); if (VAR_4) { neon_load_reg64(cpu_V1, VAR_7); } } else if (VAR_4) { tmp64 = tcg_temp_new_i64(); if (imm < 8) { neon_load_reg64(cpu_V0, VAR_6); neon_load_reg64(tmp64, VAR_6 + 1); } else { neon_load_reg64(cpu_V0, VAR_6 + 1); neon_load_reg64(tmp64, VAR_7); } tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8); tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); if (imm < 8) { neon_load_reg64(cpu_V1, VAR_7); } else { neon_load_reg64(cpu_V1, VAR_7 + 1); imm -= 8; } tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_shri_i64(tmp64, tmp64, imm * 8); tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64); tcg_temp_free_i64(tmp64); } else { neon_load_reg64(cpu_V0, VAR_6); tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8); neon_load_reg64(cpu_V1, VAR_7); tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8)); tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1); } neon_store_reg64(cpu_V0, VAR_5); if (VAR_4) { neon_store_reg64(cpu_V1, VAR_5 + 1); } } else if ((VAR_2 & (1 << 11)) == 0) { VAR_3 = ((VAR_2 >> 12) & 0x30) | ((VAR_2 >> 7) & 0xf); VAR_8 = (VAR_2 >> 18) & 3; if ((neon_2rm_sizes[VAR_3] & (1 << VAR_8)) == 0) { return 1; } switch (VAR_3) { case NEON_2RM_VREV64: for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) { tmp = neon_load_reg(VAR_7, VAR_10 * 2); tmp2 = neon_load_reg(VAR_7, VAR_10 * 2 + 1); switch (VAR_8) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; case 2: break; default: abort(); } neon_store_reg(VAR_5, VAR_10 * 2 + 1, tmp); if (VAR_8 == 2) { neon_store_reg(VAR_5, VAR_10 * 2, tmp2); } else { switch (VAR_8) { case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break; case 1: gen_swap_half(tmp2); break; default: abort(); } neon_store_reg(VAR_5, VAR_10 * 2, tmp2); } } break; case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U: case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U: for (VAR_10 = 0; VAR_10 < VAR_4 + 1; VAR_10++) { tmp = neon_load_reg(VAR_7, VAR_10 * 2); gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_3 & 1); tmp = neon_load_reg(VAR_7, VAR_10 * 2 + 1); gen_neon_widen(cpu_V1, tmp, VAR_8, VAR_3 & 1); switch (VAR_8) { case 0: gen_helper_neon_paddl_u16(CPU_V001); break; case 1: gen_helper_neon_paddl_u32(CPU_V001); break; case 2: tcg_gen_add_i64(CPU_V001); break; default: abort(); } if (VAR_3 >= NEON_2RM_VPADAL) { neon_load_reg64(cpu_V1, VAR_5 + VAR_10); gen_neon_addl(VAR_8); } neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } break; case NEON_2RM_VTRN: if (VAR_8 == 2) { int VAR_23; for (VAR_23 = 0; VAR_23 < (VAR_4 ? 4 : 2); VAR_23 += 2) { tmp = neon_load_reg(VAR_7, VAR_23); tmp2 = neon_load_reg(VAR_5, VAR_23 + 1); neon_store_reg(VAR_7, VAR_23, tmp2); neon_store_reg(VAR_5, VAR_23 + 1, tmp); } } else { goto elementwise; } break; case NEON_2RM_VUZP: if (gen_neon_unzip(VAR_5, VAR_7, VAR_8, VAR_4)) { return 1; } break; case NEON_2RM_VZIP: if (gen_neon_zip(VAR_5, VAR_7, VAR_8, VAR_4)) { return 1; } break; case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN: TCGV_UNUSED(tmp2); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { neon_load_reg64(cpu_V0, VAR_7 + VAR_10); tmp = tcg_temp_new_i32(); gen_neon_narrow_op(VAR_3 == NEON_2RM_VMOVN, VAR_4, VAR_8, tmp, cpu_V0); if (VAR_10 == 0) { tmp2 = tmp; } else { neon_store_reg(VAR_5, 0, tmp2); neon_store_reg(VAR_5, 1, tmp); } } break; case NEON_2RM_VSHLL: if (VAR_4) { return 1; } tmp = neon_load_reg(VAR_7, 0); tmp2 = neon_load_reg(VAR_7, 1); for (VAR_10 = 0; VAR_10 < 2; VAR_10++) { if (VAR_10 == 1) tmp = tmp2; gen_neon_widen(cpu_V0, tmp, VAR_8, 1); tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << VAR_8); neon_store_reg64(cpu_V0, VAR_5 + VAR_10); } break; case NEON_2RM_VCVT_F16_F32: if (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16)) return 1; tmp = tcg_temp_new_i32(); tmp2 = tcg_temp_new_i32(); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 0)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 1)); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 2)); gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env); tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 3)); neon_store_reg(VAR_5, 0, tmp2); tmp2 = tcg_temp_new_i32(); gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env); tcg_gen_shli_i32(tmp2, tmp2, 16); tcg_gen_or_i32(tmp2, tmp2, tmp); neon_store_reg(VAR_5, 1, tmp2); tcg_temp_free_i32(tmp); break; case NEON_2RM_VCVT_F32_F16: if (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16)) return 1; tmp3 = tcg_temp_new_i32(); tmp = neon_load_reg(VAR_7, 0); tmp2 = neon_load_reg(VAR_7, 1); tcg_gen_ext16u_i32(tmp3, tmp); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 0)); tcg_gen_shri_i32(tmp3, tmp, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 1)); tcg_temp_free_i32(tmp); tcg_gen_ext16u_i32(tmp3, tmp2); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 2)); tcg_gen_shri_i32(tmp3, tmp2, 16); gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env); tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 3)); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp3); break; default: elementwise: for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) { if (neon_2rm_is_float_op(VAR_3)) { tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, VAR_10)); TCGV_UNUSED(tmp); } else { tmp = neon_load_reg(VAR_7, VAR_10); } switch (VAR_3) { case NEON_2RM_VREV32: switch (VAR_8) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_swap_half(tmp); break; default: abort(); } break; case NEON_2RM_VREV16: gen_rev16(tmp); break; case NEON_2RM_VCLS: switch (VAR_8) { case 0: gen_helper_neon_cls_s8(tmp, tmp); break; case 1: gen_helper_neon_cls_s16(tmp, tmp); break; case 2: gen_helper_neon_cls_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCLZ: switch (VAR_8) { case 0: gen_helper_neon_clz_u8(tmp, tmp); break; case 1: gen_helper_neon_clz_u16(tmp, tmp); break; case 2: gen_helper_clz(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCNT: gen_helper_neon_cnt_u8(tmp, tmp); break; case NEON_2RM_VMVN: tcg_gen_not_i32(tmp, tmp); break; case NEON_2RM_VQABS: switch (VAR_8) { case 0: gen_helper_neon_qabs_s8(tmp, tmp); break; case 1: gen_helper_neon_qabs_s16(tmp, tmp); break; case 2: gen_helper_neon_qabs_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VQNEG: switch (VAR_8) { case 0: gen_helper_neon_qneg_s8(tmp, tmp); break; case 1: gen_helper_neon_qneg_s16(tmp, tmp); break; case 2: gen_helper_neon_qneg_s32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VCGT0: case NEON_2RM_VCLE0: tmp2 = tcg_const_i32(0); switch(VAR_8) { case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); if (VAR_3 == NEON_2RM_VCLE0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCGE0: case NEON_2RM_VCLT0: tmp2 = tcg_const_i32(0); switch(VAR_8) { case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); if (VAR_3 == NEON_2RM_VCLT0) { tcg_gen_not_i32(tmp, tmp); } break; case NEON_2RM_VCEQ0: tmp2 = tcg_const_i32(0); switch(VAR_8) { case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break; case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break; case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break; default: abort(); } tcg_temp_free(tmp2); break; case NEON_2RM_VABS: switch(VAR_8) { case 0: gen_helper_neon_abs_s8(tmp, tmp); break; case 1: gen_helper_neon_abs_s16(tmp, tmp); break; case 2: tcg_gen_abs_i32(tmp, tmp); break; default: abort(); } break; case NEON_2RM_VNEG: tmp2 = tcg_const_i32(0); gen_neon_rsb(VAR_8, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCGT0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCGE0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCEQ0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_ceq_f32(tmp, tmp, tmp2); tcg_temp_free(tmp2); break; case NEON_2RM_VCLE0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cge_f32(tmp, tmp2, tmp); tcg_temp_free(tmp2); break; case NEON_2RM_VCLT0_F: tmp2 = tcg_const_i32(0); gen_helper_neon_cgt_f32(tmp, tmp2, tmp); tcg_temp_free(tmp2); break; case NEON_2RM_VABS_F: gen_vfp_abs(0); break; case NEON_2RM_VNEG_F: gen_vfp_neg(0); break; case NEON_2RM_VSWP: tmp2 = neon_load_reg(VAR_5, VAR_10); neon_store_reg(VAR_7, VAR_10, tmp2); break; case NEON_2RM_VTRN: tmp2 = neon_load_reg(VAR_5, VAR_10); switch (VAR_8) { case 0: gen_neon_trn_u8(tmp, tmp2); break; case 1: gen_neon_trn_u16(tmp, tmp2); break; default: abort(); } neon_store_reg(VAR_7, VAR_10, tmp2); break; case NEON_2RM_VRECPE: gen_helper_recpe_u32(tmp, tmp, cpu_env); break; case NEON_2RM_VRSQRTE: gen_helper_rsqrte_u32(tmp, tmp, cpu_env); break; case NEON_2RM_VRECPE_F: gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env); break; case NEON_2RM_VRSQRTE_F: gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env); break; case NEON_2RM_VCVT_FS: gen_vfp_sito(0); break; case NEON_2RM_VCVT_FU: gen_vfp_uito(0); break; case NEON_2RM_VCVT_SF: gen_vfp_tosiz(0); break; case NEON_2RM_VCVT_UF: gen_vfp_touiz(0); break; default: abort(); } if (neon_2rm_is_float_op(VAR_3)) { tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, VAR_10)); } else { neon_store_reg(VAR_5, VAR_10, tmp); } } break; } } else if ((VAR_2 & (1 << 10)) == 0) { int VAR_23 = ((VAR_2 >> 5) & 0x18) + 8; if (VAR_2 & (1 << 6)) { tmp = neon_load_reg(VAR_5, 0); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp2 = neon_load_reg(VAR_7, 0); tmp4 = tcg_const_i32(VAR_6); tmp5 = tcg_const_i32(VAR_23); gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp); if (VAR_2 & (1 << 6)) { tmp = neon_load_reg(VAR_5, 1); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } tmp3 = neon_load_reg(VAR_7, 1); gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5); tcg_temp_free_i32(tmp5); tcg_temp_free_i32(tmp4); neon_store_reg(VAR_5, 0, tmp2); neon_store_reg(VAR_5, 1, tmp3); tcg_temp_free_i32(tmp); } else if ((VAR_2 & 0x380) == 0) { if (VAR_2 & (1 << 19)) { tmp = neon_load_reg(VAR_7, 1); } else { tmp = neon_load_reg(VAR_7, 0); } if (VAR_2 & (1 << 16)) { gen_neon_dup_u8(tmp, ((VAR_2 >> 17) & 3) * 8); } else if (VAR_2 & (1 << 17)) { if ((VAR_2 >> 18) & 1) gen_neon_dup_high16(tmp); else gen_neon_dup_low16(tmp); } for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) { tmp2 = tcg_temp_new_i32(); tcg_gen_mov_i32(tmp2, tmp); neon_store_reg(VAR_5, VAR_10, tmp2); } tcg_temp_free_i32(tmp); } else { return 1; } } } return 0; }
[ "static int FUNC_0(CPUState * VAR_0, DisasContext *VAR_1, uint32_t VAR_2)\n{", "int VAR_3;", "int VAR_4;", "int VAR_5, VAR_6, VAR_7;", "int VAR_8;", "int VAR_9;", "int VAR_10;", "int VAR_11;", "int VAR_12;", "int VAR_13;", "uint32_t imm, mask;", "TCGv tmp, tmp2, tmp3, tmp4, tmp5;", "TCGv_i64 tmp64;", "if (!VAR_1->vfp_enabled)\nreturn 1;", "VAR_4 = (VAR_2 & (1 << 6)) != 0;", "VAR_13 = (VAR_2 >> 24) & 1;", "VFP_DREG_D(VAR_5, VAR_2);", "VFP_DREG_N(VAR_6, VAR_2);", "VFP_DREG_M(VAR_7, VAR_2);", "VAR_8 = (VAR_2 >> 20) & 3;", "if ((VAR_2 & (1 << 23)) == 0) {", "VAR_3 = ((VAR_2 >> 7) & 0x1e) | ((VAR_2 >> 4) & 1);", "if ((neon_3r_sizes[VAR_3] & (1 << VAR_8)) == 0) {", "return 1;", "}", "if (VAR_4 && ((VAR_5 | VAR_6 | VAR_7) & 1)) {", "return 1;", "}", "if (VAR_8 == 3 && VAR_3 != NEON_3R_LOGIC) {", "for (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) {", "neon_load_reg64(cpu_V0, VAR_6 + VAR_10);", "neon_load_reg64(cpu_V1, VAR_7 + VAR_10);", "switch (VAR_3) {", "case NEON_3R_VQADD:\nif (VAR_13) {", "gen_helper_neon_qadd_u64(cpu_V0, cpu_V0, cpu_V1);", "} else {", "gen_helper_neon_qadd_s64(cpu_V0, cpu_V0, cpu_V1);", "}", "break;", "case NEON_3R_VQSUB:\nif (VAR_13) {", "gen_helper_neon_qsub_u64(cpu_V0, cpu_V0, cpu_V1);", "} else {", "gen_helper_neon_qsub_s64(cpu_V0, cpu_V0, cpu_V1);", "}", "break;", "case NEON_3R_VSHL:\nif (VAR_13) {", "gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);", "} else {", "gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VQSHL:\nif (VAR_13) {", "gen_helper_neon_qshl_u64(cpu_V0, cpu_V1, cpu_V0);", "} else {", "gen_helper_neon_qshl_s64(cpu_V0, cpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VRSHL:\nif (VAR_13) {", "gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);", "} else {", "gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VQRSHL:\nif (VAR_13) {", "gen_helper_neon_qrshl_u64(cpu_V0, cpu_V1, cpu_V0);", "} else {", "gen_helper_neon_qrshl_s64(cpu_V0, cpu_V1, cpu_V0);", "}", "break;", "case NEON_3R_VADD_VSUB:\nif (VAR_13) {", "tcg_gen_sub_i64(CPU_V001);", "} else {", "tcg_gen_add_i64(CPU_V001);", "}", "break;", "default:\nabort();", "}", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "}", "return 0;", "}", "VAR_12 = 0;", "switch (VAR_3) {", "case NEON_3R_VSHL:\ncase NEON_3R_VQSHL:\ncase NEON_3R_VRSHL:\ncase NEON_3R_VQRSHL:\n{", "int VAR_14;", "VAR_14 = VAR_6;", "VAR_6 = VAR_7;", "VAR_7 = VAR_14;", "}", "break;", "case NEON_3R_VPADD:\nif (VAR_13) {", "return 1;", "}", "case NEON_3R_VPMAX:\ncase NEON_3R_VPMIN:\nVAR_12 = 1;", "break;", "case NEON_3R_FLOAT_ARITH:\nVAR_12 = (VAR_13 && VAR_8 < 2);", "break;", "case NEON_3R_FLOAT_MINMAX:\nVAR_12 = VAR_13;", "break;", "case NEON_3R_FLOAT_CMP:\nif (!VAR_13 && VAR_8) {", "return 1;", "}", "break;", "case NEON_3R_FLOAT_ACMP:\nif (!VAR_13) {", "return 1;", "}", "break;", "case NEON_3R_VRECPS_VRSQRTS:\nif (VAR_13) {", "return 1;", "}", "break;", "case NEON_3R_VMUL:\nif (VAR_13 && (VAR_8 != 0)) {", "return 1;", "}", "break;", "default:\nbreak;", "}", "if (VAR_12 && VAR_4) {", "return 1;", "}", "for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {", "if (VAR_12) {", "if (VAR_10 < 1) {", "tmp = neon_load_reg(VAR_6, 0);", "tmp2 = neon_load_reg(VAR_6, 1);", "} else {", "tmp = neon_load_reg(VAR_7, 0);", "tmp2 = neon_load_reg(VAR_7, 1);", "}", "} else {", "tmp = neon_load_reg(VAR_6, VAR_10);", "tmp2 = neon_load_reg(VAR_7, VAR_10);", "}", "switch (VAR_3) {", "case NEON_3R_VHADD:\nGEN_NEON_INTEGER_OP(hadd);", "break;", "case NEON_3R_VQADD:\nGEN_NEON_INTEGER_OP(qadd);", "break;", "case NEON_3R_VRHADD:\nGEN_NEON_INTEGER_OP(rhadd);", "break;", "case NEON_3R_LOGIC:\nswitch ((VAR_13 << 2) | VAR_8) {", "case 0:\ntcg_gen_and_i32(tmp, tmp, tmp2);", "break;", "case 1:\ntcg_gen_andc_i32(tmp, tmp, tmp2);", "break;", "case 2:\ntcg_gen_or_i32(tmp, tmp, tmp2);", "break;", "case 3:\ntcg_gen_orc_i32(tmp, tmp, tmp2);", "break;", "case 4:\ntcg_gen_xor_i32(tmp, tmp, tmp2);", "break;", "case 5:\ntmp3 = neon_load_reg(VAR_5, VAR_10);", "gen_neon_bsl(tmp, tmp, tmp2, tmp3);", "tcg_temp_free_i32(tmp3);", "break;", "case 6:\ntmp3 = neon_load_reg(VAR_5, VAR_10);", "gen_neon_bsl(tmp, tmp, tmp3, tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "case 7:\ntmp3 = neon_load_reg(VAR_5, VAR_10);", "gen_neon_bsl(tmp, tmp3, tmp, tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "}", "break;", "case NEON_3R_VHSUB:\nGEN_NEON_INTEGER_OP(hsub);", "break;", "case NEON_3R_VQSUB:\nGEN_NEON_INTEGER_OP(qsub);", "break;", "case NEON_3R_VCGT:\nGEN_NEON_INTEGER_OP(cgt);", "break;", "case NEON_3R_VCGE:\nGEN_NEON_INTEGER_OP(cge);", "break;", "case NEON_3R_VSHL:\nGEN_NEON_INTEGER_OP(shl);", "break;", "case NEON_3R_VQSHL:\nGEN_NEON_INTEGER_OP(qshl);", "break;", "case NEON_3R_VRSHL:\nGEN_NEON_INTEGER_OP(rshl);", "break;", "case NEON_3R_VQRSHL:\nGEN_NEON_INTEGER_OP(qrshl);", "break;", "case NEON_3R_VMAX:\nGEN_NEON_INTEGER_OP(max);", "break;", "case NEON_3R_VMIN:\nGEN_NEON_INTEGER_OP(min);", "break;", "case NEON_3R_VABD:\nGEN_NEON_INTEGER_OP(abd);", "break;", "case NEON_3R_VABA:\nGEN_NEON_INTEGER_OP(abd);", "tcg_temp_free_i32(tmp2);", "tmp2 = neon_load_reg(VAR_5, VAR_10);", "gen_neon_add(VAR_8, tmp, tmp2);", "break;", "case NEON_3R_VADD_VSUB:\nif (!VAR_13) {", "gen_neon_add(VAR_8, tmp, tmp2);", "} else {", "switch (VAR_8) {", "case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VTST_VCEQ:\nif (!VAR_13) {", "switch (VAR_8) {", "case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "} else {", "switch (VAR_8) {", "case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VML:\nswitch (VAR_8) {", "case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "tmp2 = neon_load_reg(VAR_5, VAR_10);", "if (VAR_13) {", "gen_neon_rsb(VAR_8, tmp, tmp2);", "} else {", "gen_neon_add(VAR_8, tmp, tmp2);", "}", "break;", "case NEON_3R_VMUL:\nif (VAR_13) {", "gen_helper_neon_mul_p8(tmp, tmp, tmp2);", "} else {", "switch (VAR_8) {", "case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VPMAX:\nGEN_NEON_INTEGER_OP(pmax);", "break;", "case NEON_3R_VPMIN:\nGEN_NEON_INTEGER_OP(pmin);", "break;", "case NEON_3R_VQDMULH_VQRDMULH:\nif (!VAR_13) {", "switch (VAR_8) {", "case 1: gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); break;", "default: abort();", "}", "} else {", "switch (VAR_8) {", "case 1: gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "break;", "case NEON_3R_VPADD:\nswitch (VAR_8) {", "case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "break;", "case NEON_3R_FLOAT_ARITH:\nswitch ((VAR_13 << 2) | VAR_8) {", "case 0:\ngen_helper_neon_add_f32(tmp, tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_sub_f32(tmp, tmp, tmp2);", "break;", "case 4:\ngen_helper_neon_add_f32(tmp, tmp, tmp2);", "break;", "case 6:\ngen_helper_neon_abd_f32(tmp, tmp, tmp2);", "break;", "default:\nabort();", "}", "break;", "case NEON_3R_FLOAT_MULTIPLY:\ngen_helper_neon_mul_f32(tmp, tmp, tmp2);", "if (!VAR_13) {", "tcg_temp_free_i32(tmp2);", "tmp2 = neon_load_reg(VAR_5, VAR_10);", "if (VAR_8 == 0) {", "gen_helper_neon_add_f32(tmp, tmp, tmp2);", "} else {", "gen_helper_neon_sub_f32(tmp, tmp2, tmp);", "}", "}", "break;", "case NEON_3R_FLOAT_CMP:\nif (!VAR_13) {", "gen_helper_neon_ceq_f32(tmp, tmp, tmp2);", "} else {", "if (VAR_8 == 0)\ngen_helper_neon_cge_f32(tmp, tmp, tmp2);", "else\ngen_helper_neon_cgt_f32(tmp, tmp, tmp2);", "}", "break;", "case NEON_3R_FLOAT_ACMP:\nif (VAR_8 == 0)\ngen_helper_neon_acge_f32(tmp, tmp, tmp2);", "else\ngen_helper_neon_acgt_f32(tmp, tmp, tmp2);", "break;", "case NEON_3R_FLOAT_MINMAX:\nif (VAR_8 == 0)\ngen_helper_neon_max_f32(tmp, tmp, tmp2);", "else\ngen_helper_neon_min_f32(tmp, tmp, tmp2);", "break;", "case NEON_3R_VRECPS_VRSQRTS:\nif (VAR_8 == 0)\ngen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);", "else\ngen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);", "break;", "default:\nabort();", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_12 && VAR_5 == VAR_7) {", "neon_store_scratch(VAR_10, tmp);", "} else {", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "}", "if (VAR_12 && VAR_5 == VAR_7) {", "for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {", "tmp = neon_load_scratch(VAR_10);", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "}", "} else if (VAR_2 & (1 << 4)) {", "if ((VAR_2 & 0x00380080) != 0) {", "VAR_3 = (VAR_2 >> 8) & 0xf;", "if (VAR_2 & (1 << 7)) {", "if (VAR_3 > 7) {", "return 1;", "}", "VAR_8 = 3;", "} else {", "VAR_8 = 2;", "while ((VAR_2 & (1 << (VAR_8 + 19))) == 0)\nVAR_8--;", "}", "VAR_9 = (VAR_2 >> 16) & ((1 << (3 + VAR_8)) - 1);", "if (VAR_3 < 8) {", "if (VAR_4 && ((VAR_5 | VAR_7) & 1)) {", "return 1;", "}", "if (!VAR_13 && (VAR_3 == 4 || VAR_3 == 6)) {", "return 1;", "}", "if (VAR_3 <= 4)\nVAR_9 = VAR_9 - (1 << (VAR_8 + 3));", "if (VAR_8 == 3) {", "VAR_11 = VAR_4 + 1;", "} else {", "VAR_11 = VAR_4 ? 4: 2;", "}", "switch (VAR_8) {", "case 0:\nimm = (uint8_t) VAR_9;", "imm |= imm << 8;", "imm |= imm << 16;", "break;", "case 1:\nimm = (uint16_t) VAR_9;", "imm |= imm << 16;", "break;", "case 2:\ncase 3:\nimm = VAR_9;", "break;", "default:\nabort();", "}", "for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10++) {", "if (VAR_8 == 3) {", "neon_load_reg64(cpu_V0, VAR_7 + VAR_10);", "tcg_gen_movi_i64(cpu_V1, imm);", "switch (VAR_3) {", "case 0:\ncase 1:\nif (VAR_13)\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);", "else\ngen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 2:\ncase 3:\nif (VAR_13)\ngen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);", "else\ngen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 4:\ncase 5:\ngen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 6:\ngen_helper_neon_qshlu_s64(cpu_V0, cpu_V0, cpu_V1);", "break;", "case 7:\nif (VAR_13) {", "gen_helper_neon_qshl_u64(cpu_V0,\ncpu_V0, cpu_V1);", "} else {", "gen_helper_neon_qshl_s64(cpu_V0,\ncpu_V0, cpu_V1);", "}", "break;", "}", "if (VAR_3 == 1 || VAR_3 == 3) {", "neon_load_reg64(cpu_V1, VAR_5 + VAR_10);", "tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);", "} else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) {", "neon_load_reg64(cpu_V1, VAR_5 + VAR_10);", "uint64_t mask;", "if (VAR_9 < -63 || VAR_9 > 63) {", "mask = 0;", "} else {", "if (VAR_3 == 4) {", "mask = 0xffffffffffffffffull >> -VAR_9;", "} else {", "mask = 0xffffffffffffffffull << VAR_9;", "}", "}", "tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask);", "tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);", "}", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "} else {", "tmp = neon_load_reg(VAR_7, VAR_10);", "tmp2 = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp2, imm);", "switch (VAR_3) {", "case 0:\ncase 1:\nGEN_NEON_INTEGER_OP(shl);", "break;", "case 2:\ncase 3:\nGEN_NEON_INTEGER_OP(rshl);", "break;", "case 4:\ncase 5:\nswitch (VAR_8) {", "case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "break;", "case 6:\nswitch (VAR_8) {", "case 0:\ngen_helper_neon_qshlu_s8(tmp, tmp, tmp2);", "break;", "case 1:\ngen_helper_neon_qshlu_s16(tmp, tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_qshlu_s32(tmp, tmp, tmp2);", "break;", "default:\nabort();", "}", "break;", "case 7:\nGEN_NEON_INTEGER_OP(qshl);", "break;", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_3 == 1 || VAR_3 == 3) {", "tmp2 = neon_load_reg(VAR_5, VAR_10);", "gen_neon_add(VAR_8, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "} else if (VAR_3 == 4 || (VAR_3 == 5 && VAR_13)) {", "switch (VAR_8) {", "case 0:\nif (VAR_3 == 4)\nmask = 0xff >> -VAR_9;", "else\nmask = (uint8_t)(0xff << VAR_9);", "mask |= mask << 8;", "mask |= mask << 16;", "break;", "case 1:\nif (VAR_3 == 4)\nmask = 0xffff >> -VAR_9;", "else\nmask = (uint16_t)(0xffff << VAR_9);", "mask |= mask << 16;", "break;", "case 2:\nif (VAR_9 < -31 || VAR_9 > 31) {", "mask = 0;", "} else {", "if (VAR_3 == 4)\nmask = 0xffffffffu >> -VAR_9;", "else\nmask = 0xffffffffu << VAR_9;", "}", "break;", "default:\nabort();", "}", "tmp2 = neon_load_reg(VAR_5, VAR_10);", "tcg_gen_andi_i32(tmp, tmp, mask);", "tcg_gen_andi_i32(tmp2, tmp2, ~mask);", "tcg_gen_or_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "}", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "}", "} else if (VAR_3 < 10) {", "int VAR_15 = (VAR_3 == 8) ? !VAR_13 : VAR_13;", "if (VAR_7 & 1) {", "return 1;", "}", "VAR_9 = VAR_9 - (1 << (VAR_8 + 3));", "VAR_8++;", "if (VAR_8 == 3) {", "tmp64 = tcg_const_i64(VAR_9);", "neon_load_reg64(cpu_V0, VAR_7);", "neon_load_reg64(cpu_V1, VAR_7 + 1);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "TCGv_i64 in;", "if (VAR_10 == 0) {", "in = cpu_V0;", "} else {", "in = cpu_V1;", "}", "if (VAR_4) {", "if (VAR_15) {", "gen_helper_neon_rshl_u64(cpu_V0, in, tmp64);", "} else {", "gen_helper_neon_rshl_s64(cpu_V0, in, tmp64);", "}", "} else {", "if (VAR_15) {", "gen_helper_neon_shl_u64(cpu_V0, in, tmp64);", "} else {", "gen_helper_neon_shl_s64(cpu_V0, in, tmp64);", "}", "}", "tmp = tcg_temp_new_i32();", "gen_neon_narrow_op(VAR_3 == 8, VAR_13, VAR_8 - 1, tmp, cpu_V0);", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "tcg_temp_free_i64(tmp64);", "} else {", "if (VAR_8 == 1) {", "imm = (uint16_t)VAR_9;", "imm |= imm << 16;", "} else {", "imm = (uint32_t)VAR_9;", "}", "tmp2 = tcg_const_i32(imm);", "tmp4 = neon_load_reg(VAR_7 + 1, 0);", "tmp5 = neon_load_reg(VAR_7 + 1, 1);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "if (VAR_10 == 0) {", "tmp = neon_load_reg(VAR_7, 0);", "} else {", "tmp = tmp4;", "}", "gen_neon_shift_narrow(VAR_8, tmp, tmp2, VAR_4,\nVAR_15);", "if (VAR_10 == 0) {", "tmp3 = neon_load_reg(VAR_7, 1);", "} else {", "tmp3 = tmp5;", "}", "gen_neon_shift_narrow(VAR_8, tmp3, tmp2, VAR_4,\nVAR_15);", "tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp3);", "tmp = tcg_temp_new_i32();", "gen_neon_narrow_op(VAR_3 == 8, VAR_13, VAR_8 - 1, tmp, cpu_V0);", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "tcg_temp_free_i32(tmp2);", "}", "} else if (VAR_3 == 10) {", "if (VAR_4 || (VAR_5 & 1)) {", "return 1;", "}", "tmp = neon_load_reg(VAR_7, 0);", "tmp2 = neon_load_reg(VAR_7, 1);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "if (VAR_10 == 1)\ntmp = tmp2;", "gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13);", "if (VAR_9 != 0) {", "tcg_gen_shli_i64(cpu_V0, cpu_V0, VAR_9);", "if (VAR_8 < 2 || !VAR_13) {", "uint64_t imm64;", "if (VAR_8 == 0) {", "imm = (0xffu >> (8 - VAR_9));", "imm |= imm << 16;", "} else if (VAR_8 == 1) {", "imm = 0xffff >> (16 - VAR_9);", "} else {", "imm = 0xffffffff >> (32 - VAR_9);", "}", "if (VAR_8 < 2) {", "imm64 = imm | (((uint64_t)imm) << 32);", "} else {", "imm64 = imm;", "}", "tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64);", "}", "}", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "}", "} else if (VAR_3 >= 14) {", "if (!(VAR_2 & (1 << 21)) || (VAR_4 && ((VAR_5 | VAR_7) & 1))) {", "return 1;", "}", "VAR_9 = 32 - VAR_9;", "for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, VAR_10));", "if (!(VAR_3 & 1)) {", "if (VAR_13)\ngen_vfp_ulto(0, VAR_9);", "else\ngen_vfp_slto(0, VAR_9);", "} else {", "if (VAR_13)\ngen_vfp_toul(0, VAR_9);", "else\ngen_vfp_tosl(0, VAR_9);", "}", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, VAR_10));", "}", "} else {", "return 1;", "}", "} else {", "int VAR_16;", "if (VAR_4 && (VAR_5 & 1)) {", "return 1;", "}", "VAR_3 = (VAR_2 >> 8) & 0xf;", "imm = (VAR_13 << 7) | ((VAR_2 >> 12) & 0x70) | (VAR_2 & 0xf);", "VAR_16 = (VAR_2 & (1 << 5)) != 0;", "switch (VAR_3) {", "case 0: case 1:\nbreak;", "case 2: case 3:\nimm <<= 8;", "break;", "case 4: case 5:\nimm <<= 16;", "break;", "case 6: case 7:\nimm <<= 24;", "break;", "case 8: case 9:\nimm |= imm << 16;", "break;", "case 10: case 11:\nimm = (imm << 8) | (imm << 24);", "break;", "case 12:\nimm = (imm << 8) | 0xff;", "break;", "case 13:\nimm = (imm << 16) | 0xffff;", "break;", "case 14:\nimm |= (imm << 8) | (imm << 16) | (imm << 24);", "if (VAR_16)\nimm = ~imm;", "break;", "case 15:\nif (VAR_16) {", "return 1;", "}", "imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)\n| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));", "break;", "}", "if (VAR_16)\nimm = ~imm;", "for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {", "if (VAR_3 & 1 && VAR_3 < 12) {", "tmp = neon_load_reg(VAR_5, VAR_10);", "if (VAR_16) {", "tcg_gen_andi_i32(tmp, tmp, imm);", "} else {", "tcg_gen_ori_i32(tmp, tmp, imm);", "}", "} else {", "tmp = tcg_temp_new_i32();", "if (VAR_3 == 14 && VAR_16) {", "int VAR_23;", "uint32_t val;", "val = 0;", "for (VAR_23 = 0; VAR_23 < 4; VAR_23++) {", "if (imm & (1 << (VAR_23 + (VAR_10 & 1) * 4)))\nval |= 0xff << (VAR_23 * 8);", "}", "tcg_gen_movi_i32(tmp, val);", "} else {", "tcg_gen_movi_i32(tmp, imm);", "}", "}", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "}", "} else {", "if (VAR_8 != 3) {", "VAR_3 = (VAR_2 >> 8) & 0xf;", "if ((VAR_2 & (1 << 6)) == 0) {", "int VAR_18;", "int VAR_19;", "int VAR_20;", "int VAR_21;", "static const int VAR_22[16][4] = {", "{1, 0, 0, 0},", "{1, 1, 0, 0},", "{1, 0, 0, 0},", "{1, 1, 0, 0},", "{0, 1, 1, 0},", "{0, 0, 0, 0},", "{0, 1, 1, 0},", "{0, 0, 0, 0},", "{0, 0, 0, 0},", "{0, 0, 0, 6},", "{0, 0, 0, 0},", "{0, 0, 0, 6},", "{0, 0, 0, 0},", "{0, 0, 0, 2},", "{0, 0, 0, 5},", "{0, 0, 0, 3},", "};", "VAR_20 = VAR_22[VAR_3][0];", "VAR_18 = VAR_22[VAR_3][1];", "VAR_19 = VAR_22[VAR_3][2];", "VAR_21 = VAR_22[VAR_3][3];", "if (((VAR_21 & 1) && (VAR_8 != 0)) ||\n((VAR_21 & 2) && (VAR_8 == 0)) ||\n((VAR_21 & 4) && VAR_13)) {", "return 1;", "}", "if ((VAR_18 && (VAR_6 & 1)) ||\n(VAR_19 && (VAR_7 & 1)) ||\n(!VAR_19 && (VAR_5 & 1))) {", "return 1;", "}", "if (VAR_5 == VAR_7 && !VAR_19) {", "tmp = neon_load_reg(VAR_7, 1);", "neon_store_scratch(2, tmp);", "} else if (VAR_5 == VAR_6 && !VAR_18) {", "tmp = neon_load_reg(VAR_6, 1);", "neon_store_scratch(2, tmp);", "}", "TCGV_UNUSED(tmp3);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "if (VAR_18) {", "neon_load_reg64(cpu_V0, VAR_6 + VAR_10);", "TCGV_UNUSED(tmp);", "} else {", "if (VAR_10 == 1 && VAR_5 == VAR_6) {", "tmp = neon_load_scratch(2);", "} else {", "tmp = neon_load_reg(VAR_6, VAR_10);", "}", "if (VAR_20) {", "gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_13);", "}", "}", "if (VAR_19) {", "neon_load_reg64(cpu_V1, VAR_7 + VAR_10);", "TCGV_UNUSED(tmp2);", "} else {", "if (VAR_10 == 1 && VAR_5 == VAR_7) {", "tmp2 = neon_load_scratch(2);", "} else {", "tmp2 = neon_load_reg(VAR_7, VAR_10);", "}", "if (VAR_20) {", "gen_neon_widen(cpu_V1, tmp2, VAR_8, VAR_13);", "}", "}", "switch (VAR_3) {", "case 0: case 1: case 4:\ngen_neon_addl(VAR_8);", "break;", "case 2: case 3: case 6:\ngen_neon_subl(VAR_8);", "break;", "case 5: case 7:\nswitch ((VAR_8 << 1) | VAR_13) {", "case 0:\ngen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);", "break;", "case 1:\ngen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);", "break;", "case 2:\ngen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);", "break;", "case 3:\ngen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);", "break;", "case 4:\ngen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);", "break;", "case 5:\ngen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);", "break;", "default: abort();", "}", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp);", "break;", "case 8: case 9: case 10: case 11: case 12: case 13:\ngen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13);", "break;", "case 14:\ngen_helper_neon_mull_p8(cpu_V0, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp);", "break;", "default:\nabort();", "}", "if (VAR_3 == 13) {", "gen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "} else if (VAR_3 == 5 || (VAR_3 >= 8 && VAR_3 <= 11)) {", "neon_load_reg64(cpu_V1, VAR_5 + VAR_10);", "switch (VAR_3) {", "case 10:\ngen_neon_negl(cpu_V0, VAR_8);", "case 5: case 8:\ngen_neon_addl(VAR_8);", "break;", "case 9: case 11:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);", "if (VAR_3 == 11) {", "gen_neon_negl(cpu_V0, VAR_8);", "}", "gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8);", "break;", "default:\nabort();", "}", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "} else if (VAR_3 == 4 || VAR_3 == 6) {", "tmp = tcg_temp_new_i32();", "if (!VAR_13) {", "switch (VAR_8) {", "case 0:\ngen_helper_neon_narrow_high_u8(tmp, cpu_V0);", "break;", "case 1:\ngen_helper_neon_narrow_high_u16(tmp, cpu_V0);", "break;", "case 2:\ntcg_gen_shri_i64(cpu_V0, cpu_V0, 32);", "tcg_gen_trunc_i64_i32(tmp, cpu_V0);", "break;", "default: abort();", "}", "} else {", "switch (VAR_8) {", "case 0:\ngen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);", "break;", "case 1:\ngen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);", "break;", "case 2:\ntcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);", "tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);", "tcg_gen_trunc_i64_i32(tmp, cpu_V0);", "break;", "default: abort();", "}", "}", "if (VAR_10 == 0) {", "tmp3 = tmp;", "} else {", "neon_store_reg(VAR_5, 0, tmp3);", "neon_store_reg(VAR_5, 1, tmp);", "}", "} else {", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "}", "}", "} else {", "if (VAR_8 == 0) {", "return 1;", "}", "switch (VAR_3) {", "case 1:\ncase 5:\ncase 9:\nif (VAR_8 == 1) {", "return 1;", "}", "case 0:\ncase 4:\ncase 8:\ncase 12:\ncase 13:\nif (VAR_13 && ((VAR_5 | VAR_6) & 1)) {", "return 1;", "}", "tmp = neon_get_scalar(VAR_8, VAR_7);", "neon_store_scratch(0, tmp);", "for (VAR_10 = 0; VAR_10 < (VAR_13 ? 4 : 2); VAR_10++) {", "tmp = neon_load_scratch(0);", "tmp2 = neon_load_reg(VAR_6, VAR_10);", "if (VAR_3 == 12) {", "if (VAR_8 == 1) {", "gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2);", "} else {", "gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2);", "}", "} else if (VAR_3 == 13) {", "if (VAR_8 == 1) {", "gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2);", "} else {", "gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2);", "}", "} else if (VAR_3 & 1) {", "gen_helper_neon_mul_f32(tmp, tmp, tmp2);", "} else {", "switch (VAR_8) {", "case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;", "case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;", "default: abort();", "}", "}", "tcg_temp_free_i32(tmp2);", "if (VAR_3 < 8) {", "tmp2 = neon_load_reg(VAR_5, VAR_10);", "switch (VAR_3) {", "case 0:\ngen_neon_add(VAR_8, tmp, tmp2);", "break;", "case 1:\ngen_helper_neon_add_f32(tmp, tmp, tmp2);", "break;", "case 4:\ngen_neon_rsb(VAR_8, tmp, tmp2);", "break;", "case 5:\ngen_helper_neon_sub_f32(tmp, tmp2, tmp);", "break;", "default:\nabort();", "}", "tcg_temp_free_i32(tmp2);", "}", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "break;", "case 3:\ncase 7:\ncase 11:\nif (VAR_13 == 1) {", "return 1;", "}", "case 2:\ncase 6:\ncase 10:\nif (VAR_5 & 1) {", "return 1;", "}", "tmp2 = neon_get_scalar(VAR_8, VAR_7);", "tmp4 = tcg_temp_new_i32();", "tcg_gen_mov_i32(tmp4, tmp2);", "tmp3 = neon_load_reg(VAR_6, 1);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "if (VAR_10 == 0) {", "tmp = neon_load_reg(VAR_6, 0);", "} else {", "tmp = tmp3;", "tmp2 = tmp4;", "}", "gen_neon_mull(cpu_V0, tmp, tmp2, VAR_8, VAR_13);", "if (VAR_3 != 11) {", "neon_load_reg64(cpu_V1, VAR_5 + VAR_10);", "}", "switch (VAR_3) {", "case 6:\ngen_neon_negl(cpu_V0, VAR_8);", "case 2:\ngen_neon_addl(VAR_8);", "break;", "case 3: case 7:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);", "if (VAR_3 == 7) {", "gen_neon_negl(cpu_V0, VAR_8);", "}", "gen_neon_addl_saturate(cpu_V0, cpu_V1, VAR_8);", "break;", "case 10:\nbreak;", "case 11:\ngen_neon_addl_saturate(cpu_V0, cpu_V0, VAR_8);", "break;", "default:\nabort();", "}", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "}", "break;", "default:\nreturn 1;", "}", "}", "} else {", "if (!VAR_13) {", "imm = (VAR_2 >> 8) & 0xf;", "if (imm > 7 && !VAR_4)\nreturn 1;", "if (VAR_4 && ((VAR_5 | VAR_6 | VAR_7) & 1)) {", "return 1;", "}", "if (imm == 0) {", "neon_load_reg64(cpu_V0, VAR_6);", "if (VAR_4) {", "neon_load_reg64(cpu_V1, VAR_6 + 1);", "}", "} else if (imm == 8) {", "neon_load_reg64(cpu_V0, VAR_6 + 1);", "if (VAR_4) {", "neon_load_reg64(cpu_V1, VAR_7);", "}", "} else if (VAR_4) {", "tmp64 = tcg_temp_new_i64();", "if (imm < 8) {", "neon_load_reg64(cpu_V0, VAR_6);", "neon_load_reg64(tmp64, VAR_6 + 1);", "} else {", "neon_load_reg64(cpu_V0, VAR_6 + 1);", "neon_load_reg64(tmp64, VAR_7);", "}", "tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);", "tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));", "tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);", "if (imm < 8) {", "neon_load_reg64(cpu_V1, VAR_7);", "} else {", "neon_load_reg64(cpu_V1, VAR_7 + 1);", "imm -= 8;", "}", "tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));", "tcg_gen_shri_i64(tmp64, tmp64, imm * 8);", "tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);", "tcg_temp_free_i64(tmp64);", "} else {", "neon_load_reg64(cpu_V0, VAR_6);", "tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);", "neon_load_reg64(cpu_V1, VAR_7);", "tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));", "tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);", "}", "neon_store_reg64(cpu_V0, VAR_5);", "if (VAR_4) {", "neon_store_reg64(cpu_V1, VAR_5 + 1);", "}", "} else if ((VAR_2 & (1 << 11)) == 0) {", "VAR_3 = ((VAR_2 >> 12) & 0x30) | ((VAR_2 >> 7) & 0xf);", "VAR_8 = (VAR_2 >> 18) & 3;", "if ((neon_2rm_sizes[VAR_3] & (1 << VAR_8)) == 0) {", "return 1;", "}", "switch (VAR_3) {", "case NEON_2RM_VREV64:\nfor (VAR_10 = 0; VAR_10 < (VAR_4 ? 2 : 1); VAR_10++) {", "tmp = neon_load_reg(VAR_7, VAR_10 * 2);", "tmp2 = neon_load_reg(VAR_7, VAR_10 * 2 + 1);", "switch (VAR_8) {", "case 0: tcg_gen_bswap32_i32(tmp, tmp); break;", "case 1: gen_swap_half(tmp); break;", "case 2: break;", "default: abort();", "}", "neon_store_reg(VAR_5, VAR_10 * 2 + 1, tmp);", "if (VAR_8 == 2) {", "neon_store_reg(VAR_5, VAR_10 * 2, tmp2);", "} else {", "switch (VAR_8) {", "case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;", "case 1: gen_swap_half(tmp2); break;", "default: abort();", "}", "neon_store_reg(VAR_5, VAR_10 * 2, tmp2);", "}", "}", "break;", "case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U:\ncase NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U:\nfor (VAR_10 = 0; VAR_10 < VAR_4 + 1; VAR_10++) {", "tmp = neon_load_reg(VAR_7, VAR_10 * 2);", "gen_neon_widen(cpu_V0, tmp, VAR_8, VAR_3 & 1);", "tmp = neon_load_reg(VAR_7, VAR_10 * 2 + 1);", "gen_neon_widen(cpu_V1, tmp, VAR_8, VAR_3 & 1);", "switch (VAR_8) {", "case 0: gen_helper_neon_paddl_u16(CPU_V001); break;", "case 1: gen_helper_neon_paddl_u32(CPU_V001); break;", "case 2: tcg_gen_add_i64(CPU_V001); break;", "default: abort();", "}", "if (VAR_3 >= NEON_2RM_VPADAL) {", "neon_load_reg64(cpu_V1, VAR_5 + VAR_10);", "gen_neon_addl(VAR_8);", "}", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "}", "break;", "case NEON_2RM_VTRN:\nif (VAR_8 == 2) {", "int VAR_23;", "for (VAR_23 = 0; VAR_23 < (VAR_4 ? 4 : 2); VAR_23 += 2) {", "tmp = neon_load_reg(VAR_7, VAR_23);", "tmp2 = neon_load_reg(VAR_5, VAR_23 + 1);", "neon_store_reg(VAR_7, VAR_23, tmp2);", "neon_store_reg(VAR_5, VAR_23 + 1, tmp);", "}", "} else {", "goto elementwise;", "}", "break;", "case NEON_2RM_VUZP:\nif (gen_neon_unzip(VAR_5, VAR_7, VAR_8, VAR_4)) {", "return 1;", "}", "break;", "case NEON_2RM_VZIP:\nif (gen_neon_zip(VAR_5, VAR_7, VAR_8, VAR_4)) {", "return 1;", "}", "break;", "case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN:\nTCGV_UNUSED(tmp2);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "neon_load_reg64(cpu_V0, VAR_7 + VAR_10);", "tmp = tcg_temp_new_i32();", "gen_neon_narrow_op(VAR_3 == NEON_2RM_VMOVN, VAR_4, VAR_8,\ntmp, cpu_V0);", "if (VAR_10 == 0) {", "tmp2 = tmp;", "} else {", "neon_store_reg(VAR_5, 0, tmp2);", "neon_store_reg(VAR_5, 1, tmp);", "}", "}", "break;", "case NEON_2RM_VSHLL:\nif (VAR_4) {", "return 1;", "}", "tmp = neon_load_reg(VAR_7, 0);", "tmp2 = neon_load_reg(VAR_7, 1);", "for (VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "if (VAR_10 == 1)\ntmp = tmp2;", "gen_neon_widen(cpu_V0, tmp, VAR_8, 1);", "tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << VAR_8);", "neon_store_reg64(cpu_V0, VAR_5 + VAR_10);", "}", "break;", "case NEON_2RM_VCVT_F16_F32:\nif (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16))\nreturn 1;", "tmp = tcg_temp_new_i32();", "tmp2 = tcg_temp_new_i32();", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 0));", "gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 1));", "gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);", "tcg_gen_shli_i32(tmp2, tmp2, 16);", "tcg_gen_or_i32(tmp2, tmp2, tmp);", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 2));", "gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);", "tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_7, 3));", "neon_store_reg(VAR_5, 0, tmp2);", "tmp2 = tcg_temp_new_i32();", "gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);", "tcg_gen_shli_i32(tmp2, tmp2, 16);", "tcg_gen_or_i32(tmp2, tmp2, tmp);", "neon_store_reg(VAR_5, 1, tmp2);", "tcg_temp_free_i32(tmp);", "break;", "case NEON_2RM_VCVT_F32_F16:\nif (!arm_feature(VAR_0, ARM_FEATURE_VFP_FP16))\nreturn 1;", "tmp3 = tcg_temp_new_i32();", "tmp = neon_load_reg(VAR_7, 0);", "tmp2 = neon_load_reg(VAR_7, 1);", "tcg_gen_ext16u_i32(tmp3, tmp);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 0));", "tcg_gen_shri_i32(tmp3, tmp, 16);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 1));", "tcg_temp_free_i32(tmp);", "tcg_gen_ext16u_i32(tmp3, tmp2);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 2));", "tcg_gen_shri_i32(tmp3, tmp2, 16);", "gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);", "tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(VAR_5, 3));", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp3);", "break;", "default:\nelementwise:\nfor (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {", "if (neon_2rm_is_float_op(VAR_3)) {", "tcg_gen_ld_f32(cpu_F0s, cpu_env,\nneon_reg_offset(VAR_7, VAR_10));", "TCGV_UNUSED(tmp);", "} else {", "tmp = neon_load_reg(VAR_7, VAR_10);", "}", "switch (VAR_3) {", "case NEON_2RM_VREV32:\nswitch (VAR_8) {", "case 0: tcg_gen_bswap32_i32(tmp, tmp); break;", "case 1: gen_swap_half(tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VREV16:\ngen_rev16(tmp);", "break;", "case NEON_2RM_VCLS:\nswitch (VAR_8) {", "case 0: gen_helper_neon_cls_s8(tmp, tmp); break;", "case 1: gen_helper_neon_cls_s16(tmp, tmp); break;", "case 2: gen_helper_neon_cls_s32(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VCLZ:\nswitch (VAR_8) {", "case 0: gen_helper_neon_clz_u8(tmp, tmp); break;", "case 1: gen_helper_neon_clz_u16(tmp, tmp); break;", "case 2: gen_helper_clz(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VCNT:\ngen_helper_neon_cnt_u8(tmp, tmp);", "break;", "case NEON_2RM_VMVN:\ntcg_gen_not_i32(tmp, tmp);", "break;", "case NEON_2RM_VQABS:\nswitch (VAR_8) {", "case 0: gen_helper_neon_qabs_s8(tmp, tmp); break;", "case 1: gen_helper_neon_qabs_s16(tmp, tmp); break;", "case 2: gen_helper_neon_qabs_s32(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VQNEG:\nswitch (VAR_8) {", "case 0: gen_helper_neon_qneg_s8(tmp, tmp); break;", "case 1: gen_helper_neon_qneg_s16(tmp, tmp); break;", "case 2: gen_helper_neon_qneg_s32(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VCGT0: case NEON_2RM_VCLE0:\ntmp2 = tcg_const_i32(0);", "switch(VAR_8) {", "case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free(tmp2);", "if (VAR_3 == NEON_2RM_VCLE0) {", "tcg_gen_not_i32(tmp, tmp);", "}", "break;", "case NEON_2RM_VCGE0: case NEON_2RM_VCLT0:\ntmp2 = tcg_const_i32(0);", "switch(VAR_8) {", "case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free(tmp2);", "if (VAR_3 == NEON_2RM_VCLT0) {", "tcg_gen_not_i32(tmp, tmp);", "}", "break;", "case NEON_2RM_VCEQ0:\ntmp2 = tcg_const_i32(0);", "switch(VAR_8) {", "case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;", "case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;", "case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;", "default: abort();", "}", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VABS:\nswitch(VAR_8) {", "case 0: gen_helper_neon_abs_s8(tmp, tmp); break;", "case 1: gen_helper_neon_abs_s16(tmp, tmp); break;", "case 2: tcg_gen_abs_i32(tmp, tmp); break;", "default: abort();", "}", "break;", "case NEON_2RM_VNEG:\ntmp2 = tcg_const_i32(0);", "gen_neon_rsb(VAR_8, tmp, tmp2);", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VCGT0_F:\ntmp2 = tcg_const_i32(0);", "gen_helper_neon_cgt_f32(tmp, tmp, tmp2);", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VCGE0_F:\ntmp2 = tcg_const_i32(0);", "gen_helper_neon_cge_f32(tmp, tmp, tmp2);", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VCEQ0_F:\ntmp2 = tcg_const_i32(0);", "gen_helper_neon_ceq_f32(tmp, tmp, tmp2);", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VCLE0_F:\ntmp2 = tcg_const_i32(0);", "gen_helper_neon_cge_f32(tmp, tmp2, tmp);", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VCLT0_F:\ntmp2 = tcg_const_i32(0);", "gen_helper_neon_cgt_f32(tmp, tmp2, tmp);", "tcg_temp_free(tmp2);", "break;", "case NEON_2RM_VABS_F:\ngen_vfp_abs(0);", "break;", "case NEON_2RM_VNEG_F:\ngen_vfp_neg(0);", "break;", "case NEON_2RM_VSWP:\ntmp2 = neon_load_reg(VAR_5, VAR_10);", "neon_store_reg(VAR_7, VAR_10, tmp2);", "break;", "case NEON_2RM_VTRN:\ntmp2 = neon_load_reg(VAR_5, VAR_10);", "switch (VAR_8) {", "case 0: gen_neon_trn_u8(tmp, tmp2); break;", "case 1: gen_neon_trn_u16(tmp, tmp2); break;", "default: abort();", "}", "neon_store_reg(VAR_7, VAR_10, tmp2);", "break;", "case NEON_2RM_VRECPE:\ngen_helper_recpe_u32(tmp, tmp, cpu_env);", "break;", "case NEON_2RM_VRSQRTE:\ngen_helper_rsqrte_u32(tmp, tmp, cpu_env);", "break;", "case NEON_2RM_VRECPE_F:\ngen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env);", "break;", "case NEON_2RM_VRSQRTE_F:\ngen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env);", "break;", "case NEON_2RM_VCVT_FS:\ngen_vfp_sito(0);", "break;", "case NEON_2RM_VCVT_FU:\ngen_vfp_uito(0);", "break;", "case NEON_2RM_VCVT_SF:\ngen_vfp_tosiz(0);", "break;", "case NEON_2RM_VCVT_UF:\ngen_vfp_touiz(0);", "break;", "default:\nabort();", "}", "if (neon_2rm_is_float_op(VAR_3)) {", "tcg_gen_st_f32(cpu_F0s, cpu_env,\nneon_reg_offset(VAR_5, VAR_10));", "} else {", "neon_store_reg(VAR_5, VAR_10, tmp);", "}", "}", "break;", "}", "} else if ((VAR_2 & (1 << 10)) == 0) {", "int VAR_23 = ((VAR_2 >> 5) & 0x18) + 8;", "if (VAR_2 & (1 << 6)) {", "tmp = neon_load_reg(VAR_5, 0);", "} else {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "}", "tmp2 = neon_load_reg(VAR_7, 0);", "tmp4 = tcg_const_i32(VAR_6);", "tmp5 = tcg_const_i32(VAR_23);", "gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5);", "tcg_temp_free_i32(tmp);", "if (VAR_2 & (1 << 6)) {", "tmp = neon_load_reg(VAR_5, 1);", "} else {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "}", "tmp3 = neon_load_reg(VAR_7, 1);", "gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5);", "tcg_temp_free_i32(tmp5);", "tcg_temp_free_i32(tmp4);", "neon_store_reg(VAR_5, 0, tmp2);", "neon_store_reg(VAR_5, 1, tmp3);", "tcg_temp_free_i32(tmp);", "} else if ((VAR_2 & 0x380) == 0) {", "if (VAR_2 & (1 << 19)) {", "tmp = neon_load_reg(VAR_7, 1);", "} else {", "tmp = neon_load_reg(VAR_7, 0);", "}", "if (VAR_2 & (1 << 16)) {", "gen_neon_dup_u8(tmp, ((VAR_2 >> 17) & 3) * 8);", "} else if (VAR_2 & (1 << 17)) {", "if ((VAR_2 >> 18) & 1)\ngen_neon_dup_high16(tmp);", "else\ngen_neon_dup_low16(tmp);", "}", "for (VAR_10 = 0; VAR_10 < (VAR_4 ? 4 : 2); VAR_10++) {", "tmp2 = tcg_temp_new_i32();", "tcg_gen_mov_i32(tmp2, tmp);", "neon_store_reg(VAR_5, VAR_10, tmp2);", "}", "tcg_temp_free_i32(tmp);", "} else {", "return 1;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203, 205, 207, 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 235, 237, 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255, 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 307 ], [ 311 ], [ 313 ], [ 317 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357, 359 ], [ 361 ], [ 363, 365 ], [ 367 ], [ 369, 371 ], [ 373, 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385, 387 ], [ 389 ], [ 391, 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413, 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437, 439 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455, 457 ], [ 459 ], [ 461, 463 ], [ 465 ], [ 467, 469 ], [ 471 ], [ 473, 475 ], [ 477 ], [ 479, 481 ], [ 483 ], [ 485, 487 ], [ 489 ], [ 491, 493 ], [ 495 ], [ 497, 499 ], [ 501 ], [ 503, 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515, 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573, 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603, 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627, 629 ], [ 631 ], [ 633, 635 ], [ 637 ], [ 639, 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669, 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685, 687 ], [ 689, 691 ], [ 693 ], [ 695, 697 ], [ 699 ], [ 701, 703 ], [ 705 ], [ 707, 709 ], [ 711 ], [ 713, 715 ], [ 717 ], [ 719 ], [ 721, 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745, 747 ], [ 749 ], [ 751 ], [ 753, 755 ], [ 757, 759 ], [ 761 ], [ 763 ], [ 765, 767, 769 ], [ 771, 773 ], [ 775 ], [ 777, 779, 781 ], [ 783, 785 ], [ 787 ], [ 789, 791, 793 ], [ 795, 797 ], [ 799 ], [ 801, 803 ], [ 805 ], [ 807 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 829 ], [ 831 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 845 ], [ 847 ], [ 851 ], [ 853 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867 ], [ 869, 871 ], [ 873 ], [ 875 ], [ 881 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895 ], [ 897 ], [ 903, 905 ], [ 907 ], [ 909 ], [ 911 ], [ 913 ], [ 915 ], [ 917 ], [ 919, 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929, 931 ], [ 933 ], [ 935 ], [ 937, 939, 941 ], [ 943 ], [ 945, 947 ], [ 949 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 961 ], [ 963, 965, 967, 969 ], [ 971, 973 ], [ 975 ], [ 977, 979, 981, 983 ], [ 985, 987 ], [ 989 ], [ 991, 993, 995 ], [ 997 ], [ 999, 1001 ], [ 1003 ], [ 1005, 1007 ], [ 1009, 1011 ], [ 1013 ], [ 1015, 1017 ], [ 1019 ], [ 1021 ], [ 1023 ], [ 1025 ], [ 1029 ], [ 1031 ], [ 1033 ], [ 1037 ], [ 1039 ], [ 1041 ], [ 1043 ], [ 1045 ], [ 1047 ], [ 1049 ], [ 1051 ], [ 1053 ], [ 1055 ], [ 1057 ], [ 1059 ], [ 1061 ], [ 1063 ], [ 1065 ], [ 1067 ], [ 1071 ], [ 1073 ], [ 1075 ], [ 1077 ], [ 1079, 1081, 1083 ], [ 1085 ], [ 1087, 1089, 1091 ], [ 1093 ], [ 1095, 1097, 1099 ], [ 1101 ], [ 1103 ], [ 1105 ], [ 1107 ], [ 1109 ], [ 1111 ], [ 1113, 1115 ], [ 1117, 1119 ], [ 1121 ], [ 1123, 1125 ], [ 1127 ], [ 1129, 1131 ], [ 1133 ], [ 1135, 1137 ], [ 1139 ], [ 1141 ], [ 1143, 1145 ], [ 1147 ], [ 1149 ], [ 1151 ], [ 1155 ], [ 1159 ], [ 1161 ], [ 1163 ], [ 1165 ], [ 1169 ], [ 1171, 1173, 1175 ], [ 1177, 1179 ], [ 1181 ], [ 1183 ], [ 1185 ], [ 1187, 1189, 1191 ], [ 1193, 1195 ], [ 1197 ], [ 1199 ], [ 1201, 1203 ], [ 1205 ], [ 1207 ], [ 1209, 1211 ], [ 1213, 1215 ], [ 1217 ], [ 1219 ], [ 1221, 1223 ], [ 1225 ], [ 1227 ], [ 1229 ], [ 1231 ], [ 1233 ], [ 1235 ], [ 1237 ], [ 1239 ], [ 1241 ], [ 1243 ], [ 1245 ], [ 1251 ], [ 1253 ], [ 1255 ], [ 1257 ], [ 1259 ], [ 1261 ], [ 1263 ], [ 1265 ], [ 1267 ], [ 1269 ], [ 1271 ], [ 1273 ], [ 1275 ], [ 1277 ], [ 1279 ], [ 1281 ], [ 1283 ], [ 1285 ], [ 1287 ], [ 1289 ], [ 1291 ], [ 1293 ], [ 1295 ], [ 1297 ], [ 1299 ], [ 1301 ], [ 1303 ], [ 1305 ], [ 1307 ], [ 1309 ], [ 1311 ], [ 1313 ], [ 1315 ], [ 1317 ], [ 1319 ], [ 1321 ], [ 1323 ], [ 1325 ], [ 1327 ], [ 1329 ], [ 1333 ], [ 1335 ], [ 1337 ], [ 1339 ], [ 1341 ], [ 1343 ], [ 1345 ], [ 1347 ], [ 1349 ], [ 1351 ], [ 1353 ], [ 1355, 1357 ], [ 1359 ], [ 1361 ], [ 1363 ], [ 1365 ], [ 1367 ], [ 1369, 1371 ], [ 1373 ], [ 1375 ], [ 1377 ], [ 1379 ], [ 1381 ], [ 1383 ], [ 1385 ], [ 1387 ], [ 1389 ], [ 1391 ], [ 1395 ], [ 1397 ], [ 1399 ], [ 1401 ], [ 1403 ], [ 1405 ], [ 1407, 1409 ], [ 1413 ], [ 1417 ], [ 1423 ], [ 1435 ], [ 1437 ], [ 1439 ], [ 1441 ], [ 1443 ], [ 1445 ], [ 1447 ], [ 1449 ], [ 1453 ], [ 1455 ], [ 1457 ], [ 1459 ], [ 1461 ], [ 1463 ], [ 1465 ], [ 1467 ], [ 1469 ], [ 1471 ], [ 1473 ], [ 1475 ], [ 1477 ], [ 1481 ], [ 1483 ], [ 1485 ], [ 1493 ], [ 1495 ], [ 1497 ], [ 1499 ], [ 1501, 1503 ], [ 1505, 1507 ], [ 1509 ], [ 1511, 1513 ], [ 1515, 1517 ], [ 1519 ], [ 1521 ], [ 1523 ], [ 1525 ], [ 1527 ], [ 1529 ], [ 1531 ], [ 1533 ], [ 1535 ], [ 1537 ], [ 1539 ], [ 1543 ], [ 1547 ], [ 1549 ], [ 1559 ], [ 1561, 1565 ], [ 1567, 1569 ], [ 1571 ], [ 1573, 1575 ], [ 1577 ], [ 1579, 1581 ], [ 1583 ], [ 1585, 1587 ], [ 1589 ], [ 1591, 1593 ], [ 1595 ], [ 1597, 1599 ], [ 1601 ], [ 1603, 1605 ], [ 1607 ], [ 1609, 1611 ], [ 1613, 1615 ], [ 1617 ], [ 1619, 1621 ], [ 1623 ], [ 1625 ], [ 1627, 1629 ], [ 1631 ], [ 1633 ], [ 1635, 1637 ], [ 1641 ], [ 1643 ], [ 1645 ], [ 1647 ], [ 1653 ], [ 1655 ], [ 1657 ], [ 1659 ], [ 1661 ], [ 1665 ], [ 1667 ], [ 1669 ], [ 1671 ], [ 1673 ], [ 1675 ], [ 1677, 1679 ], [ 1681 ], [ 1683 ], [ 1685 ], [ 1687 ], [ 1689 ], [ 1691 ], [ 1693 ], [ 1695 ], [ 1697 ], [ 1699 ], [ 1701 ], [ 1703 ], [ 1705 ], [ 1709 ], [ 1711 ], [ 1713 ], [ 1725 ], [ 1729 ], [ 1731 ], [ 1733 ], [ 1735 ], [ 1737 ], [ 1739 ], [ 1741 ], [ 1743 ], [ 1745 ], [ 1747 ], [ 1749 ], [ 1751 ], [ 1753 ], [ 1755 ], [ 1757 ], [ 1759 ], [ 1761 ], [ 1763 ], [ 1767 ], [ 1769 ], [ 1771 ], [ 1773 ], [ 1777, 1779, 1781 ], [ 1783 ], [ 1785 ], [ 1787, 1789, 1791 ], [ 1793 ], [ 1795 ], [ 1805 ], [ 1807 ], [ 1809 ], [ 1811 ], [ 1813 ], [ 1815 ], [ 1817 ], [ 1819 ], [ 1821 ], [ 1823 ], [ 1825 ], [ 1827 ], [ 1829 ], [ 1831 ], [ 1833 ], [ 1835 ], [ 1837 ], [ 1839 ], [ 1841 ], [ 1843 ], [ 1845 ], [ 1847 ], [ 1849 ], [ 1851 ], [ 1853 ], [ 1855 ], [ 1857 ], [ 1859 ], [ 1861 ], [ 1863 ], [ 1865 ], [ 1867 ], [ 1869 ], [ 1871 ], [ 1873 ], [ 1875 ], [ 1877, 1879 ], [ 1881 ], [ 1883, 1885 ], [ 1887 ], [ 1889, 1891 ], [ 1893, 1895 ], [ 1897 ], [ 1899, 1901 ], [ 1903 ], [ 1905, 1907 ], [ 1909 ], [ 1911, 1913 ], [ 1915 ], [ 1917, 1919 ], [ 1921 ], [ 1923, 1925 ], [ 1927 ], [ 1929 ], [ 1931 ], [ 1933 ], [ 1935 ], [ 1937 ], [ 1939, 1943 ], [ 1945 ], [ 1947, 1949 ], [ 1951 ], [ 1953 ], [ 1955 ], [ 1957, 1959 ], [ 1961 ], [ 1963 ], [ 1967 ], [ 1969 ], [ 1971 ], [ 1975 ], [ 1977 ], [ 1979, 1981 ], [ 1985, 1987 ], [ 1989 ], [ 1991, 1993 ], [ 1995 ], [ 1997 ], [ 1999 ], [ 2001 ], [ 2003 ], [ 2005, 2007 ], [ 2009 ], [ 2011 ], [ 2013 ], [ 2017 ], [ 2019 ], [ 2021 ], [ 2023, 2025 ], [ 2027 ], [ 2029, 2031 ], [ 2033 ], [ 2035, 2037 ], [ 2039 ], [ 2041 ], [ 2043 ], [ 2045 ], [ 2047 ], [ 2049 ], [ 2051, 2053 ], [ 2055 ], [ 2057, 2059 ], [ 2061 ], [ 2063, 2065 ], [ 2067 ], [ 2069 ], [ 2071 ], [ 2073 ], [ 2075 ], [ 2077 ], [ 2079 ], [ 2081 ], [ 2083 ], [ 2085 ], [ 2087 ], [ 2089 ], [ 2091 ], [ 2095 ], [ 2097 ], [ 2099 ], [ 2101 ], [ 2111 ], [ 2113 ], [ 2115 ], [ 2117 ], [ 2119, 2121, 2123, 2125 ], [ 2127 ], [ 2129 ], [ 2133, 2135, 2137, 2139, 2141, 2143 ], [ 2145 ], [ 2147 ], [ 2149 ], [ 2151 ], [ 2153 ], [ 2155 ], [ 2157 ], [ 2159 ], [ 2161 ], [ 2163 ], [ 2165 ], [ 2167 ], [ 2169 ], [ 2171 ], [ 2173 ], [ 2175 ], [ 2177 ], [ 2179 ], [ 2181 ], [ 2183 ], [ 2185 ], [ 2187 ], [ 2189 ], [ 2191 ], [ 2193 ], [ 2195 ], [ 2197 ], [ 2199 ], [ 2201 ], [ 2203 ], [ 2205 ], [ 2209 ], [ 2211 ], [ 2213, 2215 ], [ 2217 ], [ 2219, 2221 ], [ 2223 ], [ 2225, 2227 ], [ 2229 ], [ 2231, 2233 ], [ 2235 ], [ 2237, 2239 ], [ 2241 ], [ 2243 ], [ 2245 ], [ 2247 ], [ 2249 ], [ 2251 ], [ 2253, 2255, 2257, 2259 ], [ 2261 ], [ 2263 ], [ 2267, 2269, 2271, 2273 ], [ 2275 ], [ 2277 ], [ 2279 ], [ 2285 ], [ 2287 ], [ 2289 ], [ 2293 ], [ 2295 ], [ 2297 ], [ 2299 ], [ 2301 ], [ 2303 ], [ 2305 ], [ 2307 ], [ 2309 ], [ 2311 ], [ 2313 ], [ 2315 ], [ 2317, 2319 ], [ 2323, 2325 ], [ 2327 ], [ 2329, 2331 ], [ 2333 ], [ 2335 ], [ 2337 ], [ 2339 ], [ 2341 ], [ 2343, 2347 ], [ 2349, 2351 ], [ 2353 ], [ 2355, 2357 ], [ 2359 ], [ 2361 ], [ 2363 ], [ 2369 ], [ 2371, 2373 ], [ 2375 ], [ 2377 ], [ 2379 ], [ 2381 ], [ 2385 ], [ 2389, 2391 ], [ 2395 ], [ 2397 ], [ 2399 ], [ 2403 ], [ 2405 ], [ 2407 ], [ 2409 ], [ 2411 ], [ 2413 ], [ 2415 ], [ 2417 ], [ 2419 ], [ 2421 ], [ 2423 ], [ 2425 ], [ 2427 ], [ 2429 ], [ 2431 ], [ 2433 ], [ 2435 ], [ 2437 ], [ 2439 ], [ 2441 ], [ 2443 ], [ 2445 ], [ 2447 ], [ 2449 ], [ 2451 ], [ 2453 ], [ 2455 ], [ 2457 ], [ 2459 ], [ 2461 ], [ 2463 ], [ 2465 ], [ 2467 ], [ 2471 ], [ 2473 ], [ 2475 ], [ 2477 ], [ 2479 ], [ 2481 ], [ 2483 ], [ 2485 ], [ 2487 ], [ 2489 ], [ 2491 ], [ 2495 ], [ 2497 ], [ 2501 ], [ 2503 ], [ 2505 ], [ 2507 ], [ 2509, 2511 ], [ 2513 ], [ 2515 ], [ 2517 ], [ 2519 ], [ 2521 ], [ 2523 ], [ 2525 ], [ 2527 ], [ 2529 ], [ 2531 ], [ 2533 ], [ 2535 ], [ 2537 ], [ 2539 ], [ 2541 ], [ 2543 ], [ 2545 ], [ 2547 ], [ 2549 ], [ 2551 ], [ 2553 ], [ 2555, 2557, 2559 ], [ 2561 ], [ 2563 ], [ 2565 ], [ 2567 ], [ 2569 ], [ 2571 ], [ 2573 ], [ 2575 ], [ 2577 ], [ 2579 ], [ 2581 ], [ 2585 ], [ 2587 ], [ 2589 ], [ 2591 ], [ 2593 ], [ 2595 ], [ 2597, 2599 ], [ 2601 ], [ 2603 ], [ 2605 ], [ 2607 ], [ 2609 ], [ 2611 ], [ 2613 ], [ 2615 ], [ 2617 ], [ 2619 ], [ 2621 ], [ 2623, 2625 ], [ 2627 ], [ 2629 ], [ 2631 ], [ 2633, 2635 ], [ 2637 ], [ 2639 ], [ 2641 ], [ 2643, 2647 ], [ 2649 ], [ 2651 ], [ 2653 ], [ 2655, 2657 ], [ 2659 ], [ 2661 ], [ 2663 ], [ 2665 ], [ 2667 ], [ 2669 ], [ 2671 ], [ 2673 ], [ 2675, 2677 ], [ 2679 ], [ 2681 ], [ 2683 ], [ 2685 ], [ 2687 ], [ 2689, 2691 ], [ 2693 ], [ 2695 ], [ 2697 ], [ 2699 ], [ 2701 ], [ 2703, 2705, 2707 ], [ 2709 ], [ 2711 ], [ 2713 ], [ 2715 ], [ 2717 ], [ 2719 ], [ 2721 ], [ 2723 ], [ 2725 ], [ 2727 ], [ 2729 ], [ 2731 ], [ 2733 ], [ 2735 ], [ 2737 ], [ 2739 ], [ 2741 ], [ 2743 ], [ 2745 ], [ 2747, 2749, 2751 ], [ 2753 ], [ 2755 ], [ 2757 ], [ 2759 ], [ 2761 ], [ 2763 ], [ 2765 ], [ 2767 ], [ 2769 ], [ 2771 ], [ 2773 ], [ 2775 ], [ 2777 ], [ 2779 ], [ 2781 ], [ 2783 ], [ 2785 ], [ 2787 ], [ 2789 ], [ 2791, 2793, 2795 ], [ 2797 ], [ 2799, 2801 ], [ 2803 ], [ 2805 ], [ 2807 ], [ 2809 ], [ 2811 ], [ 2813, 2815 ], [ 2817 ], [ 2819 ], [ 2821 ], [ 2823 ], [ 2825 ], [ 2827, 2829 ], [ 2831 ], [ 2833, 2835 ], [ 2837 ], [ 2839 ], [ 2841 ], [ 2843 ], [ 2845 ], [ 2847 ], [ 2849, 2851 ], [ 2853 ], [ 2855 ], [ 2857 ], [ 2859 ], [ 2861 ], [ 2863 ], [ 2865, 2867 ], [ 2869 ], [ 2871, 2873 ], [ 2875 ], [ 2877, 2879 ], [ 2881 ], [ 2883 ], [ 2885 ], [ 2887 ], [ 2889 ], [ 2891 ], [ 2893, 2895 ], [ 2897 ], [ 2899 ], [ 2901 ], [ 2903 ], [ 2905 ], [ 2907 ], [ 2909, 2911 ], [ 2913 ], [ 2915 ], [ 2917 ], [ 2919 ], [ 2921 ], [ 2923 ], [ 2925 ], [ 2927 ], [ 2929 ], [ 2931 ], [ 2933 ], [ 2935, 2937 ], [ 2939 ], [ 2941 ], [ 2943 ], [ 2945 ], [ 2947 ], [ 2949 ], [ 2951 ], [ 2953 ], [ 2955 ], [ 2957 ], [ 2959 ], [ 2961, 2963 ], [ 2965 ], [ 2967 ], [ 2969 ], [ 2971 ], [ 2973 ], [ 2975 ], [ 2977 ], [ 2979 ], [ 2981, 2983 ], [ 2985 ], [ 2987 ], [ 2989 ], [ 2991 ], [ 2993 ], [ 2995 ], [ 2997, 2999 ], [ 3001 ], [ 3003 ], [ 3005 ], [ 3007, 3009 ], [ 3011 ], [ 3013 ], [ 3015 ], [ 3017, 3019 ], [ 3021 ], [ 3023 ], [ 3025 ], [ 3027, 3029 ], [ 3031 ], [ 3033 ], [ 3035 ], [ 3037, 3039 ], [ 3041 ], [ 3043 ], [ 3045 ], [ 3047, 3049 ], [ 3051 ], [ 3053 ], [ 3055 ], [ 3057, 3059 ], [ 3061 ], [ 3063, 3065 ], [ 3067 ], [ 3069, 3071 ], [ 3073 ], [ 3075 ], [ 3077, 3079 ], [ 3081 ], [ 3083 ], [ 3085 ], [ 3087 ], [ 3089 ], [ 3091 ], [ 3093 ], [ 3095, 3097 ], [ 3099 ], [ 3101, 3103 ], [ 3105 ], [ 3107, 3109 ], [ 3111 ], [ 3113, 3115 ], [ 3117 ], [ 3119, 3121 ], [ 3123 ], [ 3125, 3127 ], [ 3129 ], [ 3131, 3133 ], [ 3135 ], [ 3137, 3139 ], [ 3141 ], [ 3143, 3151 ], [ 3153 ], [ 3155 ], [ 3157, 3159 ], [ 3161 ], [ 3163 ], [ 3165 ], [ 3167 ], [ 3169 ], [ 3171 ], [ 3173 ], [ 3177 ], [ 3179 ], [ 3181 ], [ 3183 ], [ 3185 ], [ 3187 ], [ 3189 ], [ 3191 ], [ 3193 ], [ 3195 ], [ 3197 ], [ 3199 ], [ 3201 ], [ 3203 ], [ 3205 ], [ 3207 ], [ 3209 ], [ 3211 ], [ 3213 ], [ 3215 ], [ 3217 ], [ 3219 ], [ 3221 ], [ 3223 ], [ 3225 ], [ 3227 ], [ 3231 ], [ 3233 ], [ 3235 ], [ 3237 ], [ 3239 ], [ 3241 ], [ 3243 ], [ 3245 ], [ 3247, 3249 ], [ 3251, 3253 ], [ 3255 ], [ 3257 ], [ 3259 ], [ 3261 ], [ 3263 ], [ 3265 ], [ 3267 ], [ 3269 ], [ 3271 ], [ 3273 ], [ 3275 ], [ 3277 ], [ 3279 ], [ 3281 ] ]
3,307
static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRNVRAM *nvram = spapr->nvram; hwaddr offset, buffer, len; int alen; void *membuf; if ((nargs != 3) || (nret != 2)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } if (!nvram) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } offset = rtas_ld(args, 0); buffer = rtas_ld(args, 1); len = rtas_ld(args, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } membuf = cpu_physical_memory_map(buffer, &len, 0); if (nvram->drive) { alen = bdrv_pwrite(nvram->drive, offset, membuf, len); } else { assert(nvram->buf); memcpy(nvram->buf + offset, membuf, len); alen = len; } cpu_physical_memory_unmap(membuf, len, 0, len); rtas_st(rets, 0, (alen < len) ? RTAS_OUT_HW_ERROR : RTAS_OUT_SUCCESS); rtas_st(rets, 1, (alen < 0) ? 0 : alen); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void rtas_nvram_store(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRNVRAM *nvram = spapr->nvram; hwaddr offset, buffer, len; int alen; void *membuf; if ((nargs != 3) || (nret != 2)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } if (!nvram) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } offset = rtas_ld(args, 0); buffer = rtas_ld(args, 1); len = rtas_ld(args, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } membuf = cpu_physical_memory_map(buffer, &len, 0); if (nvram->drive) { alen = bdrv_pwrite(nvram->drive, offset, membuf, len); } else { assert(nvram->buf); memcpy(nvram->buf + offset, membuf, len); alen = len; } cpu_physical_memory_unmap(membuf, len, 0, len); rtas_st(rets, 0, (alen < len) ? RTAS_OUT_HW_ERROR : RTAS_OUT_SUCCESS); rtas_st(rets, 1, (alen < 0) ? 0 : alen); }
{ "code": [], "line_no": [] }
static void FUNC_0(PowerPCCPU *VAR_0, sPAPREnvironment *VAR_1, uint32_t VAR_2, uint32_t VAR_3, target_ulong VAR_4, uint32_t VAR_5, target_ulong VAR_6) { sPAPRNVRAM *nvram = VAR_1->nvram; hwaddr offset, buffer, len; int VAR_7; void *VAR_8; if ((VAR_3 != 3) || (VAR_5 != 2)) { rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR); return; } if (!nvram) { rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR); return; } offset = rtas_ld(VAR_4, 0); buffer = rtas_ld(VAR_4, 1); len = rtas_ld(VAR_4, 2); if (((offset + len) < offset) || ((offset + len) > nvram->size)) { rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR); return; } VAR_8 = cpu_physical_memory_map(buffer, &len, 0); if (nvram->drive) { VAR_7 = bdrv_pwrite(nvram->drive, offset, VAR_8, len); } else { assert(nvram->buf); memcpy(nvram->buf + offset, VAR_8, len); VAR_7 = len; } cpu_physical_memory_unmap(VAR_8, len, 0, len); rtas_st(VAR_6, 0, (VAR_7 < len) ? RTAS_OUT_HW_ERROR : RTAS_OUT_SUCCESS); rtas_st(VAR_6, 1, (VAR_7 < 0) ? 0 : VAR_7); }
[ "static void FUNC_0(PowerPCCPU *VAR_0, sPAPREnvironment *VAR_1,\nuint32_t VAR_2, uint32_t VAR_3,\ntarget_ulong VAR_4,\nuint32_t VAR_5, target_ulong VAR_6)\n{", "sPAPRNVRAM *nvram = VAR_1->nvram;", "hwaddr offset, buffer, len;", "int VAR_7;", "void *VAR_8;", "if ((VAR_3 != 3) || (VAR_5 != 2)) {", "rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);", "return;", "}", "if (!nvram) {", "rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR);", "return;", "}", "offset = rtas_ld(VAR_4, 0);", "buffer = rtas_ld(VAR_4, 1);", "len = rtas_ld(VAR_4, 2);", "if (((offset + len) < offset)\n|| ((offset + len) > nvram->size)) {", "rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);", "return;", "}", "VAR_8 = cpu_physical_memory_map(buffer, &len, 0);", "if (nvram->drive) {", "VAR_7 = bdrv_pwrite(nvram->drive, offset, VAR_8, len);", "} else {", "assert(nvram->buf);", "memcpy(nvram->buf + offset, VAR_8, len);", "VAR_7 = len;", "}", "cpu_physical_memory_unmap(VAR_8, len, 0, len);", "rtas_st(VAR_6, 0, (VAR_7 < len) ? RTAS_OUT_HW_ERROR : RTAS_OUT_SUCCESS);", "rtas_st(VAR_6, 1, (VAR_7 < 0) ? 0 : VAR_7);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ] ]
3,308
int coroutine_fn qed_find_cluster(BDRVQEDState *s, QEDRequest *request, uint64_t pos, size_t *len, uint64_t *img_offset) { uint64_t l2_offset; uint64_t offset = 0; unsigned int index; unsigned int n; int ret; /* Limit length to L2 boundary. Requests are broken up at the L2 boundary * so that a request acts on one L2 table at a time. */ *len = MIN(*len, (((pos >> s->l1_shift) + 1) << s->l1_shift) - pos); l2_offset = s->l1_table->offsets[qed_l1_index(s, pos)]; if (qed_offset_is_unalloc_cluster(l2_offset)) { *img_offset = 0; return QED_CLUSTER_L1; } if (!qed_check_table_offset(s, l2_offset)) { *img_offset = *len = 0; return -EINVAL; } ret = qed_read_l2_table(s, request, l2_offset); qed_acquire(s); if (ret) { goto out; } index = qed_l2_index(s, pos); n = qed_bytes_to_clusters(s, qed_offset_into_cluster(s, pos) + *len); n = qed_count_contiguous_clusters(s, request->l2_table->table, index, n, &offset); if (qed_offset_is_unalloc_cluster(offset)) { ret = QED_CLUSTER_L2; } else if (qed_offset_is_zero_cluster(offset)) { ret = QED_CLUSTER_ZERO; } else if (qed_check_cluster_offset(s, offset)) { ret = QED_CLUSTER_FOUND; } else { ret = -EINVAL; } *len = MIN(*len, n * s->header.cluster_size - qed_offset_into_cluster(s, pos)); out: *img_offset = offset; qed_release(s); return ret; }
false
qemu
1f01e50b8330c24714ddca5841fdbb703076b121
int coroutine_fn qed_find_cluster(BDRVQEDState *s, QEDRequest *request, uint64_t pos, size_t *len, uint64_t *img_offset) { uint64_t l2_offset; uint64_t offset = 0; unsigned int index; unsigned int n; int ret; *len = MIN(*len, (((pos >> s->l1_shift) + 1) << s->l1_shift) - pos); l2_offset = s->l1_table->offsets[qed_l1_index(s, pos)]; if (qed_offset_is_unalloc_cluster(l2_offset)) { *img_offset = 0; return QED_CLUSTER_L1; } if (!qed_check_table_offset(s, l2_offset)) { *img_offset = *len = 0; return -EINVAL; } ret = qed_read_l2_table(s, request, l2_offset); qed_acquire(s); if (ret) { goto out; } index = qed_l2_index(s, pos); n = qed_bytes_to_clusters(s, qed_offset_into_cluster(s, pos) + *len); n = qed_count_contiguous_clusters(s, request->l2_table->table, index, n, &offset); if (qed_offset_is_unalloc_cluster(offset)) { ret = QED_CLUSTER_L2; } else if (qed_offset_is_zero_cluster(offset)) { ret = QED_CLUSTER_ZERO; } else if (qed_check_cluster_offset(s, offset)) { ret = QED_CLUSTER_FOUND; } else { ret = -EINVAL; } *len = MIN(*len, n * s->header.cluster_size - qed_offset_into_cluster(s, pos)); out: *img_offset = offset; qed_release(s); return ret; }
{ "code": [], "line_no": [] }
int VAR_0 qed_find_cluster(BDRVQEDState *s, QEDRequest *request, uint64_t pos, size_t *len, uint64_t *img_offset) { uint64_t l2_offset; uint64_t offset = 0; unsigned int index; unsigned int n; int ret; *len = MIN(*len, (((pos >> s->l1_shift) + 1) << s->l1_shift) - pos); l2_offset = s->l1_table->offsets[qed_l1_index(s, pos)]; if (qed_offset_is_unalloc_cluster(l2_offset)) { *img_offset = 0; return QED_CLUSTER_L1; } if (!qed_check_table_offset(s, l2_offset)) { *img_offset = *len = 0; return -EINVAL; } ret = qed_read_l2_table(s, request, l2_offset); qed_acquire(s); if (ret) { goto out; } index = qed_l2_index(s, pos); n = qed_bytes_to_clusters(s, qed_offset_into_cluster(s, pos) + *len); n = qed_count_contiguous_clusters(s, request->l2_table->table, index, n, &offset); if (qed_offset_is_unalloc_cluster(offset)) { ret = QED_CLUSTER_L2; } else if (qed_offset_is_zero_cluster(offset)) { ret = QED_CLUSTER_ZERO; } else if (qed_check_cluster_offset(s, offset)) { ret = QED_CLUSTER_FOUND; } else { ret = -EINVAL; } *len = MIN(*len, n * s->header.cluster_size - qed_offset_into_cluster(s, pos)); out: *img_offset = offset; qed_release(s); return ret; }
[ "int VAR_0 qed_find_cluster(BDRVQEDState *s, QEDRequest *request,\nuint64_t pos, size_t *len,\nuint64_t *img_offset)\n{", "uint64_t l2_offset;", "uint64_t offset = 0;", "unsigned int index;", "unsigned int n;", "int ret;", "*len = MIN(*len, (((pos >> s->l1_shift) + 1) << s->l1_shift) - pos);", "l2_offset = s->l1_table->offsets[qed_l1_index(s, pos)];", "if (qed_offset_is_unalloc_cluster(l2_offset)) {", "*img_offset = 0;", "return QED_CLUSTER_L1;", "}", "if (!qed_check_table_offset(s, l2_offset)) {", "*img_offset = *len = 0;", "return -EINVAL;", "}", "ret = qed_read_l2_table(s, request, l2_offset);", "qed_acquire(s);", "if (ret) {", "goto out;", "}", "index = qed_l2_index(s, pos);", "n = qed_bytes_to_clusters(s, qed_offset_into_cluster(s, pos) + *len);", "n = qed_count_contiguous_clusters(s, request->l2_table->table,\nindex, n, &offset);", "if (qed_offset_is_unalloc_cluster(offset)) {", "ret = QED_CLUSTER_L2;", "} else if (qed_offset_is_zero_cluster(offset)) {", "ret = QED_CLUSTER_ZERO;", "} else if (qed_check_cluster_offset(s, offset)) {", "ret = QED_CLUSTER_FOUND;", "} else {", "ret = -EINVAL;", "}", "*len = MIN(*len,\nn * s->header.cluster_size - qed_offset_into_cluster(s, pos));", "out:\n*img_offset = offset;", "qed_release(s);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ] ]
3,310
static int send_solid_rect(VncState *vs) { size_t bytes; vnc_write_u8(vs, VNC_TIGHT_FILL << 4); /* no flushing, no filter */ if (vs->tight_pixel24) { tight_pack24(vs, vs->tight.buffer, 1, &vs->tight.offset); bytes = 3; } else { bytes = vs->clientds.pf.bytes_per_pixel; } vnc_write(vs, vs->tight.buffer, bytes); return 1; }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
static int send_solid_rect(VncState *vs) { size_t bytes; vnc_write_u8(vs, VNC_TIGHT_FILL << 4); if (vs->tight_pixel24) { tight_pack24(vs, vs->tight.buffer, 1, &vs->tight.offset); bytes = 3; } else { bytes = vs->clientds.pf.bytes_per_pixel; } vnc_write(vs, vs->tight.buffer, bytes); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(VncState *VAR_0) { size_t bytes; vnc_write_u8(VAR_0, VNC_TIGHT_FILL << 4); if (VAR_0->tight_pixel24) { tight_pack24(VAR_0, VAR_0->tight.buffer, 1, &VAR_0->tight.offset); bytes = 3; } else { bytes = VAR_0->clientds.pf.bytes_per_pixel; } vnc_write(VAR_0, VAR_0->tight.buffer, bytes); return 1; }
[ "static int FUNC_0(VncState *VAR_0)\n{", "size_t bytes;", "vnc_write_u8(VAR_0, VNC_TIGHT_FILL << 4);", "if (VAR_0->tight_pixel24) {", "tight_pack24(VAR_0, VAR_0->tight.buffer, 1, &VAR_0->tight.offset);", "bytes = 3;", "} else {", "bytes = VAR_0->clientds.pf.bytes_per_pixel;", "}", "vnc_write(VAR_0, VAR_0->tight.buffer, bytes);", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ] ]
3,311
int DMA_read_memory (int nchan, void *buf, int pos, int len) { struct dma_regs *r = &dma_controllers[nchan > 3].regs[nchan & 3]; target_phys_addr_t addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR]; if (r->mode & 0x20) { int i; uint8_t *p = buf; cpu_physical_memory_read (addr - pos - len, buf, len); /* What about 16bit transfers? */ for (i = 0; i < len >> 1; i++) { uint8_t b = p[len - i - 1]; p[i] = b; } } else cpu_physical_memory_read (addr + pos, buf, len); return len; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
int DMA_read_memory (int nchan, void *buf, int pos, int len) { struct dma_regs *r = &dma_controllers[nchan > 3].regs[nchan & 3]; target_phys_addr_t addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR]; if (r->mode & 0x20) { int i; uint8_t *p = buf; cpu_physical_memory_read (addr - pos - len, buf, len); for (i = 0; i < len >> 1; i++) { uint8_t b = p[len - i - 1]; p[i] = b; } } else cpu_physical_memory_read (addr + pos, buf, len); return len; }
{ "code": [], "line_no": [] }
int FUNC_0 (int VAR_0, void *VAR_1, int VAR_2, int VAR_3) { struct dma_regs *VAR_4 = &dma_controllers[VAR_0 > 3].regs[VAR_0 & 3]; target_phys_addr_t addr = ((VAR_4->pageh & 0x7f) << 24) | (VAR_4->page << 16) | VAR_4->now[ADDR]; if (VAR_4->mode & 0x20) { int VAR_5; uint8_t *p = VAR_1; cpu_physical_memory_read (addr - VAR_2 - VAR_3, VAR_1, VAR_3); for (VAR_5 = 0; VAR_5 < VAR_3 >> 1; VAR_5++) { uint8_t b = p[VAR_3 - VAR_5 - 1]; p[VAR_5] = b; } } else cpu_physical_memory_read (addr + VAR_2, VAR_1, VAR_3); return VAR_3; }
[ "int FUNC_0 (int VAR_0, void *VAR_1, int VAR_2, int VAR_3)\n{", "struct dma_regs *VAR_4 = &dma_controllers[VAR_0 > 3].regs[VAR_0 & 3];", "target_phys_addr_t addr = ((VAR_4->pageh & 0x7f) << 24) | (VAR_4->page << 16) | VAR_4->now[ADDR];", "if (VAR_4->mode & 0x20) {", "int VAR_5;", "uint8_t *p = VAR_1;", "cpu_physical_memory_read (addr - VAR_2 - VAR_3, VAR_1, VAR_3);", "for (VAR_5 = 0; VAR_5 < VAR_3 >> 1; VAR_5++) {", "uint8_t b = p[VAR_3 - VAR_5 - 1];", "p[VAR_5] = b;", "}", "}", "else\ncpu_physical_memory_read (addr + VAR_2, VAR_1, VAR_3);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ] ]
3,313
static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, int iovcnt) { uint8_t buffer[4096]; size_t offset; offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer)); return nc->info->receive(nc, buffer, offset); }
false
qemu
d32fcad366e5f45d33dab2ee4de0e5729439680b
static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, int iovcnt) { uint8_t buffer[4096]; size_t offset; offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer)); return nc->info->receive(nc, buffer, offset); }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(NetClientState *nc, const struct iovec *iov, int iovcnt) { uint8_t buffer[4096]; size_t offset; offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer)); return nc->info->receive(nc, buffer, offset); }
[ "static ssize_t FUNC_0(NetClientState *nc, const struct iovec *iov,\nint iovcnt)\n{", "uint8_t buffer[4096];", "size_t offset;", "offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer));", "return nc->info->receive(nc, buffer, offset);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ] ]
3,314
static uint32_t gic_dist_readl(void *opaque, target_phys_addr_t offset) { uint32_t val; val = gic_dist_readw(opaque, offset); val |= gic_dist_readw(opaque, offset + 2) << 16; return val; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint32_t gic_dist_readl(void *opaque, target_phys_addr_t offset) { uint32_t val; val = gic_dist_readw(opaque, offset); val |= gic_dist_readw(opaque, offset + 2) << 16; return val; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset) { uint32_t val; val = gic_dist_readw(opaque, offset); val |= gic_dist_readw(opaque, offset + 2) << 16; return val; }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset)\n{", "uint32_t val;", "val = gic_dist_readw(opaque, offset);", "val |= gic_dist_readw(opaque, offset + 2) << 16;", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
3,315
static int ftp_flush_control_input(FTPContext *s) { char buf[CONTROL_BUFFER_SIZE]; int err, ori_block_flag = s->conn_control_block_flag; s->conn_control_block_flag = 1; do { err = ftp_get_line(s, buf, sizeof(buf)); } while (!err); s->conn_control_block_flag = ori_block_flag; if (err < 0 && err != AVERROR_EXIT) return err; return 0; }
false
FFmpeg
247e658784ead984f96021acb9c95052ba599f26
static int ftp_flush_control_input(FTPContext *s) { char buf[CONTROL_BUFFER_SIZE]; int err, ori_block_flag = s->conn_control_block_flag; s->conn_control_block_flag = 1; do { err = ftp_get_line(s, buf, sizeof(buf)); } while (!err); s->conn_control_block_flag = ori_block_flag; if (err < 0 && err != AVERROR_EXIT) return err; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FTPContext *VAR_0) { char VAR_1[CONTROL_BUFFER_SIZE]; int VAR_2, VAR_3 = VAR_0->conn_control_block_flag; VAR_0->conn_control_block_flag = 1; do { VAR_2 = ftp_get_line(VAR_0, VAR_1, sizeof(VAR_1)); } while (!VAR_2); VAR_0->conn_control_block_flag = VAR_3; if (VAR_2 < 0 && VAR_2 != AVERROR_EXIT) return VAR_2; return 0; }
[ "static int FUNC_0(FTPContext *VAR_0)\n{", "char VAR_1[CONTROL_BUFFER_SIZE];", "int VAR_2, VAR_3 = VAR_0->conn_control_block_flag;", "VAR_0->conn_control_block_flag = 1;", "do {", "VAR_2 = ftp_get_line(VAR_0, VAR_1, sizeof(VAR_1));", "} while (!VAR_2);", "VAR_0->conn_control_block_flag = VAR_3;", "if (VAR_2 < 0 && VAR_2 != AVERROR_EXIT)\nreturn VAR_2;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 33 ] ]
3,316
static void virtio_rng_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIORNG *vrng = VIRTIO_RNG(dev); Error *local_err = NULL; if (!vrng->conf.period_ms > 0) { error_setg(errp, "'period' parameter expects a positive integer"); return; } /* Workaround: Property parsing does not enforce unsigned integers, * So this is a hack to reject such numbers. */ if (vrng->conf.max_bytes > INT64_MAX) { error_setg(errp, "'max-bytes' parameter must be non-negative, " "and less than 2^63"); return; } if (vrng->conf.rng == NULL) { vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM)); user_creatable_complete(OBJECT(vrng->conf.default_backend), &local_err); if (local_err) { error_propagate(errp, local_err); object_unref(OBJECT(vrng->conf.default_backend)); return; } object_property_add_child(OBJECT(dev), "default-backend", OBJECT(vrng->conf.default_backend), NULL); /* The child property took a reference, we can safely drop ours now */ object_unref(OBJECT(vrng->conf.default_backend)); object_property_set_link(OBJECT(dev), OBJECT(vrng->conf.default_backend), "rng", NULL); } vrng->rng = vrng->conf.rng; if (vrng->rng == NULL) { error_setg(errp, "'rng' parameter expects a valid object"); return; } virtio_init(vdev, "virtio-rng", VIRTIO_ID_RNG, 0); vrng->vq = virtio_add_queue(vdev, 8, handle_input); vrng->quota_remaining = vrng->conf.max_bytes; vrng->rate_limit_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, check_rate_limit, vrng); timer_mod(vrng->rate_limit_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + vrng->conf.period_ms); register_savevm(dev, "virtio-rng", -1, 1, virtio_rng_save, virtio_rng_load, vrng); }
false
qemu
a3a292c420d2fec3c07a7ca56fbb064cd57a298a
static void virtio_rng_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIORNG *vrng = VIRTIO_RNG(dev); Error *local_err = NULL; if (!vrng->conf.period_ms > 0) { error_setg(errp, "'period' parameter expects a positive integer"); return; } if (vrng->conf.max_bytes > INT64_MAX) { error_setg(errp, "'max-bytes' parameter must be non-negative, " "and less than 2^63"); return; } if (vrng->conf.rng == NULL) { vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM)); user_creatable_complete(OBJECT(vrng->conf.default_backend), &local_err); if (local_err) { error_propagate(errp, local_err); object_unref(OBJECT(vrng->conf.default_backend)); return; } object_property_add_child(OBJECT(dev), "default-backend", OBJECT(vrng->conf.default_backend), NULL); object_unref(OBJECT(vrng->conf.default_backend)); object_property_set_link(OBJECT(dev), OBJECT(vrng->conf.default_backend), "rng", NULL); } vrng->rng = vrng->conf.rng; if (vrng->rng == NULL) { error_setg(errp, "'rng' parameter expects a valid object"); return; } virtio_init(vdev, "virtio-rng", VIRTIO_ID_RNG, 0); vrng->vq = virtio_add_queue(vdev, 8, handle_input); vrng->quota_remaining = vrng->conf.max_bytes; vrng->rate_limit_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, check_rate_limit, vrng); timer_mod(vrng->rate_limit_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + vrng->conf.period_ms); register_savevm(dev, "virtio-rng", -1, 1, virtio_rng_save, virtio_rng_load, vrng); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIORNG *vrng = VIRTIO_RNG(VAR_0); Error *local_err = NULL; if (!vrng->conf.period_ms > 0) { error_setg(VAR_1, "'period' parameter expects a positive integer"); return; } if (vrng->conf.max_bytes > INT64_MAX) { error_setg(VAR_1, "'max-bytes' parameter must be non-negative, " "and less than 2^63"); return; } if (vrng->conf.rng == NULL) { vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM)); user_creatable_complete(OBJECT(vrng->conf.default_backend), &local_err); if (local_err) { error_propagate(VAR_1, local_err); object_unref(OBJECT(vrng->conf.default_backend)); return; } object_property_add_child(OBJECT(VAR_0), "default-backend", OBJECT(vrng->conf.default_backend), NULL); object_unref(OBJECT(vrng->conf.default_backend)); object_property_set_link(OBJECT(VAR_0), OBJECT(vrng->conf.default_backend), "rng", NULL); } vrng->rng = vrng->conf.rng; if (vrng->rng == NULL) { error_setg(VAR_1, "'rng' parameter expects a valid object"); return; } virtio_init(vdev, "virtio-rng", VIRTIO_ID_RNG, 0); vrng->vq = virtio_add_queue(vdev, 8, handle_input); vrng->quota_remaining = vrng->conf.max_bytes; vrng->rate_limit_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, check_rate_limit, vrng); timer_mod(vrng->rate_limit_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + vrng->conf.period_ms); register_savevm(VAR_0, "virtio-rng", -1, 1, virtio_rng_save, virtio_rng_load, vrng); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VirtIORNG *vrng = VIRTIO_RNG(VAR_0);", "Error *local_err = NULL;", "if (!vrng->conf.period_ms > 0) {", "error_setg(VAR_1, \"'period' parameter expects a positive integer\");", "return;", "}", "if (vrng->conf.max_bytes > INT64_MAX) {", "error_setg(VAR_1, \"'max-bytes' parameter must be non-negative, \"\n\"and less than 2^63\");", "return;", "}", "if (vrng->conf.rng == NULL) {", "vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));", "user_creatable_complete(OBJECT(vrng->conf.default_backend),\n&local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "object_unref(OBJECT(vrng->conf.default_backend));", "return;", "}", "object_property_add_child(OBJECT(VAR_0),\n\"default-backend\",\nOBJECT(vrng->conf.default_backend),\nNULL);", "object_unref(OBJECT(vrng->conf.default_backend));", "object_property_set_link(OBJECT(VAR_0),\nOBJECT(vrng->conf.default_backend),\n\"rng\", NULL);", "}", "vrng->rng = vrng->conf.rng;", "if (vrng->rng == NULL) {", "error_setg(VAR_1, \"'rng' parameter expects a valid object\");", "return;", "}", "virtio_init(vdev, \"virtio-rng\", VIRTIO_ID_RNG, 0);", "vrng->vq = virtio_add_queue(vdev, 8, handle_input);", "vrng->quota_remaining = vrng->conf.max_bytes;", "vrng->rate_limit_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,\ncheck_rate_limit, vrng);", "timer_mod(vrng->rate_limit_timer,\nqemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + vrng->conf.period_ms);", "register_savevm(VAR_0, \"virtio-rng\", -1, 1, virtio_rng_save,\nvirtio_rng_load, vrng);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63, 65, 67 ], [ 73 ], [ 77, 79, 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 115, 117 ], [ 121, 123 ], [ 125 ] ]
3,317
void arm_sysctl_init(uint32_t base, uint32_t sys_id) { DeviceState *dev; dev = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(dev, "sys_id", sys_id); qdev_init_nofail(dev); sysbus_mmio_map(sysbus_from_qdev(dev), 0, base); }
false
qemu
26e92f65525ef4446a500d85e185cf78835922aa
void arm_sysctl_init(uint32_t base, uint32_t sys_id) { DeviceState *dev; dev = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(dev, "sys_id", sys_id); qdev_init_nofail(dev); sysbus_mmio_map(sysbus_from_qdev(dev), 0, base); }
{ "code": [], "line_no": [] }
void FUNC_0(uint32_t VAR_0, uint32_t VAR_1) { DeviceState *dev; dev = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(dev, "VAR_1", VAR_1); qdev_init_nofail(dev); sysbus_mmio_map(sysbus_from_qdev(dev), 0, VAR_0); }
[ "void FUNC_0(uint32_t VAR_0, uint32_t VAR_1)\n{", "DeviceState *dev;", "dev = qdev_create(NULL, \"realview_sysctl\");", "qdev_prop_set_uint32(dev, \"VAR_1\", VAR_1);", "qdev_init_nofail(dev);", "sysbus_mmio_map(sysbus_from_qdev(dev), 0, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
3,318
fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base, BlockDriverState **fds) { fdctrl_t *fdctrl; fdctrl = fdctrl_init(irq, 0, 1, io_base, fds); fdctrl->sun4m = 1; return fdctrl; }
false
qemu
7c560456707bfe53eb1728fcde759be7d9418b62
fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base, BlockDriverState **fds) { fdctrl_t *fdctrl; fdctrl = fdctrl_init(irq, 0, 1, io_base, fds); fdctrl->sun4m = 1; return fdctrl; }
{ "code": [], "line_no": [] }
fdctrl_t *FUNC_0 (qemu_irq irq, target_phys_addr_t io_base, BlockDriverState **fds) { fdctrl_t *fdctrl; fdctrl = fdctrl_init(irq, 0, 1, io_base, fds); fdctrl->sun4m = 1; return fdctrl; }
[ "fdctrl_t *FUNC_0 (qemu_irq irq, target_phys_addr_t io_base,\nBlockDriverState **fds)\n{", "fdctrl_t *fdctrl;", "fdctrl = fdctrl_init(irq, 0, 1, io_base, fds);", "fdctrl->sun4m = 1;", "return fdctrl;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
3,319
void cpu_loop(CPUUniCore32State *env) { CPUState *cs = CPU(uc32_env_get_cpu(env)); int trapnr; unsigned int n, insn; target_siginfo_t info; for (;;) { cpu_exec_start(cs); trapnr = uc32_cpu_exec(cs); cpu_exec_end(cs); switch (trapnr) { case UC32_EXCP_PRIV: { /* system call */ get_user_u32(insn, env->regs[31] - 4); n = insn & 0xffffff; if (n >= UC32_SYSCALL_BASE) { /* linux syscall */ n -= UC32_SYSCALL_BASE; if (n == UC32_SYSCALL_NR_set_tls) { cpu_set_tls(env, env->regs[0]); env->regs[0] = 0; } else { env->regs[0] = do_syscall(env, n, env->regs[0], env->regs[1], env->regs[2], env->regs[3], env->regs[4], env->regs[5], 0, 0); } } else { goto error; } } break; case UC32_EXCP_DTRAP: case UC32_EXCP_ITRAP: info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = env->cp0.c4_faultaddr; queue_signal(env, info.si_signo, &info); break; case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; case EXCP_DEBUG: { int sig; sig = gdb_handlesig(cs, TARGET_SIGTRAP); if (sig) { info.si_signo = sig; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; queue_signal(env, info.si_signo, &info); } } break; default: goto error; } process_pending_signals(env); } error: fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr); cpu_dump_state(cs, stderr, fprintf, 0); abort(); }
false
qemu
120a9848c2f667bf8f1a06772dc9cde064d92a7d
void cpu_loop(CPUUniCore32State *env) { CPUState *cs = CPU(uc32_env_get_cpu(env)); int trapnr; unsigned int n, insn; target_siginfo_t info; for (;;) { cpu_exec_start(cs); trapnr = uc32_cpu_exec(cs); cpu_exec_end(cs); switch (trapnr) { case UC32_EXCP_PRIV: { get_user_u32(insn, env->regs[31] - 4); n = insn & 0xffffff; if (n >= UC32_SYSCALL_BASE) { n -= UC32_SYSCALL_BASE; if (n == UC32_SYSCALL_NR_set_tls) { cpu_set_tls(env, env->regs[0]); env->regs[0] = 0; } else { env->regs[0] = do_syscall(env, n, env->regs[0], env->regs[1], env->regs[2], env->regs[3], env->regs[4], env->regs[5], 0, 0); } } else { goto error; } } break; case UC32_EXCP_DTRAP: case UC32_EXCP_ITRAP: info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = env->cp0.c4_faultaddr; queue_signal(env, info.si_signo, &info); break; case EXCP_INTERRUPT: break; case EXCP_DEBUG: { int sig; sig = gdb_handlesig(cs, TARGET_SIGTRAP); if (sig) { info.si_signo = sig; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; queue_signal(env, info.si_signo, &info); } } break; default: goto error; } process_pending_signals(env); } error: fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr); cpu_dump_state(cs, stderr, fprintf, 0); abort(); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUUniCore32State *VAR_0) { CPUState *cs = CPU(uc32_env_get_cpu(VAR_0)); int VAR_1; unsigned int VAR_2, VAR_3; target_siginfo_t info; for (;;) { cpu_exec_start(cs); VAR_1 = uc32_cpu_exec(cs); cpu_exec_end(cs); switch (VAR_1) { case UC32_EXCP_PRIV: { get_user_u32(VAR_3, VAR_0->regs[31] - 4); VAR_2 = VAR_3 & 0xffffff; if (VAR_2 >= UC32_SYSCALL_BASE) { VAR_2 -= UC32_SYSCALL_BASE; if (VAR_2 == UC32_SYSCALL_NR_set_tls) { cpu_set_tls(VAR_0, VAR_0->regs[0]); VAR_0->regs[0] = 0; } else { VAR_0->regs[0] = do_syscall(VAR_0, VAR_2, VAR_0->regs[0], VAR_0->regs[1], VAR_0->regs[2], VAR_0->regs[3], VAR_0->regs[4], VAR_0->regs[5], 0, 0); } } else { goto error; } } break; case UC32_EXCP_DTRAP: case UC32_EXCP_ITRAP: info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SEGV_MAPERR; info._sifields._sigfault._addr = VAR_0->cp0.c4_faultaddr; queue_signal(VAR_0, info.si_signo, &info); break; case EXCP_INTERRUPT: break; case EXCP_DEBUG: { int VAR_4; VAR_4 = gdb_handlesig(cs, TARGET_SIGTRAP); if (VAR_4) { info.si_signo = VAR_4; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; queue_signal(VAR_0, info.si_signo, &info); } } break; default: goto error; } process_pending_signals(VAR_0); } error: fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\VAR_2", VAR_1); cpu_dump_state(cs, stderr, fprintf, 0); abort(); }
[ "void FUNC_0(CPUUniCore32State *VAR_0)\n{", "CPUState *cs = CPU(uc32_env_get_cpu(VAR_0));", "int VAR_1;", "unsigned int VAR_2, VAR_3;", "target_siginfo_t info;", "for (;;) {", "cpu_exec_start(cs);", "VAR_1 = uc32_cpu_exec(cs);", "cpu_exec_end(cs);", "switch (VAR_1) {", "case UC32_EXCP_PRIV:\n{", "get_user_u32(VAR_3, VAR_0->regs[31] - 4);", "VAR_2 = VAR_3 & 0xffffff;", "if (VAR_2 >= UC32_SYSCALL_BASE) {", "VAR_2 -= UC32_SYSCALL_BASE;", "if (VAR_2 == UC32_SYSCALL_NR_set_tls) {", "cpu_set_tls(VAR_0, VAR_0->regs[0]);", "VAR_0->regs[0] = 0;", "} else {", "VAR_0->regs[0] = do_syscall(VAR_0,\nVAR_2,\nVAR_0->regs[0],\nVAR_0->regs[1],\nVAR_0->regs[2],\nVAR_0->regs[3],\nVAR_0->regs[4],\nVAR_0->regs[5],\n0, 0);", "}", "} else {", "goto error;", "}", "}", "break;", "case UC32_EXCP_DTRAP:\ncase UC32_EXCP_ITRAP:\ninfo.si_signo = TARGET_SIGSEGV;", "info.si_errno = 0;", "info.si_code = TARGET_SEGV_MAPERR;", "info._sifields._sigfault._addr = VAR_0->cp0.c4_faultaddr;", "queue_signal(VAR_0, info.si_signo, &info);", "break;", "case EXCP_INTERRUPT:\nbreak;", "case EXCP_DEBUG:\n{", "int VAR_4;", "VAR_4 = gdb_handlesig(cs, TARGET_SIGTRAP);", "if (VAR_4) {", "info.si_signo = VAR_4;", "info.si_errno = 0;", "info.si_code = TARGET_TRAP_BRKPT;", "queue_signal(VAR_0, info.si_signo, &info);", "}", "}", "break;", "default:\ngoto error;", "}", "process_pending_signals(VAR_0);", "}", "error:\nfprintf(stderr, \"qemu: unhandled CPU exception 0x%x - aborting\\VAR_2\", VAR_1);", "cpu_dump_state(cs, stderr, fprintf, 0);", "abort();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53, 55, 57, 59, 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 103 ], [ 105, 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ] ]
3,321
static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, int buf_size) { int i; int cur = 0; int skip = 0; int len, toks; TM2Codes codes; /* get stream length in dwords */ len = AV_RB32(buf); buf += 4; cur += 4; skip = len * 4 + 4; if(len == 0) return 4; if (len >= INT_MAX/4-1 || len < 0 || len > buf_size) { av_log(ctx->avctx, AV_LOG_ERROR, "Error, invalid stream size.\n"); } toks = AV_RB32(buf); buf += 4; cur += 4; if(toks & 1) { len = AV_RB32(buf); buf += 4; cur += 4; if(len == TM2_ESCAPE) { len = AV_RB32(buf); buf += 4; cur += 4; } if(len > 0) { init_get_bits(&ctx->gb, buf, (skip - cur) * 8); if(tm2_read_deltas(ctx, stream_id) == -1) buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; } } /* skip unused fields */ if(AV_RB32(buf) == TM2_ESCAPE) { buf += 4; cur += 4; /* some unknown length - could be escaped too */ } buf += 4; cur += 4; buf += 4; cur += 4; /* unused by decoder */ init_get_bits(&ctx->gb, buf, (skip - cur) * 8); if(tm2_build_huff_table(ctx, &codes) == -1) buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; toks >>= 1; /* check if we have sane number of tokens */ if((toks < 0) || (toks > 0xFFFFFF)){ av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks); tm2_free_codes(&codes); } ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int)); ctx->tok_lens[stream_id] = toks; len = AV_RB32(buf); buf += 4; cur += 4; if(len > 0) { init_get_bits(&ctx->gb, buf, (skip - cur) * 8); for(i = 0; i < toks; i++) { if (get_bits_left(&ctx->gb) <= 0) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks); } ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes); } } else { for(i = 0; i < toks; i++) ctx->tokens[stream_id][i] = codes.recode[0]; } tm2_free_codes(&codes); return skip; }
true
FFmpeg
65f0f9183b99881af58e90e3ae2ad8b0181d52f1
static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, int buf_size) { int i; int cur = 0; int skip = 0; int len, toks; TM2Codes codes; len = AV_RB32(buf); buf += 4; cur += 4; skip = len * 4 + 4; if(len == 0) return 4; if (len >= INT_MAX/4-1 || len < 0 || len > buf_size) { av_log(ctx->avctx, AV_LOG_ERROR, "Error, invalid stream size.\n"); } toks = AV_RB32(buf); buf += 4; cur += 4; if(toks & 1) { len = AV_RB32(buf); buf += 4; cur += 4; if(len == TM2_ESCAPE) { len = AV_RB32(buf); buf += 4; cur += 4; } if(len > 0) { init_get_bits(&ctx->gb, buf, (skip - cur) * 8); if(tm2_read_deltas(ctx, stream_id) == -1) buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; } } if(AV_RB32(buf) == TM2_ESCAPE) { buf += 4; cur += 4; } buf += 4; cur += 4; buf += 4; cur += 4; init_get_bits(&ctx->gb, buf, (skip - cur) * 8); if(tm2_build_huff_table(ctx, &codes) == -1) buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2; toks >>= 1; if((toks < 0) || (toks > 0xFFFFFF)){ av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks); tm2_free_codes(&codes); } ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int)); ctx->tok_lens[stream_id] = toks; len = AV_RB32(buf); buf += 4; cur += 4; if(len > 0) { init_get_bits(&ctx->gb, buf, (skip - cur) * 8); for(i = 0; i < toks; i++) { if (get_bits_left(&ctx->gb) <= 0) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks); } ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes); } } else { for(i = 0; i < toks; i++) ctx->tokens[stream_id][i] = codes.recode[0]; } tm2_free_codes(&codes); return skip; }
{ "code": [], "line_no": [] }
static int FUNC_0(TM2Context *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { int VAR_4; int VAR_5 = 0; int VAR_6 = 0; int VAR_7, VAR_8; TM2Codes codes; VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4; VAR_6 = VAR_7 * 4 + 4; if(VAR_7 == 0) return 4; if (VAR_7 >= INT_MAX/4-1 || VAR_7 < 0 || VAR_7 > VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error, invalid stream size.\n"); } VAR_8 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4; if(VAR_8 & 1) { VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4; if(VAR_7 == TM2_ESCAPE) { VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4; } if(VAR_7 > 0) { init_get_bits(&VAR_0->gb, VAR_1, (VAR_6 - VAR_5) * 8); if(tm2_read_deltas(VAR_0, VAR_2) == -1) VAR_1 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2; VAR_5 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2; } } if(AV_RB32(VAR_1) == TM2_ESCAPE) { VAR_1 += 4; VAR_5 += 4; } VAR_1 += 4; VAR_5 += 4; VAR_1 += 4; VAR_5 += 4; init_get_bits(&VAR_0->gb, VAR_1, (VAR_6 - VAR_5) * 8); if(tm2_build_huff_table(VAR_0, &codes) == -1) VAR_1 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2; VAR_5 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2; VAR_8 >>= 1; if((VAR_8 < 0) || (VAR_8 > 0xFFFFFF)){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %VAR_4\n", VAR_8); tm2_free_codes(&codes); } VAR_0->tokens[VAR_2] = av_realloc(VAR_0->tokens[VAR_2], VAR_8 * sizeof(int)); VAR_0->tok_lens[VAR_2] = VAR_8; VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4; if(VAR_7 > 0) { init_get_bits(&VAR_0->gb, VAR_1, (VAR_6 - VAR_5) * 8); for(VAR_4 = 0; VAR_4 < VAR_8; VAR_4++) { if (get_bits_left(&VAR_0->gb) <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %VAR_4\n", VAR_8); } VAR_0->tokens[VAR_2][VAR_4] = tm2_get_token(&VAR_0->gb, &codes); } } else { for(VAR_4 = 0; VAR_4 < VAR_8; VAR_4++) VAR_0->tokens[VAR_2][VAR_4] = codes.recode[0]; } tm2_free_codes(&codes); return VAR_6; }
[ "static int FUNC_0(TM2Context *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4;", "int VAR_5 = 0;", "int VAR_6 = 0;", "int VAR_7, VAR_8;", "TM2Codes codes;", "VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4;", "VAR_6 = VAR_7 * 4 + 4;", "if(VAR_7 == 0)\nreturn 4;", "if (VAR_7 >= INT_MAX/4-1 || VAR_7 < 0 || VAR_7 > VAR_3) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error, invalid stream size.\\n\");", "}", "VAR_8 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4;", "if(VAR_8 & 1) {", "VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4;", "if(VAR_7 == TM2_ESCAPE) {", "VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4;", "}", "if(VAR_7 > 0) {", "init_get_bits(&VAR_0->gb, VAR_1, (VAR_6 - VAR_5) * 8);", "if(tm2_read_deltas(VAR_0, VAR_2) == -1)\nVAR_1 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2;", "VAR_5 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2;", "}", "}", "if(AV_RB32(VAR_1) == TM2_ESCAPE) {", "VAR_1 += 4; VAR_5 += 4;", "}", "VAR_1 += 4; VAR_5 += 4;", "VAR_1 += 4; VAR_5 += 4;", "init_get_bits(&VAR_0->gb, VAR_1, (VAR_6 - VAR_5) * 8);", "if(tm2_build_huff_table(VAR_0, &codes) == -1)\nVAR_1 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2;", "VAR_5 += ((get_bits_count(&VAR_0->gb) + 31) >> 5) << 2;", "VAR_8 >>= 1;", "if((VAR_8 < 0) || (VAR_8 > 0xFFFFFF)){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Incorrect number of tokens: %VAR_4\\n\", VAR_8);", "tm2_free_codes(&codes);", "}", "VAR_0->tokens[VAR_2] = av_realloc(VAR_0->tokens[VAR_2], VAR_8 * sizeof(int));", "VAR_0->tok_lens[VAR_2] = VAR_8;", "VAR_7 = AV_RB32(VAR_1); VAR_1 += 4; VAR_5 += 4;", "if(VAR_7 > 0) {", "init_get_bits(&VAR_0->gb, VAR_1, (VAR_6 - VAR_5) * 8);", "for(VAR_4 = 0; VAR_4 < VAR_8; VAR_4++) {", "if (get_bits_left(&VAR_0->gb) <= 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Incorrect number of tokens: %VAR_4\\n\", VAR_8);", "}", "VAR_0->tokens[VAR_2][VAR_4] = tm2_get_token(&VAR_0->gb, &codes);", "}", "} else {", "for(VAR_4 = 0; VAR_4 < VAR_8; VAR_4++)", "VAR_0->tokens[VAR_2][VAR_4] = codes.recode[0];", "}", "tm2_free_codes(&codes);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 36 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85, 88 ], [ 90 ], [ 94 ], [ 98 ], [ 100 ], [ 102 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 124 ], [ 126 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ], [ 136 ], [ 138 ], [ 142 ], [ 144 ] ]
3,323
int64_t av_gcd(int64_t a, int64_t b) { if (b) return av_gcd(b, a % b); else return a; }
true
FFmpeg
971d12b7f9d7be3ca8eb98e6c04ed521f83cbd3c
int64_t av_gcd(int64_t a, int64_t b) { if (b) return av_gcd(b, a % b); else return a; }
{ "code": [ "int64_t av_gcd(int64_t a, int64_t b)", " if (b)", " return av_gcd(b, a % b);" ], "line_no": [ 1, 5, 7 ] }
int64_t FUNC_0(int64_t a, int64_t b) { if (b) return FUNC_0(b, a % b); else return a; }
[ "int64_t FUNC_0(int64_t a, int64_t b)\n{", "if (b)\nreturn FUNC_0(b, a % b);", "else\nreturn a;", "}" ]
[ 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ] ]
3,324
static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice) { unsigned int x, overflow; int tmpk; overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970); if (overflow == (MODEL_ELEMENTS - 1)) { tmpk = range_decode_bits(ctx, 5); overflow = 0; } else tmpk = (rice->k < 1) ? 0 : rice->k - 1; if (tmpk <= 16 || ctx->fileversion < 3910) { if (tmpk > 23) { av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk); return AVERROR_INVALIDDATA; } x = range_decode_bits(ctx, tmpk); } else if (tmpk <= 32) { x = range_decode_bits(ctx, 16); x |= (range_decode_bits(ctx, tmpk - 16) << 16); } else { av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk); return AVERROR_INVALIDDATA; } x += overflow << tmpk; update_rice(rice, x); /* Convert to signed */ if (x & 1) return (x >> 1) + 1; else return -(x >> 1); }
true
FFmpeg
ebfe154bd52204a4da19d26d8d5ae0f8003558ac
static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice) { unsigned int x, overflow; int tmpk; overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970); if (overflow == (MODEL_ELEMENTS - 1)) { tmpk = range_decode_bits(ctx, 5); overflow = 0; } else tmpk = (rice->k < 1) ? 0 : rice->k - 1; if (tmpk <= 16 || ctx->fileversion < 3910) { if (tmpk > 23) { av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk); return AVERROR_INVALIDDATA; } x = range_decode_bits(ctx, tmpk); } else if (tmpk <= 32) { x = range_decode_bits(ctx, 16); x |= (range_decode_bits(ctx, tmpk - 16) << 16); } else { av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk); return AVERROR_INVALIDDATA; } x += overflow << tmpk; update_rice(rice, x); if (x & 1) return (x >> 1) + 1; else return -(x >> 1); }
{ "code": [ " } else if (tmpk <= 32) {" ], "line_no": [ 39 ] }
static inline int FUNC_0(APEContext *VAR_0, APERice *VAR_1) { unsigned int VAR_2, VAR_3; int VAR_4; VAR_3 = range_get_symbol(VAR_0, counts_3970, counts_diff_3970); if (VAR_3 == (MODEL_ELEMENTS - 1)) { VAR_4 = range_decode_bits(VAR_0, 5); VAR_3 = 0; } else VAR_4 = (VAR_1->k < 1) ? 0 : VAR_1->k - 1; if (VAR_4 <= 16 || VAR_0->fileversion < 3910) { if (VAR_4 > 23) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Too many bits: %d\n", VAR_4); return AVERROR_INVALIDDATA; } VAR_2 = range_decode_bits(VAR_0, VAR_4); } else if (VAR_4 <= 32) { VAR_2 = range_decode_bits(VAR_0, 16); VAR_2 |= (range_decode_bits(VAR_0, VAR_4 - 16) << 16); } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "Too many bits: %d\n", VAR_4); return AVERROR_INVALIDDATA; } VAR_2 += VAR_3 << VAR_4; update_rice(VAR_1, VAR_2); if (VAR_2 & 1) return (VAR_2 >> 1) + 1; else return -(VAR_2 >> 1); }
[ "static inline int FUNC_0(APEContext *VAR_0, APERice *VAR_1)\n{", "unsigned int VAR_2, VAR_3;", "int VAR_4;", "VAR_3 = range_get_symbol(VAR_0, counts_3970, counts_diff_3970);", "if (VAR_3 == (MODEL_ELEMENTS - 1)) {", "VAR_4 = range_decode_bits(VAR_0, 5);", "VAR_3 = 0;", "} else", "VAR_4 = (VAR_1->k < 1) ? 0 : VAR_1->k - 1;", "if (VAR_4 <= 16 || VAR_0->fileversion < 3910) {", "if (VAR_4 > 23) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Too many bits: %d\\n\", VAR_4);", "return AVERROR_INVALIDDATA;", "}", "VAR_2 = range_decode_bits(VAR_0, VAR_4);", "} else if (VAR_4 <= 32) {", "VAR_2 = range_decode_bits(VAR_0, 16);", "VAR_2 |= (range_decode_bits(VAR_0, VAR_4 - 16) << 16);", "} else {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Too many bits: %d\\n\", VAR_4);", "return AVERROR_INVALIDDATA;", "}", "VAR_2 += VAR_3 << VAR_4;", "update_rice(VAR_1, VAR_2);", "if (VAR_2 & 1)\nreturn (VAR_2 >> 1) + 1;", "else\nreturn -(VAR_2 >> 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 63, 65 ], [ 67, 69 ], [ 71 ] ]
3,325
int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture, int *got_picture_ptr, UINT8 *buf, int buf_size) { int ret; ret = avctx->codec->decode(avctx, picture, got_picture_ptr, buf, buf_size); avctx->frame_number++; return ret; }
true
FFmpeg
1cb0edb40b8e94e1a50ad40c40d43e34ed8435fe
int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture, int *got_picture_ptr, UINT8 *buf, int buf_size) { int ret; ret = avctx->codec->decode(avctx, picture, got_picture_ptr, buf, buf_size); avctx->frame_number++; return ret; }
{ "code": [ " avctx->frame_number++;" ], "line_no": [ 17 ] }
int FUNC_0(AVCodecContext *VAR_0, AVPicture *VAR_1, int *VAR_2, UINT8 *VAR_3, int VAR_4) { int VAR_5; VAR_5 = VAR_0->codec->decode(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); VAR_0->frame_number++; return VAR_5; }
[ "int FUNC_0(AVCodecContext *VAR_0, AVPicture *VAR_1,\nint *VAR_2,\nUINT8 *VAR_3, int VAR_4)\n{", "int VAR_5;", "VAR_5 = VAR_0->codec->decode(VAR_0, VAR_1, VAR_2,\nVAR_3, VAR_4);", "VAR_0->frame_number++;", "return VAR_5;", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ] ]
3,326
static void nbd_teardown_connection(NbdClientSession *client) { struct nbd_request request = { .type = NBD_CMD_DISC, .from = 0, .len = 0 }; nbd_send_request(client->sock, &request); /* finish any pending coroutines */ shutdown(client->sock, 2); nbd_recv_coroutines_enter_all(client); qemu_aio_set_fd_handler(client->sock, NULL, NULL, NULL); closesocket(client->sock); client->sock = -1; }
true
qemu
4a41a2d68a684241aca96dba066e0699941b730d
static void nbd_teardown_connection(NbdClientSession *client) { struct nbd_request request = { .type = NBD_CMD_DISC, .from = 0, .len = 0 }; nbd_send_request(client->sock, &request); shutdown(client->sock, 2); nbd_recv_coroutines_enter_all(client); qemu_aio_set_fd_handler(client->sock, NULL, NULL, NULL); closesocket(client->sock); client->sock = -1; }
{ "code": [ "static void nbd_teardown_connection(NbdClientSession *client)", " nbd_send_request(client->sock, &request);", " shutdown(client->sock, 2);", " nbd_recv_coroutines_enter_all(client);", " qemu_aio_set_fd_handler(client->sock, NULL, NULL, NULL);", " closesocket(client->sock);", " client->sock = -1;" ], "line_no": [ 1, 17, 23, 25, 29, 31, 33 ] }
static void FUNC_0(NbdClientSession *VAR_0) { struct nbd_request VAR_1 = { .type = NBD_CMD_DISC, .from = 0, .len = 0 }; nbd_send_request(VAR_0->sock, &VAR_1); shutdown(VAR_0->sock, 2); nbd_recv_coroutines_enter_all(VAR_0); qemu_aio_set_fd_handler(VAR_0->sock, NULL, NULL, NULL); closesocket(VAR_0->sock); VAR_0->sock = -1; }
[ "static void FUNC_0(NbdClientSession *VAR_0)\n{", "struct nbd_request VAR_1 = {", ".type = NBD_CMD_DISC,\n.from = 0,\n.len = 0\n};", "nbd_send_request(VAR_0->sock, &VAR_1);", "shutdown(VAR_0->sock, 2);", "nbd_recv_coroutines_enter_all(VAR_0);", "qemu_aio_set_fd_handler(VAR_0->sock, NULL, NULL, NULL);", "closesocket(VAR_0->sock);", "VAR_0->sock = -1;", "}" ]
[ 1, 0, 0, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13 ], [ 17 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
3,329
static void do_bit_allocation(AC3DecodeContext *ctx, int flags) { ac3_audio_block *ab = &ctx->audio_block; int i, snroffst = 0; if (!flags) /* bit allocation is not required */ return; if (ab->flags & AC3_AB_SNROFFSTE) { /* check whether snroffsts are zero */ snroffst += ab->csnroffst; if (ab->flags & AC3_AB_CPLINU) snroffst += ab->cplfsnroffst; for (i = 0; i < ctx->bsi.nfchans; i++) snroffst += ab->fsnroffst[i]; if (ctx->bsi.flags & AC3_BSI_LFEON) snroffst += ab->lfefsnroffst; if (!snroffst) { memset(ab->cplbap, 0, sizeof (ab->cplbap)); for (i = 0; i < ctx->bsi.nfchans; i++) memset(ab->bap[i], 0, sizeof (ab->bap[i])); memset(ab->lfebap, 0, sizeof (ab->lfebap)); return; } } /* perform bit allocation */ if ((ab->flags & AC3_AB_CPLINU) && (flags & 64)) do_bit_allocation1(ctx, 5); for (i = 0; i < ctx->bsi.nfchans; i++) if (flags & (1 << i)) do_bit_allocation1(ctx, i); if ((ctx->bsi.flags & AC3_BSI_LFEON) && (flags & 32)) do_bit_allocation1(ctx, 6); }
false
FFmpeg
486637af8ef29ec215e0e0b7ecd3b5470f0e04e5
static void do_bit_allocation(AC3DecodeContext *ctx, int flags) { ac3_audio_block *ab = &ctx->audio_block; int i, snroffst = 0; if (!flags) return; if (ab->flags & AC3_AB_SNROFFSTE) { snroffst += ab->csnroffst; if (ab->flags & AC3_AB_CPLINU) snroffst += ab->cplfsnroffst; for (i = 0; i < ctx->bsi.nfchans; i++) snroffst += ab->fsnroffst[i]; if (ctx->bsi.flags & AC3_BSI_LFEON) snroffst += ab->lfefsnroffst; if (!snroffst) { memset(ab->cplbap, 0, sizeof (ab->cplbap)); for (i = 0; i < ctx->bsi.nfchans; i++) memset(ab->bap[i], 0, sizeof (ab->bap[i])); memset(ab->lfebap, 0, sizeof (ab->lfebap)); return; } } if ((ab->flags & AC3_AB_CPLINU) && (flags & 64)) do_bit_allocation1(ctx, 5); for (i = 0; i < ctx->bsi.nfchans; i++) if (flags & (1 << i)) do_bit_allocation1(ctx, i); if ((ctx->bsi.flags & AC3_BSI_LFEON) && (flags & 32)) do_bit_allocation1(ctx, 6); }
{ "code": [], "line_no": [] }
static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1) { ac3_audio_block *ab = &VAR_0->audio_block; int VAR_2, VAR_3 = 0; if (!VAR_1) return; if (ab->VAR_1 & AC3_AB_SNROFFSTE) { VAR_3 += ab->csnroffst; if (ab->VAR_1 & AC3_AB_CPLINU) VAR_3 += ab->cplfsnroffst; for (VAR_2 = 0; VAR_2 < VAR_0->bsi.nfchans; VAR_2++) VAR_3 += ab->fsnroffst[VAR_2]; if (VAR_0->bsi.VAR_1 & AC3_BSI_LFEON) VAR_3 += ab->lfefsnroffst; if (!VAR_3) { memset(ab->cplbap, 0, sizeof (ab->cplbap)); for (VAR_2 = 0; VAR_2 < VAR_0->bsi.nfchans; VAR_2++) memset(ab->bap[VAR_2], 0, sizeof (ab->bap[VAR_2])); memset(ab->lfebap, 0, sizeof (ab->lfebap)); return; } } if ((ab->VAR_1 & AC3_AB_CPLINU) && (VAR_1 & 64)) do_bit_allocation1(VAR_0, 5); for (VAR_2 = 0; VAR_2 < VAR_0->bsi.nfchans; VAR_2++) if (VAR_1 & (1 << VAR_2)) do_bit_allocation1(VAR_0, VAR_2); if ((VAR_0->bsi.VAR_1 & AC3_BSI_LFEON) && (VAR_1 & 32)) do_bit_allocation1(VAR_0, 6); }
[ "static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)\n{", "ac3_audio_block *ab = &VAR_0->audio_block;", "int VAR_2, VAR_3 = 0;", "if (!VAR_1)\nreturn;", "if (ab->VAR_1 & AC3_AB_SNROFFSTE) {", "VAR_3 += ab->csnroffst;", "if (ab->VAR_1 & AC3_AB_CPLINU)\nVAR_3 += ab->cplfsnroffst;", "for (VAR_2 = 0; VAR_2 < VAR_0->bsi.nfchans; VAR_2++)", "VAR_3 += ab->fsnroffst[VAR_2];", "if (VAR_0->bsi.VAR_1 & AC3_BSI_LFEON)\nVAR_3 += ab->lfefsnroffst;", "if (!VAR_3) {", "memset(ab->cplbap, 0, sizeof (ab->cplbap));", "for (VAR_2 = 0; VAR_2 < VAR_0->bsi.nfchans; VAR_2++)", "memset(ab->bap[VAR_2], 0, sizeof (ab->bap[VAR_2]));", "memset(ab->lfebap, 0, sizeof (ab->lfebap));", "return;", "}", "}", "if ((ab->VAR_1 & AC3_AB_CPLINU) && (VAR_1 & 64))\ndo_bit_allocation1(VAR_0, 5);", "for (VAR_2 = 0; VAR_2 < VAR_0->bsi.nfchans; VAR_2++)", "if (VAR_1 & (1 << VAR_2))\ndo_bit_allocation1(VAR_0, VAR_2);", "if ((VAR_0->bsi.VAR_1 & AC3_BSI_LFEON) && (VAR_1 & 32))\ndo_bit_allocation1(VAR_0, 6);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ] ]
3,331
static int adx_decode_header(AVCodecContext *avctx, const uint8_t *buf, int bufsize) { int offset; if (buf[0] != 0x80) return 0; offset = (AV_RB32(buf) ^ 0x80000000) + 4; if (bufsize < offset || memcmp(buf + offset - 6, "(c)CRI", 6)) return 0; avctx->channels = buf[7]; avctx->sample_rate = AV_RB32(buf + 8); avctx->bit_rate = avctx->sample_rate * avctx->channels * 18 * 8 / 32; return offset; }
false
FFmpeg
e2d1eace00a80c4b53998397d38ea4e08c5d47f0
static int adx_decode_header(AVCodecContext *avctx, const uint8_t *buf, int bufsize) { int offset; if (buf[0] != 0x80) return 0; offset = (AV_RB32(buf) ^ 0x80000000) + 4; if (bufsize < offset || memcmp(buf + offset - 6, "(c)CRI", 6)) return 0; avctx->channels = buf[7]; avctx->sample_rate = AV_RB32(buf + 8); avctx->bit_rate = avctx->sample_rate * avctx->channels * 18 * 8 / 32; return offset; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { int VAR_3; if (VAR_1[0] != 0x80) return 0; VAR_3 = (AV_RB32(VAR_1) ^ 0x80000000) + 4; if (VAR_2 < VAR_3 || memcmp(VAR_1 + VAR_3 - 6, "(c)CRI", 6)) return 0; VAR_0->channels = VAR_1[7]; VAR_0->sample_rate = AV_RB32(VAR_1 + 8); VAR_0->bit_rate = VAR_0->sample_rate * VAR_0->channels * 18 * 8 / 32; return VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2)\n{", "int VAR_3;", "if (VAR_1[0] != 0x80)\nreturn 0;", "VAR_3 = (AV_RB32(VAR_1) ^ 0x80000000) + 4;", "if (VAR_2 < VAR_3 || memcmp(VAR_1 + VAR_3 - 6, \"(c)CRI\", 6))\nreturn 0;", "VAR_0->channels = VAR_1[7];", "VAR_0->sample_rate = AV_RB32(VAR_1 + 8);", "VAR_0->bit_rate = VAR_0->sample_rate * VAR_0->channels * 18 * 8 / 32;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
3,332
static void scsi_write_complete(void * opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; block_acct_done(bdrv_get_stats(s->qdev.conf.bs), &r->acct); } if (r->req.io_canceled) { goto done; } if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } } n = r->qiov.size / 512; r->sector += n; r->sector_count -= n; if (r->sector_count == 0) { scsi_write_do_fua(r); return; } else { scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); DPRINTF("Write complete tag=0x%x more=%zd\n", r->req.tag, r->qiov.size); scsi_req_data(&r->req, r->qiov.size); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
false
qemu
3df9caf88f5c0859ae380101fea47609ba1dbfbd
static void scsi_write_complete(void * opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; block_acct_done(bdrv_get_stats(s->qdev.conf.bs), &r->acct); } if (r->req.io_canceled) { goto done; } if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } } n = r->qiov.size / 512; r->sector += n; r->sector_count -= n; if (r->sector_count == 0) { scsi_write_do_fua(r); return; } else { scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); DPRINTF("Write complete tag=0x%x more=%zd\n", r->req.tag, r->qiov.size); scsi_req_data(&r->req, r->qiov.size); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void * VAR_0, int VAR_1) { SCSIDiskReq *r = (SCSIDiskReq *)VAR_0; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; block_acct_done(bdrv_get_stats(s->qdev.conf.bs), &r->acct); } if (r->req.io_canceled) { goto done; } if (VAR_1 < 0) { if (scsi_handle_rw_error(r, -VAR_1)) { goto done; } } n = r->qiov.size / 512; r->sector += n; r->sector_count -= n; if (r->sector_count == 0) { scsi_write_do_fua(r); return; } else { scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); DPRINTF("Write complete tag=0x%x more=%zd\n", r->req.tag, r->qiov.size); scsi_req_data(&r->req, r->qiov.size); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
[ "static void FUNC_0(void * VAR_0, int VAR_1)\n{", "SCSIDiskReq *r = (SCSIDiskReq *)VAR_0;", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);", "uint32_t n;", "if (r->req.aiocb != NULL) {", "r->req.aiocb = NULL;", "block_acct_done(bdrv_get_stats(s->qdev.conf.bs), &r->acct);", "}", "if (r->req.io_canceled) {", "goto done;", "}", "if (VAR_1 < 0) {", "if (scsi_handle_rw_error(r, -VAR_1)) {", "goto done;", "}", "}", "n = r->qiov.size / 512;", "r->sector += n;", "r->sector_count -= n;", "if (r->sector_count == 0) {", "scsi_write_do_fua(r);", "return;", "} else {", "scsi_init_iovec(r, SCSI_DMA_BUF_SIZE);", "DPRINTF(\"Write complete tag=0x%x more=%zd\\n\", r->req.tag, r->qiov.size);", "scsi_req_data(&r->req, r->qiov.size);", "}", "done:\nif (!r->req.io_canceled) {", "scsi_req_unref(&r->req);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ] ]
3,334
static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) { int64_t overlap_offset = req->offset & ~(align - 1); unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align) - overlap_offset; if (!req->serialising) { req->bs->serialising_in_flight++; req->serialising = true; } req->overlap_offset = MIN(req->overlap_offset, overlap_offset); req->overlap_bytes = MAX(req->overlap_bytes, overlap_bytes); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align) { int64_t overlap_offset = req->offset & ~(align - 1); unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align) - overlap_offset; if (!req->serialising) { req->bs->serialising_in_flight++; req->serialising = true; } req->overlap_offset = MIN(req->overlap_offset, overlap_offset); req->overlap_bytes = MAX(req->overlap_bytes, overlap_bytes); }
{ "code": [], "line_no": [] }
static void FUNC_0(BdrvTrackedRequest *VAR_0, uint64_t VAR_1) { int64_t overlap_offset = VAR_0->offset & ~(VAR_1 - 1); unsigned int VAR_2 = ROUND_UP(VAR_0->offset + VAR_0->bytes, VAR_1) - overlap_offset; if (!VAR_0->serialising) { VAR_0->bs->serialising_in_flight++; VAR_0->serialising = true; } VAR_0->overlap_offset = MIN(VAR_0->overlap_offset, overlap_offset); VAR_0->VAR_2 = MAX(VAR_0->VAR_2, VAR_2); }
[ "static void FUNC_0(BdrvTrackedRequest *VAR_0, uint64_t VAR_1)\n{", "int64_t overlap_offset = VAR_0->offset & ~(VAR_1 - 1);", "unsigned int VAR_2 = ROUND_UP(VAR_0->offset + VAR_0->bytes, VAR_1)\n- overlap_offset;", "if (!VAR_0->serialising) {", "VAR_0->bs->serialising_in_flight++;", "VAR_0->serialising = true;", "}", "VAR_0->overlap_offset = MIN(VAR_0->overlap_offset, overlap_offset);", "VAR_0->VAR_2 = MAX(VAR_0->VAR_2, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ] ]
3,335
STATIC void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_ZERO(mm7); SET_RND(mm6); // =2 for rnd and =1 for no_rnd version __asm__ volatile( "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpckhbw %%mm7, %%mm1 \n\t" "punpckhbw %%mm7, %%mm5 \n\t" "paddusw %%mm0, %%mm4 \n\t" "paddusw %%mm1, %%mm5 \n\t" "xor %%"REG_a", %%"REG_a" \n\t" "add %3, %1 \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq 1(%1, %%"REG_a"), %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpckhbw %%mm7, %%mm1 \n\t" "punpckhbw %%mm7, %%mm3 \n\t" "paddusw %%mm2, %%mm0 \n\t" "paddusw %%mm3, %%mm1 \n\t" "paddusw %%mm6, %%mm4 \n\t" "paddusw %%mm6, %%mm5 \n\t" "paddusw %%mm0, %%mm4 \n\t" "paddusw %%mm1, %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm5 \n\t" "movq (%2, %%"REG_a"), %%mm3 \n\t" "packuswb %%mm5, %%mm4 \n\t" "pcmpeqd %%mm2, %%mm2 \n\t" "paddb %%mm2, %%mm2 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm5, %%mm2) "movq %%mm5, (%2, %%"REG_a") \n\t" "add %3, %%"REG_a" \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" // 0 <-> 2 1 <-> 3 "movq 1(%1, %%"REG_a"), %%mm4 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpckhbw %%mm7, %%mm3 \n\t" "punpckhbw %%mm7, %%mm5 \n\t" "paddusw %%mm2, %%mm4 \n\t" "paddusw %%mm3, %%mm5 \n\t" "paddusw %%mm6, %%mm0 \n\t" "paddusw %%mm6, %%mm1 \n\t" "paddusw %%mm4, %%mm0 \n\t" "paddusw %%mm5, %%mm1 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm1 \n\t" "movq (%2, %%"REG_a"), %%mm3 \n\t" "packuswb %%mm1, %%mm0 \n\t" "pcmpeqd %%mm2, %%mm2 \n\t" "paddb %%mm2, %%mm2 \n\t" PAVGB_MMX(%%mm3, %%mm0, %%mm1, %%mm2) "movq %%mm1, (%2, %%"REG_a") \n\t" "add %3, %%"REG_a" \n\t" "subl $2, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels) :"D"(block), "r"((x86_reg)line_size) :REG_a, "memory"); }
false
FFmpeg
308e7484a3b1954072871a4090e5c672d1097fa5
STATIC void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_ZERO(mm7); SET_RND(mm6); __asm__ volatile( "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpckhbw %%mm7, %%mm1 \n\t" "punpckhbw %%mm7, %%mm5 \n\t" "paddusw %%mm0, %%mm4 \n\t" "paddusw %%mm1, %%mm5 \n\t" "xor %%"REG_a", %%"REG_a" \n\t" "add %3, %1 \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq 1(%1, %%"REG_a"), %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpckhbw %%mm7, %%mm1 \n\t" "punpckhbw %%mm7, %%mm3 \n\t" "paddusw %%mm2, %%mm0 \n\t" "paddusw %%mm3, %%mm1 \n\t" "paddusw %%mm6, %%mm4 \n\t" "paddusw %%mm6, %%mm5 \n\t" "paddusw %%mm0, %%mm4 \n\t" "paddusw %%mm1, %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm5 \n\t" "movq (%2, %%"REG_a"), %%mm3 \n\t" "packuswb %%mm5, %%mm4 \n\t" "pcmpeqd %%mm2, %%mm2 \n\t" "paddb %%mm2, %%mm2 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm5, %%mm2) "movq %%mm5, (%2, %%"REG_a") \n\t" "add %3, %%"REG_a" \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm4 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpckhbw %%mm7, %%mm3 \n\t" "punpckhbw %%mm7, %%mm5 \n\t" "paddusw %%mm2, %%mm4 \n\t" "paddusw %%mm3, %%mm5 \n\t" "paddusw %%mm6, %%mm0 \n\t" "paddusw %%mm6, %%mm1 \n\t" "paddusw %%mm4, %%mm0 \n\t" "paddusw %%mm5, %%mm1 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm1 \n\t" "movq (%2, %%"REG_a"), %%mm3 \n\t" "packuswb %%mm1, %%mm0 \n\t" "pcmpeqd %%mm2, %%mm2 \n\t" "paddb %%mm2, %%mm2 \n\t" PAVGB_MMX(%%mm3, %%mm0, %%mm1, %%mm2) "movq %%mm1, (%2, %%"REG_a") \n\t" "add %3, %%"REG_a" \n\t" "subl $2, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels) :"D"(block), "r"((x86_reg)line_size) :REG_a, "memory"); }
{ "code": [], "line_no": [] }
STATIC void FUNC_0(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_ZERO(mm7); SET_RND(mm6); __asm__ volatile( "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpckhbw %%mm7, %%mm1 \n\t" "punpckhbw %%mm7, %%mm5 \n\t" "paddusw %%mm0, %%mm4 \n\t" "paddusw %%mm1, %%mm5 \n\t" "xor %%"REG_a", %%"REG_a" \n\t" "add %3, %1 \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" "movq 1(%1, %%"REG_a"), %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpckhbw %%mm7, %%mm1 \n\t" "punpckhbw %%mm7, %%mm3 \n\t" "paddusw %%mm2, %%mm0 \n\t" "paddusw %%mm3, %%mm1 \n\t" "paddusw %%mm6, %%mm4 \n\t" "paddusw %%mm6, %%mm5 \n\t" "paddusw %%mm0, %%mm4 \n\t" "paddusw %%mm1, %%mm5 \n\t" "psrlw $2, %%mm4 \n\t" "psrlw $2, %%mm5 \n\t" "movq (%2, %%"REG_a"), %%mm3 \n\t" "packuswb %%mm5, %%mm4 \n\t" "pcmpeqd %%mm2, %%mm2 \n\t" "paddb %%mm2, %%mm2 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm5, %%mm2) "movq %%mm5, (%2, %%"REG_a") \n\t" "add %3, %%"REG_a" \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" "movq 1(%1, %%"REG_a"), %%mm4 \n\t" "movq %%mm2, %%mm3 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpckhbw %%mm7, %%mm3 \n\t" "punpckhbw %%mm7, %%mm5 \n\t" "paddusw %%mm2, %%mm4 \n\t" "paddusw %%mm3, %%mm5 \n\t" "paddusw %%mm6, %%mm0 \n\t" "paddusw %%mm6, %%mm1 \n\t" "paddusw %%mm4, %%mm0 \n\t" "paddusw %%mm5, %%mm1 \n\t" "psrlw $2, %%mm0 \n\t" "psrlw $2, %%mm1 \n\t" "movq (%2, %%"REG_a"), %%mm3 \n\t" "packuswb %%mm1, %%mm0 \n\t" "pcmpeqd %%mm2, %%mm2 \n\t" "paddb %%mm2, %%mm2 \n\t" PAVGB_MMX(%%mm3, %%mm0, %%mm1, %%mm2) "movq %%mm1, (%2, %%"REG_a") \n\t" "add %3, %%"REG_a" \n\t" "subl $2, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels) :"D"(block), "r"((x86_reg)line_size) :REG_a, "memory"); }
[ "STATIC void FUNC_0(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels,\nptrdiff_t line_size, int h)\n{", "MOVQ_ZERO(mm7);", "SET_RND(mm6);", "__asm__ volatile(\n\"movq (%1), %%mm0 \\n\\t\"\n\"movq 1(%1), %%mm4 \\n\\t\"\n\"movq %%mm0, %%mm1 \\n\\t\"\n\"movq %%mm4, %%mm5 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm4 \\n\\t\"\n\"punpckhbw %%mm7, %%mm1 \\n\\t\"\n\"punpckhbw %%mm7, %%mm5 \\n\\t\"\n\"paddusw %%mm0, %%mm4 \\n\\t\"\n\"paddusw %%mm1, %%mm5 \\n\\t\"\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\n\"add %3, %1 \\n\\t\"\n\".p2align 3 \\n\\t\"\n\"1: \\n\\t\"\n\"movq (%1, %%\"REG_a\"), %%mm0 \\n\\t\"\n\"movq 1(%1, %%\"REG_a\"), %%mm2 \\n\\t\"\n\"movq %%mm0, %%mm1 \\n\\t\"\n\"movq %%mm2, %%mm3 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm2 \\n\\t\"\n\"punpckhbw %%mm7, %%mm1 \\n\\t\"\n\"punpckhbw %%mm7, %%mm3 \\n\\t\"\n\"paddusw %%mm2, %%mm0 \\n\\t\"\n\"paddusw %%mm3, %%mm1 \\n\\t\"\n\"paddusw %%mm6, %%mm4 \\n\\t\"\n\"paddusw %%mm6, %%mm5 \\n\\t\"\n\"paddusw %%mm0, %%mm4 \\n\\t\"\n\"paddusw %%mm1, %%mm5 \\n\\t\"\n\"psrlw $2, %%mm4 \\n\\t\"\n\"psrlw $2, %%mm5 \\n\\t\"\n\"movq (%2, %%\"REG_a\"), %%mm3 \\n\\t\"\n\"packuswb %%mm5, %%mm4 \\n\\t\"\n\"pcmpeqd %%mm2, %%mm2 \\n\\t\"\n\"paddb %%mm2, %%mm2 \\n\\t\"\nPAVGB_MMX(%%mm3, %%mm4, %%mm5, %%mm2)\n\"movq %%mm5, (%2, %%\"REG_a\") \\n\\t\"\n\"add %3, %%\"REG_a\" \\n\\t\"\n\"movq (%1, %%\"REG_a\"), %%mm2 \\n\\t\"\n\"movq 1(%1, %%\"REG_a\"), %%mm4 \\n\\t\"\n\"movq %%mm2, %%mm3 \\n\\t\"\n\"movq %%mm4, %%mm5 \\n\\t\"\n\"punpcklbw %%mm7, %%mm2 \\n\\t\"\n\"punpcklbw %%mm7, %%mm4 \\n\\t\"\n\"punpckhbw %%mm7, %%mm3 \\n\\t\"\n\"punpckhbw %%mm7, %%mm5 \\n\\t\"\n\"paddusw %%mm2, %%mm4 \\n\\t\"\n\"paddusw %%mm3, %%mm5 \\n\\t\"\n\"paddusw %%mm6, %%mm0 \\n\\t\"\n\"paddusw %%mm6, %%mm1 \\n\\t\"\n\"paddusw %%mm4, %%mm0 \\n\\t\"\n\"paddusw %%mm5, %%mm1 \\n\\t\"\n\"psrlw $2, %%mm0 \\n\\t\"\n\"psrlw $2, %%mm1 \\n\\t\"\n\"movq (%2, %%\"REG_a\"), %%mm3 \\n\\t\"\n\"packuswb %%mm1, %%mm0 \\n\\t\"\n\"pcmpeqd %%mm2, %%mm2 \\n\\t\"\n\"paddb %%mm2, %%mm2 \\n\\t\"\nPAVGB_MMX(%%mm3, %%mm0, %%mm1, %%mm2)\n\"movq %%mm1, (%2, %%\"REG_a\") \\n\\t\"\n\"add %3, %%\"REG_a\" \\n\\t\"\n\"subl $2, %0 \\n\\t\"\n\"jnz 1b \\n\\t\"\n:\"+g\"(h), \"+S\"(pixels)\n:\"D\"(block), \"r\"((x86_reg)line_size)\n:REG_a, \"memory\");", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 137, 139, 141, 143, 145 ], [ 147 ] ]
3,336
start_list(Visitor *v, const char *name, Error **errp) { StringInputVisitor *siv = to_siv(v); if (parse_str(siv, name, errp) < 0) { return; } siv->cur_range = g_list_first(siv->ranges); if (siv->cur_range) { Range *r = siv->cur_range->data; if (r) { siv->cur = r->begin; } } }
false
qemu
d9f62dde1303286b24ac8ce88be27e2b9b9c5f46
start_list(Visitor *v, const char *name, Error **errp) { StringInputVisitor *siv = to_siv(v); if (parse_str(siv, name, errp) < 0) { return; } siv->cur_range = g_list_first(siv->ranges); if (siv->cur_range) { Range *r = siv->cur_range->data; if (r) { siv->cur = r->begin; } } }
{ "code": [], "line_no": [] }
FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2) { StringInputVisitor *siv = to_siv(VAR_0); if (parse_str(siv, VAR_1, VAR_2) < 0) { return; } siv->cur_range = g_list_first(siv->ranges); if (siv->cur_range) { Range *r = siv->cur_range->data; if (r) { siv->cur = r->begin; } } }
[ "FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "StringInputVisitor *siv = to_siv(VAR_0);", "if (parse_str(siv, VAR_1, VAR_2) < 0) {", "return;", "}", "siv->cur_range = g_list_first(siv->ranges);", "if (siv->cur_range) {", "Range *r = siv->cur_range->data;", "if (r) {", "siv->cur = r->begin;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
3,337
static int check_arg(const CmdArgs *cmd_args, QDict *args) { QObject *value; const char *name; name = qstring_get_str(cmd_args->name); if (!args) { return check_opt(cmd_args, name, args); } value = qdict_get(args, name); if (!value) { return check_opt(cmd_args, name, args); } switch (cmd_args->type) { case 'F': case 'B': case 's': if (qobject_type(value) != QTYPE_QSTRING) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "string"); return -1; } break; case '/': { int i; const char *keys[] = { "count", "format", "size", NULL }; for (i = 0; keys[i]; i++) { QObject *obj = qdict_get(args, keys[i]); if (!obj) { qerror_report(QERR_MISSING_PARAMETER, name); return -1; } if (qobject_type(obj) != QTYPE_QINT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "int"); return -1; } } break; } case 'i': case 'l': case 'M': if (qobject_type(value) != QTYPE_QINT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "int"); return -1; } break; case 'f': case 'T': if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QFLOAT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "number"); return -1; } break; case 'b': if (qobject_type(value) != QTYPE_QBOOL) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool"); return -1; } break; case '-': if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QBOOL) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool"); return -1; } break; case 'O': default: /* impossible */ abort(); } return 0; }
false
qemu
f6b4fc8b23b1154577c72937b70e565716bb0a60
static int check_arg(const CmdArgs *cmd_args, QDict *args) { QObject *value; const char *name; name = qstring_get_str(cmd_args->name); if (!args) { return check_opt(cmd_args, name, args); } value = qdict_get(args, name); if (!value) { return check_opt(cmd_args, name, args); } switch (cmd_args->type) { case 'F': case 'B': case 's': if (qobject_type(value) != QTYPE_QSTRING) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "string"); return -1; } break; case '/': { int i; const char *keys[] = { "count", "format", "size", NULL }; for (i = 0; keys[i]; i++) { QObject *obj = qdict_get(args, keys[i]); if (!obj) { qerror_report(QERR_MISSING_PARAMETER, name); return -1; } if (qobject_type(obj) != QTYPE_QINT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "int"); return -1; } } break; } case 'i': case 'l': case 'M': if (qobject_type(value) != QTYPE_QINT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "int"); return -1; } break; case 'f': case 'T': if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QFLOAT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "number"); return -1; } break; case 'b': if (qobject_type(value) != QTYPE_QBOOL) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool"); return -1; } break; case '-': if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QBOOL) { qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool"); return -1; } break; case 'O': default: abort(); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(const CmdArgs *VAR_0, QDict *VAR_1) { QObject *value; const char *VAR_2; VAR_2 = qstring_get_str(VAR_0->VAR_2); if (!VAR_1) { return check_opt(VAR_0, VAR_2, VAR_1); } value = qdict_get(VAR_1, VAR_2); if (!value) { return check_opt(VAR_0, VAR_2, VAR_1); } switch (VAR_0->type) { case 'F': case 'B': case 's': if (qobject_type(value) != QTYPE_QSTRING) { qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, "string"); return -1; } break; case '/': { int VAR_3; const char *VAR_4[] = { "count", "format", "size", NULL }; for (VAR_3 = 0; VAR_4[VAR_3]; VAR_3++) { QObject *obj = qdict_get(VAR_1, VAR_4[VAR_3]); if (!obj) { qerror_report(QERR_MISSING_PARAMETER, VAR_2); return -1; } if (qobject_type(obj) != QTYPE_QINT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, "int"); return -1; } } break; } case 'VAR_3': case 'l': case 'M': if (qobject_type(value) != QTYPE_QINT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, "int"); return -1; } break; case 'f': case 'T': if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QFLOAT) { qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, "number"); return -1; } break; case 'b': if (qobject_type(value) != QTYPE_QBOOL) { qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, "bool"); return -1; } break; case '-': if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QBOOL) { qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, "bool"); return -1; } break; case 'O': default: abort(); } return 0; }
[ "static int FUNC_0(const CmdArgs *VAR_0, QDict *VAR_1)\n{", "QObject *value;", "const char *VAR_2;", "VAR_2 = qstring_get_str(VAR_0->VAR_2);", "if (!VAR_1) {", "return check_opt(VAR_0, VAR_2, VAR_1);", "}", "value = qdict_get(VAR_1, VAR_2);", "if (!value) {", "return check_opt(VAR_0, VAR_2, VAR_1);", "}", "switch (VAR_0->type) {", "case 'F':\ncase 'B':\ncase 's':\nif (qobject_type(value) != QTYPE_QSTRING) {", "qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, \"string\");", "return -1;", "}", "break;", "case '/': {", "int VAR_3;", "const char *VAR_4[] = { \"count\", \"format\", \"size\", NULL };", "for (VAR_3 = 0; VAR_4[VAR_3]; VAR_3++) {", "QObject *obj = qdict_get(VAR_1, VAR_4[VAR_3]);", "if (!obj) {", "qerror_report(QERR_MISSING_PARAMETER, VAR_2);", "return -1;", "}", "if (qobject_type(obj) != QTYPE_QINT) {", "qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, \"int\");", "return -1;", "}", "}", "break;", "}", "case 'VAR_3':\ncase 'l':\ncase 'M':\nif (qobject_type(value) != QTYPE_QINT) {", "qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, \"int\");", "return -1;", "}", "break;", "case 'f':\ncase 'T':\nif (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QFLOAT) {", "qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, \"number\");", "return -1;", "}", "break;", "case 'b':\nif (qobject_type(value) != QTYPE_QBOOL) {", "qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, \"bool\");", "return -1;", "}", "break;", "case '-':\nif (qobject_type(value) != QTYPE_QINT &&\nqobject_type(value) != QTYPE_QBOOL) {", "qerror_report(QERR_INVALID_PARAMETER_TYPE, VAR_2, \"bool\");", "return -1;", "}", "break;", "case 'O':\ndefault:\nabort();", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143, 147 ], [ 149 ], [ 153 ], [ 155 ] ]
3,338
static void blkdebug_refresh_filename(BlockDriverState *bs) { QDict *opts; const QDictEntry *e; bool force_json = false; for (e = qdict_first(bs->options); e; e = qdict_next(bs->options, e)) { if (strcmp(qdict_entry_key(e), "config") && strcmp(qdict_entry_key(e), "x-image") && strcmp(qdict_entry_key(e), "image") && strncmp(qdict_entry_key(e), "image.", strlen("image."))) { force_json = true; break; } } if (force_json && !bs->file->bs->full_open_options) { /* The config file cannot be recreated, so creating a plain filename * is impossible */ return; } if (!force_json && bs->file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkdebug:%s:%s", qdict_get_try_str(bs->options, "config") ?: "", bs->file->bs->exact_filename); } opts = qdict_new(); qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkdebug"))); QINCREF(bs->file->bs->full_open_options); qdict_put_obj(opts, "image", QOBJECT(bs->file->bs->full_open_options)); for (e = qdict_first(bs->options); e; e = qdict_next(bs->options, e)) { if (strcmp(qdict_entry_key(e), "x-image") && strcmp(qdict_entry_key(e), "image") && strncmp(qdict_entry_key(e), "image.", strlen("image."))) { qobject_incref(qdict_entry_value(e)); qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e)); } } bs->full_open_options = opts; }
false
qemu
4cdd01d32ee6fe04f8d909bfd3708be6864873a2
static void blkdebug_refresh_filename(BlockDriverState *bs) { QDict *opts; const QDictEntry *e; bool force_json = false; for (e = qdict_first(bs->options); e; e = qdict_next(bs->options, e)) { if (strcmp(qdict_entry_key(e), "config") && strcmp(qdict_entry_key(e), "x-image") && strcmp(qdict_entry_key(e), "image") && strncmp(qdict_entry_key(e), "image.", strlen("image."))) { force_json = true; break; } } if (force_json && !bs->file->bs->full_open_options) { return; } if (!force_json && bs->file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkdebug:%s:%s", qdict_get_try_str(bs->options, "config") ?: "", bs->file->bs->exact_filename); } opts = qdict_new(); qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkdebug"))); QINCREF(bs->file->bs->full_open_options); qdict_put_obj(opts, "image", QOBJECT(bs->file->bs->full_open_options)); for (e = qdict_first(bs->options); e; e = qdict_next(bs->options, e)) { if (strcmp(qdict_entry_key(e), "x-image") && strcmp(qdict_entry_key(e), "image") && strncmp(qdict_entry_key(e), "image.", strlen("image."))) { qobject_incref(qdict_entry_value(e)); qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e)); } } bs->full_open_options = opts; }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0) { QDict *opts; const QDictEntry *VAR_1; bool force_json = false; for (VAR_1 = qdict_first(VAR_0->options); VAR_1; VAR_1 = qdict_next(VAR_0->options, VAR_1)) { if (strcmp(qdict_entry_key(VAR_1), "config") && strcmp(qdict_entry_key(VAR_1), "x-image") && strcmp(qdict_entry_key(VAR_1), "image") && strncmp(qdict_entry_key(VAR_1), "image.", strlen("image."))) { force_json = true; break; } } if (force_json && !VAR_0->file->VAR_0->full_open_options) { return; } if (!force_json && VAR_0->file->VAR_0->exact_filename[0]) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "blkdebug:%s:%s", qdict_get_try_str(VAR_0->options, "config") ?: "", VAR_0->file->VAR_0->exact_filename); } opts = qdict_new(); qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkdebug"))); QINCREF(VAR_0->file->VAR_0->full_open_options); qdict_put_obj(opts, "image", QOBJECT(VAR_0->file->VAR_0->full_open_options)); for (VAR_1 = qdict_first(VAR_0->options); VAR_1; VAR_1 = qdict_next(VAR_0->options, VAR_1)) { if (strcmp(qdict_entry_key(VAR_1), "x-image") && strcmp(qdict_entry_key(VAR_1), "image") && strncmp(qdict_entry_key(VAR_1), "image.", strlen("image."))) { qobject_incref(qdict_entry_value(VAR_1)); qdict_put_obj(opts, qdict_entry_key(VAR_1), qdict_entry_value(VAR_1)); } } VAR_0->full_open_options = opts; }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "QDict *opts;", "const QDictEntry *VAR_1;", "bool force_json = false;", "for (VAR_1 = qdict_first(VAR_0->options); VAR_1; VAR_1 = qdict_next(VAR_0->options, VAR_1)) {", "if (strcmp(qdict_entry_key(VAR_1), \"config\") &&\nstrcmp(qdict_entry_key(VAR_1), \"x-image\") &&\nstrcmp(qdict_entry_key(VAR_1), \"image\") &&\nstrncmp(qdict_entry_key(VAR_1), \"image.\", strlen(\"image.\")))\n{", "force_json = true;", "break;", "}", "}", "if (force_json && !VAR_0->file->VAR_0->full_open_options) {", "return;", "}", "if (!force_json && VAR_0->file->VAR_0->exact_filename[0]) {", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"blkdebug:%s:%s\",\nqdict_get_try_str(VAR_0->options, \"config\") ?: \"\",\nVAR_0->file->VAR_0->exact_filename);", "}", "opts = qdict_new();", "qdict_put_obj(opts, \"driver\", QOBJECT(qstring_from_str(\"blkdebug\")));", "QINCREF(VAR_0->file->VAR_0->full_open_options);", "qdict_put_obj(opts, \"image\", QOBJECT(VAR_0->file->VAR_0->full_open_options));", "for (VAR_1 = qdict_first(VAR_0->options); VAR_1; VAR_1 = qdict_next(VAR_0->options, VAR_1)) {", "if (strcmp(qdict_entry_key(VAR_1), \"x-image\") &&\nstrcmp(qdict_entry_key(VAR_1), \"image\") &&\nstrncmp(qdict_entry_key(VAR_1), \"image.\", strlen(\"image.\")))\n{", "qobject_incref(qdict_entry_value(VAR_1));", "qdict_put_obj(opts, qdict_entry_key(VAR_1), qdict_entry_value(VAR_1));", "}", "}", "VAR_0->full_open_options = opts;", "}" ]
[ 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51, 53, 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75, 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
3,340
static void memory_region_initfn(Object *obj) { MemoryRegion *mr = MEMORY_REGION(obj); ObjectProperty *op; mr->ops = &unassigned_mem_ops; mr->enabled = true; mr->romd_mode = true; mr->global_locking = true; mr->destructor = memory_region_destructor_none; QTAILQ_INIT(&mr->subregions); QTAILQ_INIT(&mr->coalesced); op = object_property_add(OBJECT(mr), "container", "link<" TYPE_MEMORY_REGION ">", memory_region_get_container, NULL, /* memory_region_set_container */ NULL, NULL, &error_abort); op->resolve = memory_region_resolve_container; object_property_add(OBJECT(mr), "addr", "uint64", memory_region_get_addr, NULL, /* memory_region_set_addr */ NULL, NULL, &error_abort); object_property_add(OBJECT(mr), "priority", "uint32", memory_region_get_priority, NULL, /* memory_region_set_priority */ NULL, NULL, &error_abort); object_property_add_bool(OBJECT(mr), "may-overlap", memory_region_get_may_overlap, NULL, /* memory_region_set_may_overlap */ &error_abort); object_property_add(OBJECT(mr), "size", "uint64", memory_region_get_size, NULL, /* memory_region_set_size, */ NULL, NULL, &error_abort); }
false
qemu
b61359781958759317ee6fd1a45b59be0b7dbbe1
static void memory_region_initfn(Object *obj) { MemoryRegion *mr = MEMORY_REGION(obj); ObjectProperty *op; mr->ops = &unassigned_mem_ops; mr->enabled = true; mr->romd_mode = true; mr->global_locking = true; mr->destructor = memory_region_destructor_none; QTAILQ_INIT(&mr->subregions); QTAILQ_INIT(&mr->coalesced); op = object_property_add(OBJECT(mr), "container", "link<" TYPE_MEMORY_REGION ">", memory_region_get_container, NULL, NULL, NULL, &error_abort); op->resolve = memory_region_resolve_container; object_property_add(OBJECT(mr), "addr", "uint64", memory_region_get_addr, NULL, NULL, NULL, &error_abort); object_property_add(OBJECT(mr), "priority", "uint32", memory_region_get_priority, NULL, NULL, NULL, &error_abort); object_property_add_bool(OBJECT(mr), "may-overlap", memory_region_get_may_overlap, NULL, &error_abort); object_property_add(OBJECT(mr), "size", "uint64", memory_region_get_size, NULL, NULL, NULL, &error_abort); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { MemoryRegion *mr = MEMORY_REGION(VAR_0); ObjectProperty *op; mr->ops = &unassigned_mem_ops; mr->enabled = true; mr->romd_mode = true; mr->global_locking = true; mr->destructor = memory_region_destructor_none; QTAILQ_INIT(&mr->subregions); QTAILQ_INIT(&mr->coalesced); op = object_property_add(OBJECT(mr), "container", "link<" TYPE_MEMORY_REGION ">", memory_region_get_container, NULL, NULL, NULL, &error_abort); op->resolve = memory_region_resolve_container; object_property_add(OBJECT(mr), "addr", "uint64", memory_region_get_addr, NULL, NULL, NULL, &error_abort); object_property_add(OBJECT(mr), "priority", "uint32", memory_region_get_priority, NULL, NULL, NULL, &error_abort); object_property_add_bool(OBJECT(mr), "may-overlap", memory_region_get_may_overlap, NULL, &error_abort); object_property_add(OBJECT(mr), "size", "uint64", memory_region_get_size, NULL, NULL, NULL, &error_abort); }
[ "static void FUNC_0(Object *VAR_0)\n{", "MemoryRegion *mr = MEMORY_REGION(VAR_0);", "ObjectProperty *op;", "mr->ops = &unassigned_mem_ops;", "mr->enabled = true;", "mr->romd_mode = true;", "mr->global_locking = true;", "mr->destructor = memory_region_destructor_none;", "QTAILQ_INIT(&mr->subregions);", "QTAILQ_INIT(&mr->coalesced);", "op = object_property_add(OBJECT(mr), \"container\",\n\"link<\" TYPE_MEMORY_REGION \">\",\nmemory_region_get_container,\nNULL,\nNULL, NULL, &error_abort);", "op->resolve = memory_region_resolve_container;", "object_property_add(OBJECT(mr), \"addr\", \"uint64\",\nmemory_region_get_addr,\nNULL,\nNULL, NULL, &error_abort);", "object_property_add(OBJECT(mr), \"priority\", \"uint32\",\nmemory_region_get_priority,\nNULL,\nNULL, NULL, &error_abort);", "object_property_add_bool(OBJECT(mr), \"may-overlap\",\nmemory_region_get_may_overlap,\nNULL,\n&error_abort);", "object_property_add(OBJECT(mr), \"size\", \"uint64\",\nmemory_region_get_size,\nNULL,\nNULL, NULL, &error_abort);", "}" ]
[ 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 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 41, 43, 45, 47 ], [ 49, 51, 53, 55 ], [ 57, 59, 61, 63 ], [ 65, 67, 69, 71 ], [ 73 ] ]
3,341
static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb) { CURLState *state; int running; BDRVCURLState *s = bs->opaque; uint64_t start = acb->offset; uint64_t end; qemu_mutex_lock(&s->mutex); // In case we have the requested data already (e.g. read-ahead), // we can just call the callback and be done. if (curl_find_buf(s, start, acb->bytes, acb)) { goto out; } // No cache found, so let's start a new request for (;;) { state = curl_find_state(s); if (state) { break; } qemu_mutex_unlock(&s->mutex); aio_poll(bdrv_get_aio_context(bs), true); qemu_mutex_lock(&s->mutex); } if (curl_init_state(s, state) < 0) { curl_clean_state(state); acb->ret = -EIO; goto out; } acb->start = 0; acb->end = MIN(acb->bytes, s->len - start); state->buf_off = 0; g_free(state->orig_buf); state->buf_start = start; state->buf_len = MIN(acb->end + s->readahead_size, s->len - start); end = start + state->buf_len - 1; state->orig_buf = g_try_malloc(state->buf_len); if (state->buf_len && state->orig_buf == NULL) { curl_clean_state(state); acb->ret = -ENOMEM; goto out; } state->acb[0] = acb; snprintf(state->range, 127, "%" PRIu64 "-%" PRIu64, start, end); DPRINTF("CURL (AIO): Reading %" PRIu64 " at %" PRIu64 " (%s)\n", acb->bytes, start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); curl_multi_add_handle(s->multi, state->curl); /* Tell curl it needs to kick things off */ curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); out: qemu_mutex_unlock(&s->mutex); }
false
qemu
2bb5c936c5827e1d831002f7a7517cb8c2c2201d
static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb) { CURLState *state; int running; BDRVCURLState *s = bs->opaque; uint64_t start = acb->offset; uint64_t end; qemu_mutex_lock(&s->mutex); if (curl_find_buf(s, start, acb->bytes, acb)) { goto out; } for (;;) { state = curl_find_state(s); if (state) { break; } qemu_mutex_unlock(&s->mutex); aio_poll(bdrv_get_aio_context(bs), true); qemu_mutex_lock(&s->mutex); } if (curl_init_state(s, state) < 0) { curl_clean_state(state); acb->ret = -EIO; goto out; } acb->start = 0; acb->end = MIN(acb->bytes, s->len - start); state->buf_off = 0; g_free(state->orig_buf); state->buf_start = start; state->buf_len = MIN(acb->end + s->readahead_size, s->len - start); end = start + state->buf_len - 1; state->orig_buf = g_try_malloc(state->buf_len); if (state->buf_len && state->orig_buf == NULL) { curl_clean_state(state); acb->ret = -ENOMEM; goto out; } state->acb[0] = acb; snprintf(state->range, 127, "%" PRIu64 "-%" PRIu64, start, end); DPRINTF("CURL (AIO): Reading %" PRIu64 " at %" PRIu64 " (%s)\n", acb->bytes, start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); curl_multi_add_handle(s->multi, state->curl); curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running); out: qemu_mutex_unlock(&s->mutex); }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, CURLAIOCB *VAR_1) { CURLState *state; int VAR_2; BDRVCURLState *s = VAR_0->opaque; uint64_t start = VAR_1->offset; uint64_t end; qemu_mutex_lock(&s->mutex); if (curl_find_buf(s, start, VAR_1->bytes, VAR_1)) { goto out; } for (;;) { state = curl_find_state(s); if (state) { break; } qemu_mutex_unlock(&s->mutex); aio_poll(bdrv_get_aio_context(VAR_0), true); qemu_mutex_lock(&s->mutex); } if (curl_init_state(s, state) < 0) { curl_clean_state(state); VAR_1->ret = -EIO; goto out; } VAR_1->start = 0; VAR_1->end = MIN(VAR_1->bytes, s->len - start); state->buf_off = 0; g_free(state->orig_buf); state->buf_start = start; state->buf_len = MIN(VAR_1->end + s->readahead_size, s->len - start); end = start + state->buf_len - 1; state->orig_buf = g_try_malloc(state->buf_len); if (state->buf_len && state->orig_buf == NULL) { curl_clean_state(state); VAR_1->ret = -ENOMEM; goto out; } state->VAR_1[0] = VAR_1; snprintf(state->range, 127, "%" PRIu64 "-%" PRIu64, start, end); DPRINTF("CURL (AIO): Reading %" PRIu64 " at %" PRIu64 " (%s)\n", VAR_1->bytes, start, state->range); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); curl_multi_add_handle(s->multi, state->curl); curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &VAR_2); out: qemu_mutex_unlock(&s->mutex); }
[ "static void FUNC_0(BlockDriverState *VAR_0, CURLAIOCB *VAR_1)\n{", "CURLState *state;", "int VAR_2;", "BDRVCURLState *s = VAR_0->opaque;", "uint64_t start = VAR_1->offset;", "uint64_t end;", "qemu_mutex_lock(&s->mutex);", "if (curl_find_buf(s, start, VAR_1->bytes, VAR_1)) {", "goto out;", "}", "for (;;) {", "state = curl_find_state(s);", "if (state) {", "break;", "}", "qemu_mutex_unlock(&s->mutex);", "aio_poll(bdrv_get_aio_context(VAR_0), true);", "qemu_mutex_lock(&s->mutex);", "}", "if (curl_init_state(s, state) < 0) {", "curl_clean_state(state);", "VAR_1->ret = -EIO;", "goto out;", "}", "VAR_1->start = 0;", "VAR_1->end = MIN(VAR_1->bytes, s->len - start);", "state->buf_off = 0;", "g_free(state->orig_buf);", "state->buf_start = start;", "state->buf_len = MIN(VAR_1->end + s->readahead_size, s->len - start);", "end = start + state->buf_len - 1;", "state->orig_buf = g_try_malloc(state->buf_len);", "if (state->buf_len && state->orig_buf == NULL) {", "curl_clean_state(state);", "VAR_1->ret = -ENOMEM;", "goto out;", "}", "state->VAR_1[0] = VAR_1;", "snprintf(state->range, 127, \"%\" PRIu64 \"-%\" PRIu64, start, end);", "DPRINTF(\"CURL (AIO): Reading %\" PRIu64 \" at %\" PRIu64 \" (%s)\\n\",\nVAR_1->bytes, start, state->range);", "curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);", "curl_multi_add_handle(s->multi, state->curl);", "curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &VAR_2);", "out:\nqemu_mutex_unlock(&s->mutex);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 113 ], [ 119 ], [ 123, 125 ], [ 127 ] ]
3,342
static int local_rename(FsContext *ctx, const char *oldpath, const char *newpath) { char *tmp; int err; tmp = qemu_strdup(rpath(ctx, oldpath)); if (tmp == NULL) { return -1; } err = rename(tmp, rpath(ctx, newpath)); if (err == -1) { int serrno = errno; qemu_free(tmp); errno = serrno; } else { qemu_free(tmp); } return err; }
false
qemu
f143efa60c44c65c22aeeb04217f3501e3d04b22
static int local_rename(FsContext *ctx, const char *oldpath, const char *newpath) { char *tmp; int err; tmp = qemu_strdup(rpath(ctx, oldpath)); if (tmp == NULL) { return -1; } err = rename(tmp, rpath(ctx, newpath)); if (err == -1) { int serrno = errno; qemu_free(tmp); errno = serrno; } else { qemu_free(tmp); } return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2) { char *VAR_3; int VAR_4; VAR_3 = qemu_strdup(rpath(VAR_0, VAR_1)); if (VAR_3 == NULL) { return -1; } VAR_4 = rename(VAR_3, rpath(VAR_0, VAR_2)); if (VAR_4 == -1) { int VAR_5 = errno; qemu_free(VAR_3); errno = VAR_5; } else { qemu_free(VAR_3); } return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1,\nconst char *VAR_2)\n{", "char *VAR_3;", "int VAR_4;", "VAR_3 = qemu_strdup(rpath(VAR_0, VAR_1));", "if (VAR_3 == NULL) {", "return -1;", "}", "VAR_4 = rename(VAR_3, rpath(VAR_0, VAR_2));", "if (VAR_4 == -1) {", "int VAR_5 = errno;", "qemu_free(VAR_3);", "errno = VAR_5;", "} else {", "qemu_free(VAR_3);", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ] ]
3,343
static Visitor *validate_test_init_raw(TestInputVisitorData *data, const char *json_string) { return validate_test_init_internal(data, json_string, NULL); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static Visitor *validate_test_init_raw(TestInputVisitorData *data, const char *json_string) { return validate_test_init_internal(data, json_string, NULL); }
{ "code": [], "line_no": [] }
static Visitor *FUNC_0(TestInputVisitorData *data, const char *json_string) { return validate_test_init_internal(data, json_string, NULL); }
[ "static Visitor *FUNC_0(TestInputVisitorData *data,\nconst char *json_string)\n{", "return validate_test_init_internal(data, json_string, NULL);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
3,345
static void gen_compute_branch (DisasContext *ctx, uint32_t opc, int insn_bytes, int rs, int rt, int32_t offset) { target_ulong btgt = -1; int blink = 0; int bcond_compute = 0; TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); if (ctx->hflags & MIPS_HFLAG_BMASK) { #ifdef MIPS_DEBUG_DISAS LOG_DISAS("Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", ctx->pc); #endif generate_exception(ctx, EXCP_RI); goto out; } /* Load needed operands */ switch (opc) { case OPC_BEQ: case OPC_BEQL: case OPC_BNE: case OPC_BNEL: /* Compare two registers */ if (rs != rt) { gen_load_gpr(t0, rs); gen_load_gpr(t1, rt); bcond_compute = 1; } btgt = ctx->pc + insn_bytes + offset; break; case OPC_BGEZ: case OPC_BGEZAL: case OPC_BGEZALL: case OPC_BGEZL: case OPC_BGTZ: case OPC_BGTZL: case OPC_BLEZ: case OPC_BLEZL: case OPC_BLTZ: case OPC_BLTZAL: case OPC_BLTZALL: case OPC_BLTZL: /* Compare to zero */ if (rs != 0) { gen_load_gpr(t0, rs); bcond_compute = 1; } btgt = ctx->pc + insn_bytes + offset; break; case OPC_J: case OPC_JAL: case OPC_JALX: /* Jump to immediate */ btgt = ((ctx->pc + insn_bytes) & (int32_t)0xF0000000) | (uint32_t)offset; break; case OPC_JR: case OPC_JALR: case OPC_JALRC: /* Jump to register */ if (offset != 0 && offset != 16) { /* Hint = 0 is JR/JALR, hint 16 is JR.HB/JALR.HB, the others are reserved. */ MIPS_INVAL("jump hint"); generate_exception(ctx, EXCP_RI); goto out; } gen_load_gpr(btarget, rs); break; default: MIPS_INVAL("branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } if (bcond_compute == 0) { /* No condition to be computed */ switch (opc) { case OPC_BEQ: /* rx == rx */ case OPC_BEQL: /* rx == rx likely */ case OPC_BGEZ: /* 0 >= 0 */ case OPC_BGEZL: /* 0 >= 0 likely */ case OPC_BLEZ: /* 0 <= 0 */ case OPC_BLEZL: /* 0 <= 0 likely */ /* Always take */ ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways"); break; case OPC_BGEZAL: /* 0 >= 0 */ case OPC_BGEZALL: /* 0 >= 0 likely */ /* Always take and link */ blink = 31; ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways and link"); break; case OPC_BNE: /* rx != rx */ case OPC_BGTZ: /* 0 > 0 */ case OPC_BLTZ: /* 0 < 0 */ /* Treat as NOP. */ MIPS_DEBUG("bnever (NOP)"); goto out; case OPC_BLTZAL: /* 0 < 0 */ tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 8); MIPS_DEBUG("bnever and link"); goto out; case OPC_BLTZALL: /* 0 < 0 likely */ tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 8); /* Skip the instruction in the delay slot */ MIPS_DEBUG("bnever, link and skip"); ctx->pc += 4; goto out; case OPC_BNEL: /* rx != rx likely */ case OPC_BGTZL: /* 0 > 0 likely */ case OPC_BLTZL: /* 0 < 0 likely */ /* Skip the instruction in the delay slot */ MIPS_DEBUG("bnever and skip"); ctx->pc += 4; goto out; case OPC_J: ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("j " TARGET_FMT_lx, btgt); break; case OPC_JALX: ctx->hflags |= MIPS_HFLAG_BX; /* Fallthrough */ case OPC_JAL: blink = 31; ctx->hflags |= MIPS_HFLAG_B; ctx->hflags |= (ctx->hflags & MIPS_HFLAG_M16 ? MIPS_HFLAG_BDS16 : MIPS_HFLAG_BDS32); MIPS_DEBUG("jal " TARGET_FMT_lx, btgt); break; case OPC_JR: ctx->hflags |= MIPS_HFLAG_BR; if (ctx->hflags & MIPS_HFLAG_M16) ctx->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jr %s", regnames[rs]); break; case OPC_JALR: case OPC_JALRC: blink = rt; ctx->hflags |= MIPS_HFLAG_BR; if (ctx->hflags & MIPS_HFLAG_M16) ctx->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jalr %s, %s", regnames[rt], regnames[rs]); break; default: MIPS_INVAL("branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } } else { switch (opc) { case OPC_BEQ: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beq %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto not_likely; case OPC_BEQL: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beql %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto likely; case OPC_BNE: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bne %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto not_likely; case OPC_BNEL: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bnel %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto likely; case OPC_BGEZ: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgez %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BGEZL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BGEZAL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezal %s, " TARGET_FMT_lx, regnames[rs], btgt); blink = 31; goto not_likely; case OPC_BGEZALL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); blink = 31; MIPS_DEBUG("bgezall %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BGTZ: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtz %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BGTZL: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtzl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLEZ: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blez %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BLEZL: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blezl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLTZ: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltz %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BLTZL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltzl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLTZAL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); blink = 31; MIPS_DEBUG("bltzal %s, " TARGET_FMT_lx, regnames[rs], btgt); not_likely: ctx->hflags |= MIPS_HFLAG_BC; break; case OPC_BLTZALL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); blink = 31; MIPS_DEBUG("bltzall %s, " TARGET_FMT_lx, regnames[rs], btgt); likely: ctx->hflags |= MIPS_HFLAG_BL; break; default: MIPS_INVAL("conditional branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } } MIPS_DEBUG("enter ds: link %d cond %02x target " TARGET_FMT_lx, blink, ctx->hflags, btgt); ctx->btarget = btgt; if (blink > 0) { int post_delay = insn_bytes; int lowbit = !!(ctx->hflags & MIPS_HFLAG_M16); if (opc != OPC_JALRC) post_delay += ((ctx->hflags & MIPS_HFLAG_BDS16) ? 2 : 4); tcg_gen_movi_tl(cpu_gpr[blink], ctx->pc + post_delay + lowbit); } out: if (insn_bytes == 2) ctx->hflags |= MIPS_HFLAG_B16; tcg_temp_free(t0); tcg_temp_free(t1); }
false
qemu
620e48f66350991918dd78e9a686a9b159fec111
static void gen_compute_branch (DisasContext *ctx, uint32_t opc, int insn_bytes, int rs, int rt, int32_t offset) { target_ulong btgt = -1; int blink = 0; int bcond_compute = 0; TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); if (ctx->hflags & MIPS_HFLAG_BMASK) { #ifdef MIPS_DEBUG_DISAS LOG_DISAS("Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", ctx->pc); #endif generate_exception(ctx, EXCP_RI); goto out; } switch (opc) { case OPC_BEQ: case OPC_BEQL: case OPC_BNE: case OPC_BNEL: if (rs != rt) { gen_load_gpr(t0, rs); gen_load_gpr(t1, rt); bcond_compute = 1; } btgt = ctx->pc + insn_bytes + offset; break; case OPC_BGEZ: case OPC_BGEZAL: case OPC_BGEZALL: case OPC_BGEZL: case OPC_BGTZ: case OPC_BGTZL: case OPC_BLEZ: case OPC_BLEZL: case OPC_BLTZ: case OPC_BLTZAL: case OPC_BLTZALL: case OPC_BLTZL: if (rs != 0) { gen_load_gpr(t0, rs); bcond_compute = 1; } btgt = ctx->pc + insn_bytes + offset; break; case OPC_J: case OPC_JAL: case OPC_JALX: btgt = ((ctx->pc + insn_bytes) & (int32_t)0xF0000000) | (uint32_t)offset; break; case OPC_JR: case OPC_JALR: case OPC_JALRC: if (offset != 0 && offset != 16) { MIPS_INVAL("jump hint"); generate_exception(ctx, EXCP_RI); goto out; } gen_load_gpr(btarget, rs); break; default: MIPS_INVAL("branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } if (bcond_compute == 0) { switch (opc) { case OPC_BEQ: case OPC_BEQL: case OPC_BGEZ: case OPC_BGEZL: case OPC_BLEZ: case OPC_BLEZL: ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways"); break; case OPC_BGEZAL: case OPC_BGEZALL: blink = 31; ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways and link"); break; case OPC_BNE: case OPC_BGTZ: case OPC_BLTZ: MIPS_DEBUG("bnever (NOP)"); goto out; case OPC_BLTZAL: tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 8); MIPS_DEBUG("bnever and link"); goto out; case OPC_BLTZALL: tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 8); MIPS_DEBUG("bnever, link and skip"); ctx->pc += 4; goto out; case OPC_BNEL: case OPC_BGTZL: case OPC_BLTZL: MIPS_DEBUG("bnever and skip"); ctx->pc += 4; goto out; case OPC_J: ctx->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("j " TARGET_FMT_lx, btgt); break; case OPC_JALX: ctx->hflags |= MIPS_HFLAG_BX; case OPC_JAL: blink = 31; ctx->hflags |= MIPS_HFLAG_B; ctx->hflags |= (ctx->hflags & MIPS_HFLAG_M16 ? MIPS_HFLAG_BDS16 : MIPS_HFLAG_BDS32); MIPS_DEBUG("jal " TARGET_FMT_lx, btgt); break; case OPC_JR: ctx->hflags |= MIPS_HFLAG_BR; if (ctx->hflags & MIPS_HFLAG_M16) ctx->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jr %s", regnames[rs]); break; case OPC_JALR: case OPC_JALRC: blink = rt; ctx->hflags |= MIPS_HFLAG_BR; if (ctx->hflags & MIPS_HFLAG_M16) ctx->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jalr %s, %s", regnames[rt], regnames[rs]); break; default: MIPS_INVAL("branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } } else { switch (opc) { case OPC_BEQ: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beq %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto not_likely; case OPC_BEQL: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beql %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto likely; case OPC_BNE: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bne %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto not_likely; case OPC_BNEL: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bnel %s, %s, " TARGET_FMT_lx, regnames[rs], regnames[rt], btgt); goto likely; case OPC_BGEZ: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgez %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BGEZL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BGEZAL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezal %s, " TARGET_FMT_lx, regnames[rs], btgt); blink = 31; goto not_likely; case OPC_BGEZALL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); blink = 31; MIPS_DEBUG("bgezall %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BGTZ: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtz %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BGTZL: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtzl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLEZ: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blez %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BLEZL: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blezl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLTZ: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltz %s, " TARGET_FMT_lx, regnames[rs], btgt); goto not_likely; case OPC_BLTZL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltzl %s, " TARGET_FMT_lx, regnames[rs], btgt); goto likely; case OPC_BLTZAL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); blink = 31; MIPS_DEBUG("bltzal %s, " TARGET_FMT_lx, regnames[rs], btgt); not_likely: ctx->hflags |= MIPS_HFLAG_BC; break; case OPC_BLTZALL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); blink = 31; MIPS_DEBUG("bltzall %s, " TARGET_FMT_lx, regnames[rs], btgt); likely: ctx->hflags |= MIPS_HFLAG_BL; break; default: MIPS_INVAL("conditional branch/jump"); generate_exception(ctx, EXCP_RI); goto out; } } MIPS_DEBUG("enter ds: link %d cond %02x target " TARGET_FMT_lx, blink, ctx->hflags, btgt); ctx->btarget = btgt; if (blink > 0) { int post_delay = insn_bytes; int lowbit = !!(ctx->hflags & MIPS_HFLAG_M16); if (opc != OPC_JALRC) post_delay += ((ctx->hflags & MIPS_HFLAG_BDS16) ? 2 : 4); tcg_gen_movi_tl(cpu_gpr[blink], ctx->pc + post_delay + lowbit); } out: if (insn_bytes == 2) ctx->hflags |= MIPS_HFLAG_B16; tcg_temp_free(t0); tcg_temp_free(t1); }
{ "code": [], "line_no": [] }
static void FUNC_0 (DisasContext *VAR_0, uint32_t VAR_1, int VAR_2, int VAR_3, int VAR_4, int32_t VAR_5) { target_ulong btgt = -1; int VAR_6 = 0; int VAR_7 = 0; TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); if (VAR_0->hflags & MIPS_HFLAG_BMASK) { #ifdef MIPS_DEBUG_DISAS LOG_DISAS("Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", VAR_0->pc); #endif generate_exception(VAR_0, EXCP_RI); goto out; } switch (VAR_1) { case OPC_BEQ: case OPC_BEQL: case OPC_BNE: case OPC_BNEL: if (VAR_3 != VAR_4) { gen_load_gpr(t0, VAR_3); gen_load_gpr(t1, VAR_4); VAR_7 = 1; } btgt = VAR_0->pc + VAR_2 + VAR_5; break; case OPC_BGEZ: case OPC_BGEZAL: case OPC_BGEZALL: case OPC_BGEZL: case OPC_BGTZ: case OPC_BGTZL: case OPC_BLEZ: case OPC_BLEZL: case OPC_BLTZ: case OPC_BLTZAL: case OPC_BLTZALL: case OPC_BLTZL: if (VAR_3 != 0) { gen_load_gpr(t0, VAR_3); VAR_7 = 1; } btgt = VAR_0->pc + VAR_2 + VAR_5; break; case OPC_J: case OPC_JAL: case OPC_JALX: btgt = ((VAR_0->pc + VAR_2) & (int32_t)0xF0000000) | (uint32_t)VAR_5; break; case OPC_JR: case OPC_JALR: case OPC_JALRC: if (VAR_5 != 0 && VAR_5 != 16) { MIPS_INVAL("jump hint"); generate_exception(VAR_0, EXCP_RI); goto out; } gen_load_gpr(btarget, VAR_3); break; default: MIPS_INVAL("branch/jump"); generate_exception(VAR_0, EXCP_RI); goto out; } if (VAR_7 == 0) { switch (VAR_1) { case OPC_BEQ: case OPC_BEQL: case OPC_BGEZ: case OPC_BGEZL: case OPC_BLEZ: case OPC_BLEZL: VAR_0->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways"); break; case OPC_BGEZAL: case OPC_BGEZALL: VAR_6 = 31; VAR_0->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("balways and link"); break; case OPC_BNE: case OPC_BGTZ: case OPC_BLTZ: MIPS_DEBUG("bnever (NOP)"); goto out; case OPC_BLTZAL: tcg_gen_movi_tl(cpu_gpr[31], VAR_0->pc + 8); MIPS_DEBUG("bnever and link"); goto out; case OPC_BLTZALL: tcg_gen_movi_tl(cpu_gpr[31], VAR_0->pc + 8); MIPS_DEBUG("bnever, link and skip"); VAR_0->pc += 4; goto out; case OPC_BNEL: case OPC_BGTZL: case OPC_BLTZL: MIPS_DEBUG("bnever and skip"); VAR_0->pc += 4; goto out; case OPC_J: VAR_0->hflags |= MIPS_HFLAG_B; MIPS_DEBUG("j " TARGET_FMT_lx, btgt); break; case OPC_JALX: VAR_0->hflags |= MIPS_HFLAG_BX; case OPC_JAL: VAR_6 = 31; VAR_0->hflags |= MIPS_HFLAG_B; VAR_0->hflags |= (VAR_0->hflags & MIPS_HFLAG_M16 ? MIPS_HFLAG_BDS16 : MIPS_HFLAG_BDS32); MIPS_DEBUG("jal " TARGET_FMT_lx, btgt); break; case OPC_JR: VAR_0->hflags |= MIPS_HFLAG_BR; if (VAR_0->hflags & MIPS_HFLAG_M16) VAR_0->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jr %s", regnames[VAR_3]); break; case OPC_JALR: case OPC_JALRC: VAR_6 = VAR_4; VAR_0->hflags |= MIPS_HFLAG_BR; if (VAR_0->hflags & MIPS_HFLAG_M16) VAR_0->hflags |= MIPS_HFLAG_BDS16; MIPS_DEBUG("jalr %s, %s", regnames[VAR_4], regnames[VAR_3]); break; default: MIPS_INVAL("branch/jump"); generate_exception(VAR_0, EXCP_RI); goto out; } } else { switch (VAR_1) { case OPC_BEQ: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beq %s, %s, " TARGET_FMT_lx, regnames[VAR_3], regnames[VAR_4], btgt); goto not_likely; case OPC_BEQL: tcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1); MIPS_DEBUG("beql %s, %s, " TARGET_FMT_lx, regnames[VAR_3], regnames[VAR_4], btgt); goto likely; case OPC_BNE: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bne %s, %s, " TARGET_FMT_lx, regnames[VAR_3], regnames[VAR_4], btgt); goto not_likely; case OPC_BNEL: tcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1); MIPS_DEBUG("bnel %s, %s, " TARGET_FMT_lx, regnames[VAR_3], regnames[VAR_4], btgt); goto likely; case OPC_BGEZ: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgez %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto not_likely; case OPC_BGEZL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezl %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto likely; case OPC_BGEZAL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); MIPS_DEBUG("bgezal %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); VAR_6 = 31; goto not_likely; case OPC_BGEZALL: tcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0); VAR_6 = 31; MIPS_DEBUG("bgezall %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto likely; case OPC_BGTZ: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtz %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto not_likely; case OPC_BGTZL: tcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0); MIPS_DEBUG("bgtzl %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto likely; case OPC_BLEZ: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blez %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto not_likely; case OPC_BLEZL: tcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0); MIPS_DEBUG("blezl %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto likely; case OPC_BLTZ: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltz %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto not_likely; case OPC_BLTZL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); MIPS_DEBUG("bltzl %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); goto likely; case OPC_BLTZAL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); VAR_6 = 31; MIPS_DEBUG("bltzal %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); not_likely: VAR_0->hflags |= MIPS_HFLAG_BC; break; case OPC_BLTZALL: tcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0); VAR_6 = 31; MIPS_DEBUG("bltzall %s, " TARGET_FMT_lx, regnames[VAR_3], btgt); likely: VAR_0->hflags |= MIPS_HFLAG_BL; break; default: MIPS_INVAL("conditional branch/jump"); generate_exception(VAR_0, EXCP_RI); goto out; } } MIPS_DEBUG("enter ds: link %d cond %02x target " TARGET_FMT_lx, VAR_6, VAR_0->hflags, btgt); VAR_0->btarget = btgt; if (VAR_6 > 0) { int VAR_8 = VAR_2; int VAR_9 = !!(VAR_0->hflags & MIPS_HFLAG_M16); if (VAR_1 != OPC_JALRC) VAR_8 += ((VAR_0->hflags & MIPS_HFLAG_BDS16) ? 2 : 4); tcg_gen_movi_tl(cpu_gpr[VAR_6], VAR_0->pc + VAR_8 + VAR_9); } out: if (VAR_2 == 2) VAR_0->hflags |= MIPS_HFLAG_B16; tcg_temp_free(t0); tcg_temp_free(t1); }
[ "static void FUNC_0 (DisasContext *VAR_0, uint32_t VAR_1,\nint VAR_2,\nint VAR_3, int VAR_4, int32_t VAR_5)\n{", "target_ulong btgt = -1;", "int VAR_6 = 0;", "int VAR_7 = 0;", "TCGv t0 = tcg_temp_new();", "TCGv t1 = tcg_temp_new();", "if (VAR_0->hflags & MIPS_HFLAG_BMASK) {", "#ifdef MIPS_DEBUG_DISAS\nLOG_DISAS(\"Branch in delay slot at PC 0x\" TARGET_FMT_lx \"\\n\", VAR_0->pc);", "#endif\ngenerate_exception(VAR_0, EXCP_RI);", "goto out;", "}", "switch (VAR_1) {", "case OPC_BEQ:\ncase OPC_BEQL:\ncase OPC_BNE:\ncase OPC_BNEL:\nif (VAR_3 != VAR_4) {", "gen_load_gpr(t0, VAR_3);", "gen_load_gpr(t1, VAR_4);", "VAR_7 = 1;", "}", "btgt = VAR_0->pc + VAR_2 + VAR_5;", "break;", "case OPC_BGEZ:\ncase OPC_BGEZAL:\ncase OPC_BGEZALL:\ncase OPC_BGEZL:\ncase OPC_BGTZ:\ncase OPC_BGTZL:\ncase OPC_BLEZ:\ncase OPC_BLEZL:\ncase OPC_BLTZ:\ncase OPC_BLTZAL:\ncase OPC_BLTZALL:\ncase OPC_BLTZL:\nif (VAR_3 != 0) {", "gen_load_gpr(t0, VAR_3);", "VAR_7 = 1;", "}", "btgt = VAR_0->pc + VAR_2 + VAR_5;", "break;", "case OPC_J:\ncase OPC_JAL:\ncase OPC_JALX:\nbtgt = ((VAR_0->pc + VAR_2) & (int32_t)0xF0000000) | (uint32_t)VAR_5;", "break;", "case OPC_JR:\ncase OPC_JALR:\ncase OPC_JALRC:\nif (VAR_5 != 0 && VAR_5 != 16) {", "MIPS_INVAL(\"jump hint\");", "generate_exception(VAR_0, EXCP_RI);", "goto out;", "}", "gen_load_gpr(btarget, VAR_3);", "break;", "default:\nMIPS_INVAL(\"branch/jump\");", "generate_exception(VAR_0, EXCP_RI);", "goto out;", "}", "if (VAR_7 == 0) {", "switch (VAR_1) {", "case OPC_BEQ:\ncase OPC_BEQL:\ncase OPC_BGEZ:\ncase OPC_BGEZL:\ncase OPC_BLEZ:\ncase OPC_BLEZL:\nVAR_0->hflags |= MIPS_HFLAG_B;", "MIPS_DEBUG(\"balways\");", "break;", "case OPC_BGEZAL:\ncase OPC_BGEZALL:\nVAR_6 = 31;", "VAR_0->hflags |= MIPS_HFLAG_B;", "MIPS_DEBUG(\"balways and link\");", "break;", "case OPC_BNE:\ncase OPC_BGTZ:\ncase OPC_BLTZ:\nMIPS_DEBUG(\"bnever (NOP)\");", "goto out;", "case OPC_BLTZAL:\ntcg_gen_movi_tl(cpu_gpr[31], VAR_0->pc + 8);", "MIPS_DEBUG(\"bnever and link\");", "goto out;", "case OPC_BLTZALL:\ntcg_gen_movi_tl(cpu_gpr[31], VAR_0->pc + 8);", "MIPS_DEBUG(\"bnever, link and skip\");", "VAR_0->pc += 4;", "goto out;", "case OPC_BNEL:\ncase OPC_BGTZL:\ncase OPC_BLTZL:\nMIPS_DEBUG(\"bnever and skip\");", "VAR_0->pc += 4;", "goto out;", "case OPC_J:\nVAR_0->hflags |= MIPS_HFLAG_B;", "MIPS_DEBUG(\"j \" TARGET_FMT_lx, btgt);", "break;", "case OPC_JALX:\nVAR_0->hflags |= MIPS_HFLAG_BX;", "case OPC_JAL:\nVAR_6 = 31;", "VAR_0->hflags |= MIPS_HFLAG_B;", "VAR_0->hflags |= (VAR_0->hflags & MIPS_HFLAG_M16\n? MIPS_HFLAG_BDS16\n: MIPS_HFLAG_BDS32);", "MIPS_DEBUG(\"jal \" TARGET_FMT_lx, btgt);", "break;", "case OPC_JR:\nVAR_0->hflags |= MIPS_HFLAG_BR;", "if (VAR_0->hflags & MIPS_HFLAG_M16)\nVAR_0->hflags |= MIPS_HFLAG_BDS16;", "MIPS_DEBUG(\"jr %s\", regnames[VAR_3]);", "break;", "case OPC_JALR:\ncase OPC_JALRC:\nVAR_6 = VAR_4;", "VAR_0->hflags |= MIPS_HFLAG_BR;", "if (VAR_0->hflags & MIPS_HFLAG_M16)\nVAR_0->hflags |= MIPS_HFLAG_BDS16;", "MIPS_DEBUG(\"jalr %s, %s\", regnames[VAR_4], regnames[VAR_3]);", "break;", "default:\nMIPS_INVAL(\"branch/jump\");", "generate_exception(VAR_0, EXCP_RI);", "goto out;", "}", "} else {", "switch (VAR_1) {", "case OPC_BEQ:\ntcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1);", "MIPS_DEBUG(\"beq %s, %s, \" TARGET_FMT_lx,\nregnames[VAR_3], regnames[VAR_4], btgt);", "goto not_likely;", "case OPC_BEQL:\ntcg_gen_setcond_tl(TCG_COND_EQ, bcond, t0, t1);", "MIPS_DEBUG(\"beql %s, %s, \" TARGET_FMT_lx,\nregnames[VAR_3], regnames[VAR_4], btgt);", "goto likely;", "case OPC_BNE:\ntcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1);", "MIPS_DEBUG(\"bne %s, %s, \" TARGET_FMT_lx,\nregnames[VAR_3], regnames[VAR_4], btgt);", "goto not_likely;", "case OPC_BNEL:\ntcg_gen_setcond_tl(TCG_COND_NE, bcond, t0, t1);", "MIPS_DEBUG(\"bnel %s, %s, \" TARGET_FMT_lx,\nregnames[VAR_3], regnames[VAR_4], btgt);", "goto likely;", "case OPC_BGEZ:\ntcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0);", "MIPS_DEBUG(\"bgez %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto not_likely;", "case OPC_BGEZL:\ntcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0);", "MIPS_DEBUG(\"bgezl %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto likely;", "case OPC_BGEZAL:\ntcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0);", "MIPS_DEBUG(\"bgezal %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "VAR_6 = 31;", "goto not_likely;", "case OPC_BGEZALL:\ntcg_gen_setcondi_tl(TCG_COND_GE, bcond, t0, 0);", "VAR_6 = 31;", "MIPS_DEBUG(\"bgezall %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto likely;", "case OPC_BGTZ:\ntcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0);", "MIPS_DEBUG(\"bgtz %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto not_likely;", "case OPC_BGTZL:\ntcg_gen_setcondi_tl(TCG_COND_GT, bcond, t0, 0);", "MIPS_DEBUG(\"bgtzl %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto likely;", "case OPC_BLEZ:\ntcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0);", "MIPS_DEBUG(\"blez %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto not_likely;", "case OPC_BLEZL:\ntcg_gen_setcondi_tl(TCG_COND_LE, bcond, t0, 0);", "MIPS_DEBUG(\"blezl %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto likely;", "case OPC_BLTZ:\ntcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0);", "MIPS_DEBUG(\"bltz %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto not_likely;", "case OPC_BLTZL:\ntcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0);", "MIPS_DEBUG(\"bltzl %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "goto likely;", "case OPC_BLTZAL:\ntcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0);", "VAR_6 = 31;", "MIPS_DEBUG(\"bltzal %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "not_likely:\nVAR_0->hflags |= MIPS_HFLAG_BC;", "break;", "case OPC_BLTZALL:\ntcg_gen_setcondi_tl(TCG_COND_LT, bcond, t0, 0);", "VAR_6 = 31;", "MIPS_DEBUG(\"bltzall %s, \" TARGET_FMT_lx, regnames[VAR_3], btgt);", "likely:\nVAR_0->hflags |= MIPS_HFLAG_BL;", "break;", "default:\nMIPS_INVAL(\"conditional branch/jump\");", "generate_exception(VAR_0, EXCP_RI);", "goto out;", "}", "}", "MIPS_DEBUG(\"enter ds: link %d cond %02x target \" TARGET_FMT_lx,\nVAR_6, VAR_0->hflags, btgt);", "VAR_0->btarget = btgt;", "if (VAR_6 > 0) {", "int VAR_8 = VAR_2;", "int VAR_9 = !!(VAR_0->hflags & MIPS_HFLAG_M16);", "if (VAR_1 != OPC_JALRC)\nVAR_8 += ((VAR_0->hflags & MIPS_HFLAG_BDS16) ? 2 : 4);", "tcg_gen_movi_tl(cpu_gpr[VAR_6], VAR_0->pc + VAR_8 + VAR_9);", "}", "out:\nif (VAR_2 == 2)\nVAR_0->hflags |= MIPS_HFLAG_B16;", "tcg_temp_free(t0);", "tcg_temp_free(t1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41, 43, 45, 47, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105, 107, 111 ], [ 113 ], [ 115, 117, 119, 123 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159, 161, 163, 165, 167, 171 ], [ 173 ], [ 175 ], [ 177, 179, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 193, 195, 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225, 227, 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 251, 253 ], [ 255 ], [ 257, 259, 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279, 281, 283 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309, 311 ], [ 313, 315 ], [ 317 ], [ 319, 321 ], [ 323, 325 ], [ 327 ], [ 329, 331 ], [ 333, 335 ], [ 337 ], [ 339, 341 ], [ 343, 345 ], [ 347 ], [ 349, 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361 ], [ 363 ], [ 365, 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385, 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 401, 403 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 417, 419 ], [ 421 ], [ 423 ], [ 425, 427 ], [ 429 ], [ 431 ], [ 433, 435 ], [ 437 ], [ 439 ], [ 441, 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453 ], [ 455, 457 ], [ 459 ], [ 461, 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473, 475 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 489, 491 ], [ 495 ], [ 497 ], [ 501, 503, 505 ], [ 507 ], [ 509 ], [ 511 ] ]
3,346
static int tak_read_header(AVFormatContext *s) { TAKDemuxContext *tc = s->priv_data; AVIOContext *pb = s->pb; GetBitContext gb; AVStream *st; uint8_t *buffer = NULL; int ret; st = avformat_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_TAK; st->need_parsing = AVSTREAM_PARSE_FULL_RAW; tc->mlast_frame = 0; if (avio_rl32(pb) != MKTAG('t', 'B', 'a', 'K')) { avio_seek(pb, -4, SEEK_CUR); return 0; } while (!url_feof(pb)) { enum TAKMetaDataType type; int size; type = avio_r8(pb) & 0x7f; size = avio_rl24(pb); switch (type) { case TAK_METADATA_STREAMINFO: case TAK_METADATA_LAST_FRAME: case TAK_METADATA_ENCODER: buffer = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!buffer) return AVERROR(ENOMEM); if (avio_read(pb, buffer, size) != size) { av_freep(&buffer); return AVERROR(EIO); } init_get_bits(&gb, buffer, size * 8); break; case TAK_METADATA_MD5: { uint8_t md5[16]; int i; if (size != 19) return AVERROR_INVALIDDATA; avio_read(pb, md5, 16); avio_skip(pb, 3); av_log(s, AV_LOG_VERBOSE, "MD5="); for (i = 0; i < 16; i++) av_log(s, AV_LOG_VERBOSE, "%02x", md5[i]); av_log(s, AV_LOG_VERBOSE, "\n"); break; } case TAK_METADATA_END: { int64_t curpos = avio_tell(pb); if (pb->seekable) { ff_ape_parse_tag(s); avio_seek(pb, curpos, SEEK_SET); } tc->data_end += curpos; return 0; } default: ret = avio_skip(pb, size); if (ret < 0) return ret; } if (type == TAK_METADATA_STREAMINFO) { TAKStreamInfo ti; avpriv_tak_parse_streaminfo(&gb, &ti); if (ti.samples > 0) st->duration = ti.samples; st->codec->bits_per_coded_sample = ti.bps; if (ti.ch_layout) st->codec->channel_layout = ti.ch_layout; st->codec->sample_rate = ti.sample_rate; st->codec->channels = ti.channels; st->start_time = 0; avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); st->codec->extradata = buffer; st->codec->extradata_size = size; buffer = NULL; } else if (type == TAK_METADATA_LAST_FRAME) { if (size != 11) return AVERROR_INVALIDDATA; tc->mlast_frame = 1; tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) + get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS); av_freep(&buffer); } else if (type == TAK_METADATA_ENCODER) { av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n", get_bits_long(&gb, TAK_ENCODER_VERSION_BITS)); av_freep(&buffer); } } return AVERROR_EOF; }
false
FFmpeg
4977e467a50a690a46af5988d568eaab2e5933c7
static int tak_read_header(AVFormatContext *s) { TAKDemuxContext *tc = s->priv_data; AVIOContext *pb = s->pb; GetBitContext gb; AVStream *st; uint8_t *buffer = NULL; int ret; st = avformat_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_TAK; st->need_parsing = AVSTREAM_PARSE_FULL_RAW; tc->mlast_frame = 0; if (avio_rl32(pb) != MKTAG('t', 'B', 'a', 'K')) { avio_seek(pb, -4, SEEK_CUR); return 0; } while (!url_feof(pb)) { enum TAKMetaDataType type; int size; type = avio_r8(pb) & 0x7f; size = avio_rl24(pb); switch (type) { case TAK_METADATA_STREAMINFO: case TAK_METADATA_LAST_FRAME: case TAK_METADATA_ENCODER: buffer = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!buffer) return AVERROR(ENOMEM); if (avio_read(pb, buffer, size) != size) { av_freep(&buffer); return AVERROR(EIO); } init_get_bits(&gb, buffer, size * 8); break; case TAK_METADATA_MD5: { uint8_t md5[16]; int i; if (size != 19) return AVERROR_INVALIDDATA; avio_read(pb, md5, 16); avio_skip(pb, 3); av_log(s, AV_LOG_VERBOSE, "MD5="); for (i = 0; i < 16; i++) av_log(s, AV_LOG_VERBOSE, "%02x", md5[i]); av_log(s, AV_LOG_VERBOSE, "\n"); break; } case TAK_METADATA_END: { int64_t curpos = avio_tell(pb); if (pb->seekable) { ff_ape_parse_tag(s); avio_seek(pb, curpos, SEEK_SET); } tc->data_end += curpos; return 0; } default: ret = avio_skip(pb, size); if (ret < 0) return ret; } if (type == TAK_METADATA_STREAMINFO) { TAKStreamInfo ti; avpriv_tak_parse_streaminfo(&gb, &ti); if (ti.samples > 0) st->duration = ti.samples; st->codec->bits_per_coded_sample = ti.bps; if (ti.ch_layout) st->codec->channel_layout = ti.ch_layout; st->codec->sample_rate = ti.sample_rate; st->codec->channels = ti.channels; st->start_time = 0; avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); st->codec->extradata = buffer; st->codec->extradata_size = size; buffer = NULL; } else if (type == TAK_METADATA_LAST_FRAME) { if (size != 11) return AVERROR_INVALIDDATA; tc->mlast_frame = 1; tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) + get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS); av_freep(&buffer); } else if (type == TAK_METADATA_ENCODER) { av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n", get_bits_long(&gb, TAK_ENCODER_VERSION_BITS)); av_freep(&buffer); } } return AVERROR_EOF; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { TAKDemuxContext *tc = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; GetBitContext gb; AVStream *st; uint8_t *buffer = NULL; int VAR_1; st = avformat_new_stream(VAR_0, 0); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_TAK; st->need_parsing = AVSTREAM_PARSE_FULL_RAW; tc->mlast_frame = 0; if (avio_rl32(pb) != MKTAG('t', 'B', 'a', 'K')) { avio_seek(pb, -4, SEEK_CUR); return 0; } while (!url_feof(pb)) { enum TAKMetaDataType VAR_2; int VAR_3; VAR_2 = avio_r8(pb) & 0x7f; VAR_3 = avio_rl24(pb); switch (VAR_2) { case TAK_METADATA_STREAMINFO: case TAK_METADATA_LAST_FRAME: case TAK_METADATA_ENCODER: buffer = av_malloc(VAR_3 + FF_INPUT_BUFFER_PADDING_SIZE); if (!buffer) return AVERROR(ENOMEM); if (avio_read(pb, buffer, VAR_3) != VAR_3) { av_freep(&buffer); return AVERROR(EIO); } init_get_bits(&gb, buffer, VAR_3 * 8); break; case TAK_METADATA_MD5: { uint8_t md5[16]; int VAR_4; if (VAR_3 != 19) return AVERROR_INVALIDDATA; avio_read(pb, md5, 16); avio_skip(pb, 3); av_log(VAR_0, AV_LOG_VERBOSE, "MD5="); for (VAR_4 = 0; VAR_4 < 16; VAR_4++) av_log(VAR_0, AV_LOG_VERBOSE, "%02x", md5[VAR_4]); av_log(VAR_0, AV_LOG_VERBOSE, "\n"); break; } case TAK_METADATA_END: { int64_t curpos = avio_tell(pb); if (pb->seekable) { ff_ape_parse_tag(VAR_0); avio_seek(pb, curpos, SEEK_SET); } tc->data_end += curpos; return 0; } default: VAR_1 = avio_skip(pb, VAR_3); if (VAR_1 < 0) return VAR_1; } if (VAR_2 == TAK_METADATA_STREAMINFO) { TAKStreamInfo ti; avpriv_tak_parse_streaminfo(&gb, &ti); if (ti.samples > 0) st->duration = ti.samples; st->codec->bits_per_coded_sample = ti.bps; if (ti.ch_layout) st->codec->channel_layout = ti.ch_layout; st->codec->sample_rate = ti.sample_rate; st->codec->channels = ti.channels; st->start_time = 0; avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); st->codec->extradata = buffer; st->codec->extradata_size = VAR_3; buffer = NULL; } else if (VAR_2 == TAK_METADATA_LAST_FRAME) { if (VAR_3 != 11) return AVERROR_INVALIDDATA; tc->mlast_frame = 1; tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) + get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS); av_freep(&buffer); } else if (VAR_2 == TAK_METADATA_ENCODER) { av_log(VAR_0, AV_LOG_VERBOSE, "encoder version: %0X\n", get_bits_long(&gb, TAK_ENCODER_VERSION_BITS)); av_freep(&buffer); } } return AVERROR_EOF; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "TAKDemuxContext *tc = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "GetBitContext gb;", "AVStream *st;", "uint8_t *buffer = NULL;", "int VAR_1;", "st = avformat_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR(ENOMEM);", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->codec_id = AV_CODEC_ID_TAK;", "st->need_parsing = AVSTREAM_PARSE_FULL_RAW;", "tc->mlast_frame = 0;", "if (avio_rl32(pb) != MKTAG('t', 'B', 'a', 'K')) {", "avio_seek(pb, -4, SEEK_CUR);", "return 0;", "}", "while (!url_feof(pb)) {", "enum TAKMetaDataType VAR_2;", "int VAR_3;", "VAR_2 = avio_r8(pb) & 0x7f;", "VAR_3 = avio_rl24(pb);", "switch (VAR_2) {", "case TAK_METADATA_STREAMINFO:\ncase TAK_METADATA_LAST_FRAME:\ncase TAK_METADATA_ENCODER:\nbuffer = av_malloc(VAR_3 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!buffer)\nreturn AVERROR(ENOMEM);", "if (avio_read(pb, buffer, VAR_3) != VAR_3) {", "av_freep(&buffer);", "return AVERROR(EIO);", "}", "init_get_bits(&gb, buffer, VAR_3 * 8);", "break;", "case TAK_METADATA_MD5: {", "uint8_t md5[16];", "int VAR_4;", "if (VAR_3 != 19)\nreturn AVERROR_INVALIDDATA;", "avio_read(pb, md5, 16);", "avio_skip(pb, 3);", "av_log(VAR_0, AV_LOG_VERBOSE, \"MD5=\");", "for (VAR_4 = 0; VAR_4 < 16; VAR_4++)", "av_log(VAR_0, AV_LOG_VERBOSE, \"%02x\", md5[VAR_4]);", "av_log(VAR_0, AV_LOG_VERBOSE, \"\\n\");", "break;", "}", "case TAK_METADATA_END: {", "int64_t curpos = avio_tell(pb);", "if (pb->seekable) {", "ff_ape_parse_tag(VAR_0);", "avio_seek(pb, curpos, SEEK_SET);", "}", "tc->data_end += curpos;", "return 0;", "}", "default:\nVAR_1 = avio_skip(pb, VAR_3);", "if (VAR_1 < 0)\nreturn VAR_1;", "}", "if (VAR_2 == TAK_METADATA_STREAMINFO) {", "TAKStreamInfo ti;", "avpriv_tak_parse_streaminfo(&gb, &ti);", "if (ti.samples > 0)\nst->duration = ti.samples;", "st->codec->bits_per_coded_sample = ti.bps;", "if (ti.ch_layout)\nst->codec->channel_layout = ti.ch_layout;", "st->codec->sample_rate = ti.sample_rate;", "st->codec->channels = ti.channels;", "st->start_time = 0;", "avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);", "st->codec->extradata = buffer;", "st->codec->extradata_size = VAR_3;", "buffer = NULL;", "} else if (VAR_2 == TAK_METADATA_LAST_FRAME) {", "if (VAR_3 != 11)\nreturn AVERROR_INVALIDDATA;", "tc->mlast_frame = 1;", "tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) +\nget_bits(&gb, TAK_LAST_FRAME_SIZE_BITS);", "av_freep(&buffer);", "} else if (VAR_2 == TAK_METADATA_ENCODER) {", "av_log(VAR_0, AV_LOG_VERBOSE, \"encoder version: %0X\\n\",\nget_bits_long(&gb, TAK_ENCODER_VERSION_BITS));", "av_freep(&buffer);", "}", "}", "return AVERROR_EOF;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65, 67, 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145, 147 ], [ 149 ], [ 153 ], [ 155 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ] ]
3,347
int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags) { int64_t target_size, ret, bytes, offset = 0; BlockDriverState *bs = child->bs; int n; /* sectors */ target_size = bdrv_getlength(bs); if (target_size < 0) { return target_size; } for (;;) { bytes = MIN(target_size - offset, BDRV_REQUEST_MAX_BYTES); if (bytes <= 0) { return 0; } ret = bdrv_get_block_status(bs, offset >> BDRV_SECTOR_BITS, bytes >> BDRV_SECTOR_BITS, &n, NULL); if (ret < 0) { error_report("error getting block status at offset %" PRId64 ": %s", offset, strerror(-ret)); return ret; } if (ret & BDRV_BLOCK_ZERO) { offset += n * BDRV_SECTOR_BITS; continue; } ret = bdrv_pwrite_zeroes(child, offset, n * BDRV_SECTOR_SIZE, flags); if (ret < 0) { error_report("error writing zeroes at offset %" PRId64 ": %s", offset, strerror(-ret)); return ret; } offset += n * BDRV_SECTOR_SIZE; } }
false
qemu
237d78f8fc62e62f62246883ecf62e44ed35fb80
int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags) { int64_t target_size, ret, bytes, offset = 0; BlockDriverState *bs = child->bs; int n; target_size = bdrv_getlength(bs); if (target_size < 0) { return target_size; } for (;;) { bytes = MIN(target_size - offset, BDRV_REQUEST_MAX_BYTES); if (bytes <= 0) { return 0; } ret = bdrv_get_block_status(bs, offset >> BDRV_SECTOR_BITS, bytes >> BDRV_SECTOR_BITS, &n, NULL); if (ret < 0) { error_report("error getting block status at offset %" PRId64 ": %s", offset, strerror(-ret)); return ret; } if (ret & BDRV_BLOCK_ZERO) { offset += n * BDRV_SECTOR_BITS; continue; } ret = bdrv_pwrite_zeroes(child, offset, n * BDRV_SECTOR_SIZE, flags); if (ret < 0) { error_report("error writing zeroes at offset %" PRId64 ": %s", offset, strerror(-ret)); return ret; } offset += n * BDRV_SECTOR_SIZE; } }
{ "code": [], "line_no": [] }
int FUNC_0(BdrvChild *VAR_0, BdrvRequestFlags VAR_1) { int64_t target_size, ret, bytes, offset = 0; BlockDriverState *bs = VAR_0->bs; int VAR_2; target_size = bdrv_getlength(bs); if (target_size < 0) { return target_size; } for (;;) { bytes = MIN(target_size - offset, BDRV_REQUEST_MAX_BYTES); if (bytes <= 0) { return 0; } ret = bdrv_get_block_status(bs, offset >> BDRV_SECTOR_BITS, bytes >> BDRV_SECTOR_BITS, &VAR_2, NULL); if (ret < 0) { error_report("error getting block status at offset %" PRId64 ": %s", offset, strerror(-ret)); return ret; } if (ret & BDRV_BLOCK_ZERO) { offset += VAR_2 * BDRV_SECTOR_BITS; continue; } ret = bdrv_pwrite_zeroes(VAR_0, offset, VAR_2 * BDRV_SECTOR_SIZE, VAR_1); if (ret < 0) { error_report("error writing zeroes at offset %" PRId64 ": %s", offset, strerror(-ret)); return ret; } offset += VAR_2 * BDRV_SECTOR_SIZE; } }
[ "int FUNC_0(BdrvChild *VAR_0, BdrvRequestFlags VAR_1)\n{", "int64_t target_size, ret, bytes, offset = 0;", "BlockDriverState *bs = VAR_0->bs;", "int VAR_2;", "target_size = bdrv_getlength(bs);", "if (target_size < 0) {", "return target_size;", "}", "for (;;) {", "bytes = MIN(target_size - offset, BDRV_REQUEST_MAX_BYTES);", "if (bytes <= 0) {", "return 0;", "}", "ret = bdrv_get_block_status(bs, offset >> BDRV_SECTOR_BITS,\nbytes >> BDRV_SECTOR_BITS, &VAR_2, NULL);", "if (ret < 0) {", "error_report(\"error getting block status at offset %\" PRId64 \": %s\",\noffset, strerror(-ret));", "return ret;", "}", "if (ret & BDRV_BLOCK_ZERO) {", "offset += VAR_2 * BDRV_SECTOR_BITS;", "continue;", "}", "ret = bdrv_pwrite_zeroes(VAR_0, offset, VAR_2 * BDRV_SECTOR_SIZE, VAR_1);", "if (ret < 0) {", "error_report(\"error writing zeroes at offset %\" PRId64 \": %s\",\noffset, strerror(-ret));", "return ret;", "}", "offset += VAR_2 * BDRV_SECTOR_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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
3,349
void HELPER(wsr_ibreaka)(uint32_t i, uint32_t v) { if (env->sregs[IBREAKENABLE] & (1 << i) && env->sregs[IBREAKA + i] != v) { tb_invalidate_phys_page_range( env->sregs[IBREAKA + i], env->sregs[IBREAKA + i] + 1, 0); tb_invalidate_phys_page_range(v, v + 1, 0); } env->sregs[IBREAKA + i] = v; }
false
qemu
3d0be8a5c135dadcfbd68ed354007a8cece98849
void HELPER(wsr_ibreaka)(uint32_t i, uint32_t v) { if (env->sregs[IBREAKENABLE] & (1 << i) && env->sregs[IBREAKA + i] != v) { tb_invalidate_phys_page_range( env->sregs[IBREAKA + i], env->sregs[IBREAKA + i] + 1, 0); tb_invalidate_phys_page_range(v, v + 1, 0); } env->sregs[IBREAKA + i] = v; }
{ "code": [], "line_no": [] }
void FUNC_0(wsr_ibreaka)(uint32_t i, uint32_t v) { if (env->sregs[IBREAKENABLE] & (1 << i) && env->sregs[IBREAKA + i] != v) { tb_invalidate_phys_page_range( env->sregs[IBREAKA + i], env->sregs[IBREAKA + i] + 1, 0); tb_invalidate_phys_page_range(v, v + 1, 0); } env->sregs[IBREAKA + i] = v; }
[ "void FUNC_0(wsr_ibreaka)(uint32_t i, uint32_t v)\n{", "if (env->sregs[IBREAKENABLE] & (1 << i) && env->sregs[IBREAKA + i] != v) {", "tb_invalidate_phys_page_range(\nenv->sregs[IBREAKA + i], env->sregs[IBREAKA + i] + 1, 0);", "tb_invalidate_phys_page_range(v, v + 1, 0);", "}", "env->sregs[IBREAKA + i] = v;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
3,350
static unsigned syborg_virtio_get_features(void *opaque) { unsigned ret = 0; ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY); return ret; }
false
qemu
8172539d21a03e982aa7f139ddc1607dc1422045
static unsigned syborg_virtio_get_features(void *opaque) { unsigned ret = 0; ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY); return ret; }
{ "code": [], "line_no": [] }
static unsigned FUNC_0(void *VAR_0) { unsigned VAR_1 = 0; VAR_1 |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY); return VAR_1; }
[ "static unsigned FUNC_0(void *VAR_0)\n{", "unsigned VAR_1 = 0;", "VAR_1 |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
3,351
static int check_strtox_error(const char *p, char *endptr, const char **next, int err) { if (err == 0 && endptr == p) { err = EINVAL; } if (!next && *endptr) { return -EINVAL; } if (next) { *next = endptr; } return -err; }
false
qemu
717adf960933da0650d995f050d457063d591914
static int check_strtox_error(const char *p, char *endptr, const char **next, int err) { if (err == 0 && endptr == p) { err = EINVAL; } if (!next && *endptr) { return -EINVAL; } if (next) { *next = endptr; } return -err; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, char *VAR_1, const char **VAR_2, int VAR_3) { if (VAR_3 == 0 && VAR_1 == VAR_0) { VAR_3 = EINVAL; } if (!VAR_2 && *VAR_1) { return -EINVAL; } if (VAR_2) { *VAR_2 = VAR_1; } return -VAR_3; }
[ "static int FUNC_0(const char *VAR_0, char *VAR_1, const char **VAR_2,\nint VAR_3)\n{", "if (VAR_3 == 0 && VAR_1 == VAR_0) {", "VAR_3 = EINVAL;", "}", "if (!VAR_2 && *VAR_1) {", "return -EINVAL;", "}", "if (VAR_2) {", "*VAR_2 = VAR_1;", "}", "return -VAR_3;", "}" ]
[ 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 ] ]
3,352
void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr) { int hpt_shift; if ((spapr->resize_hpt == SPAPR_RESIZE_HPT_DISABLED) || (spapr->cas_reboot && !spapr_ovec_test(spapr->ov5_cas, OV5_HPT_RESIZE))) { hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size); } else { hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->ram_size); } spapr_reallocate_hpt(spapr, hpt_shift, &error_fatal); if (spapr->vrma_adjust) { spapr->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(spapr)), spapr->htab_shift); } /* We're setting up a hash table, so that means we're not radix */ spapr->patb_entry = 0; }
false
qemu
ee4d9ecc3675af1e68a9c00a8b338641898d613e
void spapr_setup_hpt_and_vrma(sPAPRMachineState *spapr) { int hpt_shift; if ((spapr->resize_hpt == SPAPR_RESIZE_HPT_DISABLED) || (spapr->cas_reboot && !spapr_ovec_test(spapr->ov5_cas, OV5_HPT_RESIZE))) { hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size); } else { hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->ram_size); } spapr_reallocate_hpt(spapr, hpt_shift, &error_fatal); if (spapr->vrma_adjust) { spapr->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(spapr)), spapr->htab_shift); } spapr->patb_entry = 0; }
{ "code": [], "line_no": [] }
void FUNC_0(sPAPRMachineState *VAR_0) { int VAR_1; if ((VAR_0->resize_hpt == SPAPR_RESIZE_HPT_DISABLED) || (VAR_0->cas_reboot && !spapr_ovec_test(VAR_0->ov5_cas, OV5_HPT_RESIZE))) { VAR_1 = spapr_hpt_shift_for_ramsize(MACHINE(VAR_0)->maxram_size); } else { VAR_1 = spapr_hpt_shift_for_ramsize(MACHINE(VAR_0)->ram_size); } spapr_reallocate_hpt(VAR_0, VAR_1, &error_fatal); if (VAR_0->vrma_adjust) { VAR_0->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(VAR_0)), VAR_0->htab_shift); } VAR_0->patb_entry = 0; }
[ "void FUNC_0(sPAPRMachineState *VAR_0)\n{", "int VAR_1;", "if ((VAR_0->resize_hpt == SPAPR_RESIZE_HPT_DISABLED)\n|| (VAR_0->cas_reboot\n&& !spapr_ovec_test(VAR_0->ov5_cas, OV5_HPT_RESIZE))) {", "VAR_1 = spapr_hpt_shift_for_ramsize(MACHINE(VAR_0)->maxram_size);", "} else {", "VAR_1 = spapr_hpt_shift_for_ramsize(MACHINE(VAR_0)->ram_size);", "}", "spapr_reallocate_hpt(VAR_0, VAR_1, &error_fatal);", "if (VAR_0->vrma_adjust) {", "VAR_0->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(VAR_0)),\nVAR_0->htab_shift);", "}", "VAR_0->patb_entry = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 39 ] ]
3,353
static CharDriverState *qmp_chardev_open_udp(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { ChardevUdp *udp = backend->u.udp; ChardevCommon *common = qapi_ChardevUdp_base(udp); QIOChannelSocket *sioc = qio_channel_socket_new(); if (qio_channel_socket_dgram_sync(sioc, udp->local, udp->remote, errp) < 0) { object_unref(OBJECT(sioc)); return NULL; } return qemu_chr_open_udp(sioc, common, errp); }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
static CharDriverState *qmp_chardev_open_udp(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { ChardevUdp *udp = backend->u.udp; ChardevCommon *common = qapi_ChardevUdp_base(udp); QIOChannelSocket *sioc = qio_channel_socket_new(); if (qio_channel_socket_dgram_sync(sioc, udp->local, udp->remote, errp) < 0) { object_unref(OBJECT(sioc)); return NULL; } return qemu_chr_open_udp(sioc, common, errp); }
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { ChardevUdp *udp = backend->u.udp; ChardevCommon *common = qapi_ChardevUdp_base(udp); QIOChannelSocket *sioc = qio_channel_socket_new(); if (qio_channel_socket_dgram_sync(sioc, udp->local, udp->remote, errp) < 0) { object_unref(OBJECT(sioc)); return NULL; } return qemu_chr_open_udp(sioc, common, errp); }
[ "static CharDriverState *FUNC_0(const char *id,\nChardevBackend *backend,\nChardevReturn *ret,\nError **errp)\n{", "ChardevUdp *udp = backend->u.udp;", "ChardevCommon *common = qapi_ChardevUdp_base(udp);", "QIOChannelSocket *sioc = qio_channel_socket_new();", "if (qio_channel_socket_dgram_sync(sioc,\nudp->local, udp->remote,\nerrp) < 0) {", "object_unref(OBJECT(sioc));", "return NULL;", "}", "return qemu_chr_open_udp(sioc, common, errp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
3,354
static inline int vec_reg_offset(int regno, int element, TCGMemOp size) { int offs = offsetof(CPUARMState, vfp.regs[regno * 2]); #ifdef HOST_WORDS_BIGENDIAN /* This is complicated slightly because vfp.regs[2n] is * still the low half and vfp.regs[2n+1] the high half * of the 128 bit vector, even on big endian systems. * Calculate the offset assuming a fully bigendian 128 bits, * then XOR to account for the order of the two 64 bit halves. */ offs += (16 - ((element + 1) * (1 << size))); offs ^= 8; #else offs += element * (1 << size); #endif return offs; }
false
qemu
90e496386fe7fd32c189561f846b7913f95b8cf4
static inline int vec_reg_offset(int regno, int element, TCGMemOp size) { int offs = offsetof(CPUARMState, vfp.regs[regno * 2]); #ifdef HOST_WORDS_BIGENDIAN offs += (16 - ((element + 1) * (1 << size))); offs ^= 8; #else offs += element * (1 << size); #endif return offs; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(int VAR_0, int VAR_1, TCGMemOp VAR_2) { int VAR_3 = offsetof(CPUARMState, vfp.regs[VAR_0 * 2]); #ifdef HOST_WORDS_BIGENDIAN VAR_3 += (16 - ((VAR_1 + 1) * (1 << VAR_2))); VAR_3 ^= 8; #else VAR_3 += VAR_1 * (1 << VAR_2); #endif return VAR_3; }
[ "static inline int FUNC_0(int VAR_0, int VAR_1, TCGMemOp VAR_2)\n{", "int VAR_3 = offsetof(CPUARMState, vfp.regs[VAR_0 * 2]);", "#ifdef HOST_WORDS_BIGENDIAN\nVAR_3 += (16 - ((VAR_1 + 1) * (1 << VAR_2)));", "VAR_3 ^= 8;", "#else\nVAR_3 += VAR_1 * (1 << VAR_2);", "#endif\nreturn VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ] ]
3,355
static void gen_doz(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], l1); tcg_gen_sub_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], 0); gen_set_label(l2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void gen_doz(DisasContext *ctx) { int l1 = gen_new_label(); int l2 = gen_new_label(); tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], l1); tcg_gen_sub_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], 0); gen_set_label(l2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { int VAR_1 = gen_new_label(); int VAR_2 = gen_new_label(); tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)], VAR_1); tcg_gen_sub_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rB(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]); tcg_gen_br(VAR_2); gen_set_label(VAR_1); tcg_gen_movi_tl(cpu_gpr[rD(VAR_0->opcode)], 0); gen_set_label(VAR_2); if (unlikely(Rc(VAR_0->opcode) != 0)) gen_set_Rc0(VAR_0, cpu_gpr[rD(VAR_0->opcode)]); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1 = gen_new_label();", "int VAR_2 = gen_new_label();", "tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)], VAR_1);", "tcg_gen_sub_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rB(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]);", "tcg_gen_br(VAR_2);", "gen_set_label(VAR_1);", "tcg_gen_movi_tl(cpu_gpr[rD(VAR_0->opcode)], 0);", "gen_set_label(VAR_2);", "if (unlikely(Rc(VAR_0->opcode) != 0))\ngen_set_Rc0(VAR_0, cpu_gpr[rD(VAR_0->opcode)]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ] ]
3,357
static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NVENCSTATUS nv_status; NV_ENC_CREATE_BITSTREAM_BUFFER allocOut = { 0 }; allocOut.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER; if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { ctx->surfaces[idx].in_ref = av_frame_alloc(); if (!ctx->surfaces[idx].in_ref) return AVERROR(ENOMEM); } else { NV_ENC_CREATE_INPUT_BUFFER allocSurf = { 0 }; ctx->surfaces[idx].format = nvenc_map_buffer_format(ctx->data_pix_fmt); if (ctx->surfaces[idx].format == NV_ENC_BUFFER_FORMAT_UNDEFINED) { av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format: %s\n", av_get_pix_fmt_name(ctx->data_pix_fmt)); return AVERROR(EINVAL); } allocSurf.version = NV_ENC_CREATE_INPUT_BUFFER_VER; allocSurf.width = (avctx->width + 31) & ~31; allocSurf.height = (avctx->height + 31) & ~31; allocSurf.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED; allocSurf.bufferFmt = ctx->surfaces[idx].format; nv_status = p_nvenc->nvEncCreateInputBuffer(ctx->nvencoder, &allocSurf); if (nv_status != NV_ENC_SUCCESS) { return nvenc_print_error(avctx, nv_status, "CreateInputBuffer failed"); } ctx->surfaces[idx].input_surface = allocSurf.inputBuffer; ctx->surfaces[idx].width = allocSurf.width; ctx->surfaces[idx].height = allocSurf.height; } ctx->surfaces[idx].lockCount = 0; /* 1MB is large enough to hold most output frames. * NVENC increases this automaticaly if it is not enough. */ allocOut.size = 1024 * 1024; allocOut.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED; nv_status = p_nvenc->nvEncCreateBitstreamBuffer(ctx->nvencoder, &allocOut); if (nv_status != NV_ENC_SUCCESS) { int err = nvenc_print_error(avctx, nv_status, "CreateBitstreamBuffer failed"); if (avctx->pix_fmt != AV_PIX_FMT_CUDA) p_nvenc->nvEncDestroyInputBuffer(ctx->nvencoder, ctx->surfaces[idx].input_surface); av_frame_free(&ctx->surfaces[idx].in_ref); return err; } ctx->surfaces[idx].output_surface = allocOut.bitstreamBuffer; ctx->surfaces[idx].size = allocOut.size; return 0; }
false
FFmpeg
8de3458a07376b0a96772e586b6dba5e93432f52
static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NVENCSTATUS nv_status; NV_ENC_CREATE_BITSTREAM_BUFFER allocOut = { 0 }; allocOut.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER; if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { ctx->surfaces[idx].in_ref = av_frame_alloc(); if (!ctx->surfaces[idx].in_ref) return AVERROR(ENOMEM); } else { NV_ENC_CREATE_INPUT_BUFFER allocSurf = { 0 }; ctx->surfaces[idx].format = nvenc_map_buffer_format(ctx->data_pix_fmt); if (ctx->surfaces[idx].format == NV_ENC_BUFFER_FORMAT_UNDEFINED) { av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format: %s\n", av_get_pix_fmt_name(ctx->data_pix_fmt)); return AVERROR(EINVAL); } allocSurf.version = NV_ENC_CREATE_INPUT_BUFFER_VER; allocSurf.width = (avctx->width + 31) & ~31; allocSurf.height = (avctx->height + 31) & ~31; allocSurf.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED; allocSurf.bufferFmt = ctx->surfaces[idx].format; nv_status = p_nvenc->nvEncCreateInputBuffer(ctx->nvencoder, &allocSurf); if (nv_status != NV_ENC_SUCCESS) { return nvenc_print_error(avctx, nv_status, "CreateInputBuffer failed"); } ctx->surfaces[idx].input_surface = allocSurf.inputBuffer; ctx->surfaces[idx].width = allocSurf.width; ctx->surfaces[idx].height = allocSurf.height; } ctx->surfaces[idx].lockCount = 0; allocOut.size = 1024 * 1024; allocOut.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED; nv_status = p_nvenc->nvEncCreateBitstreamBuffer(ctx->nvencoder, &allocOut); if (nv_status != NV_ENC_SUCCESS) { int err = nvenc_print_error(avctx, nv_status, "CreateBitstreamBuffer failed"); if (avctx->pix_fmt != AV_PIX_FMT_CUDA) p_nvenc->nvEncDestroyInputBuffer(ctx->nvencoder, ctx->surfaces[idx].input_surface); av_frame_free(&ctx->surfaces[idx].in_ref); return err; } ctx->surfaces[idx].output_surface = allocOut.bitstreamBuffer; ctx->surfaces[idx].size = allocOut.size; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx, int idx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NVENCSTATUS nv_status; NV_ENC_CREATE_BITSTREAM_BUFFER allocOut = { 0 }; allocOut.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER; if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { ctx->surfaces[idx].in_ref = av_frame_alloc(); if (!ctx->surfaces[idx].in_ref) return AVERROR(ENOMEM); } else { NV_ENC_CREATE_INPUT_BUFFER allocSurf = { 0 }; ctx->surfaces[idx].format = nvenc_map_buffer_format(ctx->data_pix_fmt); if (ctx->surfaces[idx].format == NV_ENC_BUFFER_FORMAT_UNDEFINED) { av_log(avctx, AV_LOG_FATAL, "Invalid input pixel format: %s\n", av_get_pix_fmt_name(ctx->data_pix_fmt)); return AVERROR(EINVAL); } allocSurf.version = NV_ENC_CREATE_INPUT_BUFFER_VER; allocSurf.width = (avctx->width + 31) & ~31; allocSurf.height = (avctx->height + 31) & ~31; allocSurf.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED; allocSurf.bufferFmt = ctx->surfaces[idx].format; nv_status = p_nvenc->nvEncCreateInputBuffer(ctx->nvencoder, &allocSurf); if (nv_status != NV_ENC_SUCCESS) { return nvenc_print_error(avctx, nv_status, "CreateInputBuffer failed"); } ctx->surfaces[idx].input_surface = allocSurf.inputBuffer; ctx->surfaces[idx].width = allocSurf.width; ctx->surfaces[idx].height = allocSurf.height; } ctx->surfaces[idx].lockCount = 0; allocOut.size = 1024 * 1024; allocOut.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED; nv_status = p_nvenc->nvEncCreateBitstreamBuffer(ctx->nvencoder, &allocOut); if (nv_status != NV_ENC_SUCCESS) { int VAR_0 = nvenc_print_error(avctx, nv_status, "CreateBitstreamBuffer failed"); if (avctx->pix_fmt != AV_PIX_FMT_CUDA) p_nvenc->nvEncDestroyInputBuffer(ctx->nvencoder, ctx->surfaces[idx].input_surface); av_frame_free(&ctx->surfaces[idx].in_ref); return VAR_0; } ctx->surfaces[idx].output_surface = allocOut.bitstreamBuffer; ctx->surfaces[idx].size = allocOut.size; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx, int idx)\n{", "NvencContext *ctx = avctx->priv_data;", "NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;", "NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;", "NVENCSTATUS nv_status;", "NV_ENC_CREATE_BITSTREAM_BUFFER allocOut = { 0 };", "allocOut.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER;", "if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {", "ctx->surfaces[idx].in_ref = av_frame_alloc();", "if (!ctx->surfaces[idx].in_ref)\nreturn AVERROR(ENOMEM);", "} else {", "NV_ENC_CREATE_INPUT_BUFFER allocSurf = { 0 };", "ctx->surfaces[idx].format = nvenc_map_buffer_format(ctx->data_pix_fmt);", "if (ctx->surfaces[idx].format == NV_ENC_BUFFER_FORMAT_UNDEFINED) {", "av_log(avctx, AV_LOG_FATAL, \"Invalid input pixel format: %s\\n\",\nav_get_pix_fmt_name(ctx->data_pix_fmt));", "return AVERROR(EINVAL);", "}", "allocSurf.version = NV_ENC_CREATE_INPUT_BUFFER_VER;", "allocSurf.width = (avctx->width + 31) & ~31;", "allocSurf.height = (avctx->height + 31) & ~31;", "allocSurf.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED;", "allocSurf.bufferFmt = ctx->surfaces[idx].format;", "nv_status = p_nvenc->nvEncCreateInputBuffer(ctx->nvencoder, &allocSurf);", "if (nv_status != NV_ENC_SUCCESS) {", "return nvenc_print_error(avctx, nv_status, \"CreateInputBuffer failed\");", "}", "ctx->surfaces[idx].input_surface = allocSurf.inputBuffer;", "ctx->surfaces[idx].width = allocSurf.width;", "ctx->surfaces[idx].height = allocSurf.height;", "}", "ctx->surfaces[idx].lockCount = 0;", "allocOut.size = 1024 * 1024;", "allocOut.memoryHeap = NV_ENC_MEMORY_HEAP_SYSMEM_CACHED;", "nv_status = p_nvenc->nvEncCreateBitstreamBuffer(ctx->nvencoder, &allocOut);", "if (nv_status != NV_ENC_SUCCESS) {", "int VAR_0 = nvenc_print_error(avctx, nv_status, \"CreateBitstreamBuffer failed\");", "if (avctx->pix_fmt != AV_PIX_FMT_CUDA)\np_nvenc->nvEncDestroyInputBuffer(ctx->nvencoder, ctx->surfaces[idx].input_surface);", "av_frame_free(&ctx->surfaces[idx].in_ref);", "return VAR_0;", "}", "ctx->surfaces[idx].output_surface = allocOut.bitstreamBuffer;", "ctx->surfaces[idx].size = allocOut.size;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ] ]
3,358
void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { #if defined(CONFIG_KVM) uint32_t vec[4]; #ifdef __x86_64__ asm volatile("cpuid" : "=a"(vec[0]), "=b"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) : "0"(function), "c"(count) : "cc"); #else asm volatile("pusha \n\t" "cpuid \n\t" "mov %%eax, 0(%2) \n\t" "mov %%ebx, 4(%2) \n\t" "mov %%ecx, 8(%2) \n\t" "mov %%edx, 12(%2) \n\t" "popa" : : "a"(function), "c"(count), "S"(vec) : "memory", "cc"); #endif if (eax) *eax = vec[0]; if (ebx) *ebx = vec[1]; if (ecx) *ecx = vec[2]; if (edx) *edx = vec[3]; #endif }
false
qemu
c1f412260b4e0f309dba8da99482fb32d6098719
void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { #if defined(CONFIG_KVM) uint32_t vec[4]; #ifdef __x86_64__ asm volatile("cpuid" : "=a"(vec[0]), "=b"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) : "0"(function), "c"(count) : "cc"); #else asm volatile("pusha \n\t" "cpuid \n\t" "mov %%eax, 0(%2) \n\t" "mov %%ebx, 4(%2) \n\t" "mov %%ecx, 8(%2) \n\t" "mov %%edx, 12(%2) \n\t" "popa" : : "a"(function), "c"(count), "S"(vec) : "memory", "cc"); #endif if (eax) *eax = vec[0]; if (ebx) *ebx = vec[1]; if (ecx) *ecx = vec[2]; if (edx) *edx = vec[3]; #endif }
{ "code": [], "line_no": [] }
void FUNC_0(uint32_t VAR_0, uint32_t VAR_1, uint32_t *VAR_2, uint32_t *VAR_3, uint32_t *VAR_4, uint32_t *VAR_5) { #if defined(CONFIG_KVM) uint32_t vec[4]; #ifdef __x86_64__ asm volatile("cpuid" : "=a"(vec[0]), "=b"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) : "0"(VAR_0), "c"(VAR_1) : "cc"); #else asm volatile("pusha \n\t" "cpuid \n\t" "mov %%VAR_2, 0(%2) \n\t" "mov %%VAR_3, 4(%2) \n\t" "mov %%VAR_4, 8(%2) \n\t" "mov %%VAR_5, 12(%2) \n\t" "popa" : : "a"(VAR_0), "c"(VAR_1), "S"(vec) : "memory", "cc"); #endif if (VAR_2) *VAR_2 = vec[0]; if (VAR_3) *VAR_3 = vec[1]; if (VAR_4) *VAR_4 = vec[2]; if (VAR_5) *VAR_5 = vec[3]; #endif }
[ "void FUNC_0(uint32_t VAR_0, uint32_t VAR_1,\nuint32_t *VAR_2, uint32_t *VAR_3, uint32_t *VAR_4, uint32_t *VAR_5)\n{", "#if defined(CONFIG_KVM)\nuint32_t vec[4];", "#ifdef __x86_64__\nasm volatile(\"cpuid\"\n: \"=a\"(vec[0]), \"=b\"(vec[1]),\n\"=c\"(vec[2]), \"=d\"(vec[3])\n: \"0\"(VAR_0), \"c\"(VAR_1) : \"cc\");", "#else\nasm volatile(\"pusha \\n\\t\"\n\"cpuid \\n\\t\"\n\"mov %%VAR_2, 0(%2) \\n\\t\"\n\"mov %%VAR_3, 4(%2) \\n\\t\"\n\"mov %%VAR_4, 8(%2) \\n\\t\"\n\"mov %%VAR_5, 12(%2) \\n\\t\"\n\"popa\"\n: : \"a\"(VAR_0), \"c\"(VAR_1), \"S\"(vec)\n: \"memory\", \"cc\");", "#endif\nif (VAR_2)\n*VAR_2 = vec[0];", "if (VAR_3)\n*VAR_3 = vec[1];", "if (VAR_4)\n*VAR_4 = vec[2];", "if (VAR_5)\n*VAR_5 = vec[3];", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 13, 15, 17, 19, 21 ], [ 23, 25, 27, 29, 31, 33, 35, 37, 39, 41 ], [ 43, 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ] ]
3,359
int qemu_add_child_watch(pid_t pid) { ChildProcessRecord *rec; if (!sigchld_bh) { qemu_init_child_watch(); } QLIST_FOREACH(rec, &child_watches, next) { if (rec->pid == pid) { return 1; } } rec = g_malloc0(sizeof(ChildProcessRecord)); rec->pid = pid; QLIST_INSERT_HEAD(&child_watches, rec, next); return 0; }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
int qemu_add_child_watch(pid_t pid) { ChildProcessRecord *rec; if (!sigchld_bh) { qemu_init_child_watch(); } QLIST_FOREACH(rec, &child_watches, next) { if (rec->pid == pid) { return 1; } } rec = g_malloc0(sizeof(ChildProcessRecord)); rec->pid = pid; QLIST_INSERT_HEAD(&child_watches, rec, next); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(pid_t VAR_0) { ChildProcessRecord *rec; if (!sigchld_bh) { qemu_init_child_watch(); } QLIST_FOREACH(rec, &child_watches, next) { if (rec->VAR_0 == VAR_0) { return 1; } } rec = g_malloc0(sizeof(ChildProcessRecord)); rec->VAR_0 = VAR_0; QLIST_INSERT_HEAD(&child_watches, rec, next); return 0; }
[ "int FUNC_0(pid_t VAR_0)\n{", "ChildProcessRecord *rec;", "if (!sigchld_bh) {", "qemu_init_child_watch();", "}", "QLIST_FOREACH(rec, &child_watches, next) {", "if (rec->VAR_0 == VAR_0) {", "return 1;", "}", "}", "rec = g_malloc0(sizeof(ChildProcessRecord));", "rec->VAR_0 = VAR_0;", "QLIST_INSERT_HEAD(&child_watches, rec, next);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
3,360
static void bitband_writew(void *opaque, target_phys_addr_t offset, uint32_t value) { uint32_t addr; uint16_t mask; uint16_t v; addr = bitband_addr(opaque, offset) & ~1; mask = (1 << ((offset >> 2) & 15)); mask = tswap16(mask); cpu_physical_memory_read(addr, (uint8_t *)&v, 2); if (value & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, (uint8_t *)&v, 2); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void bitband_writew(void *opaque, target_phys_addr_t offset, uint32_t value) { uint32_t addr; uint16_t mask; uint16_t v; addr = bitband_addr(opaque, offset) & ~1; mask = (1 << ((offset >> 2) & 15)); mask = tswap16(mask); cpu_physical_memory_read(addr, (uint8_t *)&v, 2); if (value & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, (uint8_t *)&v, 2); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { uint32_t addr; uint16_t mask; uint16_t v; addr = bitband_addr(VAR_0, VAR_1) & ~1; mask = (1 << ((VAR_1 >> 2) & 15)); mask = tswap16(mask); cpu_physical_memory_read(addr, (uint8_t *)&v, 2); if (VAR_2 & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, (uint8_t *)&v, 2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "uint32_t addr;", "uint16_t mask;", "uint16_t v;", "addr = bitband_addr(VAR_0, VAR_1) & ~1;", "mask = (1 << ((VAR_1 >> 2) & 15));", "mask = tswap16(mask);", "cpu_physical_memory_read(addr, (uint8_t *)&v, 2);", "if (VAR_2 & 1)\nv |= mask;", "else\nv &= ~mask;", "cpu_physical_memory_write(addr, (uint8_t *)&v, 2);", "}" ]
[ 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 ] ]
3,361
static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len) { int ret = 0; const uint8_t *buf_offset; SCLPConsoleLM *scon = SCLPLM_CONSOLE(event); if (!scon->chr) { /* If there's no backend, we can just say we consumed all data. */ return len; } buf_offset = buf; while (len > 0) { ret = qemu_chr_fe_write(scon->chr, buf, len); if (ret == 0) { /* a pty doesn't seem to be connected - no error */ len = 0; } else if (ret == -EAGAIN || (ret > 0 && ret < len)) { len -= ret; buf_offset += ret; } else { len = 0; } } return ret; }
false
qemu
7983e829336f68b6df6952dd4b03493b1486fcf5
static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len) { int ret = 0; const uint8_t *buf_offset; SCLPConsoleLM *scon = SCLPLM_CONSOLE(event); if (!scon->chr) { return len; } buf_offset = buf; while (len > 0) { ret = qemu_chr_fe_write(scon->chr, buf, len); if (ret == 0) { len = 0; } else if (ret == -EAGAIN || (ret > 0 && ret < len)) { len -= ret; buf_offset += ret; } else { len = 0; } } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCLPEvent *VAR_0, const uint8_t *VAR_1, int VAR_2) { int VAR_3 = 0; const uint8_t *VAR_4; SCLPConsoleLM *scon = SCLPLM_CONSOLE(VAR_0); if (!scon->chr) { return VAR_2; } VAR_4 = VAR_1; while (VAR_2 > 0) { VAR_3 = qemu_chr_fe_write(scon->chr, VAR_1, VAR_2); if (VAR_3 == 0) { VAR_2 = 0; } else if (VAR_3 == -EAGAIN || (VAR_3 > 0 && VAR_3 < VAR_2)) { VAR_2 -= VAR_3; VAR_4 += VAR_3; } else { VAR_2 = 0; } } return VAR_3; }
[ "static int FUNC_0(SCLPEvent *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "int VAR_3 = 0;", "const uint8_t *VAR_4;", "SCLPConsoleLM *scon = SCLPLM_CONSOLE(VAR_0);", "if (!scon->chr) {", "return VAR_2;", "}", "VAR_4 = VAR_1;", "while (VAR_2 > 0) {", "VAR_3 = qemu_chr_fe_write(scon->chr, VAR_1, VAR_2);", "if (VAR_3 == 0) {", "VAR_2 = 0;", "} else if (VAR_3 == -EAGAIN || (VAR_3 > 0 && VAR_3 < VAR_2)) {", "VAR_2 -= VAR_3;", "VAR_4 += VAR_3;", "} else {", "VAR_2 = 0;", "}", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
3,362
static int mirror_do_read(MirrorBlockJob *s, int64_t sector_num, int nb_sectors) { BlockBackend *source = s->common.blk; int sectors_per_chunk, nb_chunks; int ret; MirrorOp *op; int max_sectors; sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; max_sectors = sectors_per_chunk * s->max_iov; /* We can only handle as much as buf_size at a time. */ nb_sectors = MIN(s->buf_size >> BDRV_SECTOR_BITS, nb_sectors); nb_sectors = MIN(max_sectors, nb_sectors); assert(nb_sectors); ret = nb_sectors; if (s->cow_bitmap) { ret += mirror_cow_align(s, &sector_num, &nb_sectors); } assert(nb_sectors << BDRV_SECTOR_BITS <= s->buf_size); /* The sector range must meet granularity because: * 1) Caller passes in aligned values; * 2) mirror_cow_align is used only when target cluster is larger. */ assert(!(sector_num % sectors_per_chunk)); nb_chunks = DIV_ROUND_UP(nb_sectors, sectors_per_chunk); while (s->buf_free_count < nb_chunks) { trace_mirror_yield_in_flight(s, sector_num * BDRV_SECTOR_SIZE, s->in_flight); mirror_wait_for_io(s); } /* Allocate a MirrorOp that is used as an AIO callback. */ op = g_new(MirrorOp, 1); op->s = s; op->sector_num = sector_num; op->nb_sectors = nb_sectors; /* Now make a QEMUIOVector taking enough granularity-sized chunks * from s->buf_free. */ qemu_iovec_init(&op->qiov, nb_chunks); while (nb_chunks-- > 0) { MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free); size_t remaining = nb_sectors * BDRV_SECTOR_SIZE - op->qiov.size; QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next); s->buf_free_count--; qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining)); } /* Copy the dirty cluster. */ s->in_flight++; s->sectors_in_flight += nb_sectors; trace_mirror_one_iteration(s, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE); blk_aio_preadv(source, sector_num * BDRV_SECTOR_SIZE, &op->qiov, 0, mirror_read_complete, op); return ret; }
false
qemu
b436982f04fb33bb29fcdea190bd1fdc97dc65ef
static int mirror_do_read(MirrorBlockJob *s, int64_t sector_num, int nb_sectors) { BlockBackend *source = s->common.blk; int sectors_per_chunk, nb_chunks; int ret; MirrorOp *op; int max_sectors; sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; max_sectors = sectors_per_chunk * s->max_iov; nb_sectors = MIN(s->buf_size >> BDRV_SECTOR_BITS, nb_sectors); nb_sectors = MIN(max_sectors, nb_sectors); assert(nb_sectors); ret = nb_sectors; if (s->cow_bitmap) { ret += mirror_cow_align(s, &sector_num, &nb_sectors); } assert(nb_sectors << BDRV_SECTOR_BITS <= s->buf_size); assert(!(sector_num % sectors_per_chunk)); nb_chunks = DIV_ROUND_UP(nb_sectors, sectors_per_chunk); while (s->buf_free_count < nb_chunks) { trace_mirror_yield_in_flight(s, sector_num * BDRV_SECTOR_SIZE, s->in_flight); mirror_wait_for_io(s); } op = g_new(MirrorOp, 1); op->s = s; op->sector_num = sector_num; op->nb_sectors = nb_sectors; qemu_iovec_init(&op->qiov, nb_chunks); while (nb_chunks-- > 0) { MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free); size_t remaining = nb_sectors * BDRV_SECTOR_SIZE - op->qiov.size; QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next); s->buf_free_count--; qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining)); } s->in_flight++; s->sectors_in_flight += nb_sectors; trace_mirror_one_iteration(s, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE); blk_aio_preadv(source, sector_num * BDRV_SECTOR_SIZE, &op->qiov, 0, mirror_read_complete, op); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(MirrorBlockJob *VAR_0, int64_t VAR_1, int VAR_2) { BlockBackend *source = VAR_0->common.blk; int VAR_3, VAR_4; int VAR_5; MirrorOp *op; int VAR_6; VAR_3 = VAR_0->granularity >> BDRV_SECTOR_BITS; VAR_6 = VAR_3 * VAR_0->max_iov; VAR_2 = MIN(VAR_0->buf_size >> BDRV_SECTOR_BITS, VAR_2); VAR_2 = MIN(VAR_6, VAR_2); assert(VAR_2); VAR_5 = VAR_2; if (VAR_0->cow_bitmap) { VAR_5 += mirror_cow_align(VAR_0, &VAR_1, &VAR_2); } assert(VAR_2 << BDRV_SECTOR_BITS <= VAR_0->buf_size); assert(!(VAR_1 % VAR_3)); VAR_4 = DIV_ROUND_UP(VAR_2, VAR_3); while (VAR_0->buf_free_count < VAR_4) { trace_mirror_yield_in_flight(VAR_0, VAR_1 * BDRV_SECTOR_SIZE, VAR_0->in_flight); mirror_wait_for_io(VAR_0); } op = g_new(MirrorOp, 1); op->VAR_0 = VAR_0; op->VAR_1 = VAR_1; op->VAR_2 = VAR_2; qemu_iovec_init(&op->qiov, VAR_4); while (VAR_4-- > 0) { MirrorBuffer *buf = QSIMPLEQ_FIRST(&VAR_0->buf_free); size_t remaining = VAR_2 * BDRV_SECTOR_SIZE - op->qiov.size; QSIMPLEQ_REMOVE_HEAD(&VAR_0->buf_free, next); VAR_0->buf_free_count--; qemu_iovec_add(&op->qiov, buf, MIN(VAR_0->granularity, remaining)); } VAR_0->in_flight++; VAR_0->sectors_in_flight += VAR_2; trace_mirror_one_iteration(VAR_0, VAR_1 * BDRV_SECTOR_SIZE, VAR_2 * BDRV_SECTOR_SIZE); blk_aio_preadv(source, VAR_1 * BDRV_SECTOR_SIZE, &op->qiov, 0, mirror_read_complete, op); return VAR_5; }
[ "static int FUNC_0(MirrorBlockJob *VAR_0, int64_t VAR_1,\nint VAR_2)\n{", "BlockBackend *source = VAR_0->common.blk;", "int VAR_3, VAR_4;", "int VAR_5;", "MirrorOp *op;", "int VAR_6;", "VAR_3 = VAR_0->granularity >> BDRV_SECTOR_BITS;", "VAR_6 = VAR_3 * VAR_0->max_iov;", "VAR_2 = MIN(VAR_0->buf_size >> BDRV_SECTOR_BITS, VAR_2);", "VAR_2 = MIN(VAR_6, VAR_2);", "assert(VAR_2);", "VAR_5 = VAR_2;", "if (VAR_0->cow_bitmap) {", "VAR_5 += mirror_cow_align(VAR_0, &VAR_1, &VAR_2);", "}", "assert(VAR_2 << BDRV_SECTOR_BITS <= VAR_0->buf_size);", "assert(!(VAR_1 % VAR_3));", "VAR_4 = DIV_ROUND_UP(VAR_2, VAR_3);", "while (VAR_0->buf_free_count < VAR_4) {", "trace_mirror_yield_in_flight(VAR_0, VAR_1 * BDRV_SECTOR_SIZE,\nVAR_0->in_flight);", "mirror_wait_for_io(VAR_0);", "}", "op = g_new(MirrorOp, 1);", "op->VAR_0 = VAR_0;", "op->VAR_1 = VAR_1;", "op->VAR_2 = VAR_2;", "qemu_iovec_init(&op->qiov, VAR_4);", "while (VAR_4-- > 0) {", "MirrorBuffer *buf = QSIMPLEQ_FIRST(&VAR_0->buf_free);", "size_t remaining = VAR_2 * BDRV_SECTOR_SIZE - op->qiov.size;", "QSIMPLEQ_REMOVE_HEAD(&VAR_0->buf_free, next);", "VAR_0->buf_free_count--;", "qemu_iovec_add(&op->qiov, buf, MIN(VAR_0->granularity, remaining));", "}", "VAR_0->in_flight++;", "VAR_0->sectors_in_flight += VAR_2;", "trace_mirror_one_iteration(VAR_0, VAR_1 * BDRV_SECTOR_SIZE,\nVAR_2 * BDRV_SECTOR_SIZE);", "blk_aio_preadv(source, VAR_1 * BDRV_SECTOR_SIZE, &op->qiov, 0,\nmirror_read_complete, op);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 119, 121 ], [ 123 ], [ 125 ] ]
3,363
static void tcg_target_init(TCGContext *s) { #ifdef CONFIG_GETAUXVAL unsigned long hwcap = getauxval(AT_HWCAP); if (hwcap & PPC_FEATURE_ARCH_2_06) { have_isa_2_06 = true; } #endif tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffffffff); tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff); tcg_regset_set32(tcg_target_call_clobber_regs, 0, (1 << TCG_REG_R0) | #ifdef __APPLE__ (1 << TCG_REG_R2) | #endif (1 << TCG_REG_R3) | (1 << TCG_REG_R4) | (1 << TCG_REG_R5) | (1 << TCG_REG_R6) | (1 << TCG_REG_R7) | (1 << TCG_REG_R8) | (1 << TCG_REG_R9) | (1 << TCG_REG_R10) | (1 << TCG_REG_R11) | (1 << TCG_REG_R12) ); tcg_regset_clear(s->reserved_regs); tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0); tcg_regset_set_reg(s->reserved_regs, TCG_REG_R1); #ifndef __APPLE__ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R2); #endif tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13); tcg_add_target_add_op_defs(ppc_op_defs); }
false
qemu
5e1702b0742b7cc88e85dfe76c3ba5d1432312aa
static void tcg_target_init(TCGContext *s) { #ifdef CONFIG_GETAUXVAL unsigned long hwcap = getauxval(AT_HWCAP); if (hwcap & PPC_FEATURE_ARCH_2_06) { have_isa_2_06 = true; } #endif tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffffffff); tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff); tcg_regset_set32(tcg_target_call_clobber_regs, 0, (1 << TCG_REG_R0) | #ifdef __APPLE__ (1 << TCG_REG_R2) | #endif (1 << TCG_REG_R3) | (1 << TCG_REG_R4) | (1 << TCG_REG_R5) | (1 << TCG_REG_R6) | (1 << TCG_REG_R7) | (1 << TCG_REG_R8) | (1 << TCG_REG_R9) | (1 << TCG_REG_R10) | (1 << TCG_REG_R11) | (1 << TCG_REG_R12) ); tcg_regset_clear(s->reserved_regs); tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0); tcg_regset_set_reg(s->reserved_regs, TCG_REG_R1); #ifndef __APPLE__ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R2); #endif tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13); tcg_add_target_add_op_defs(ppc_op_defs); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0) { #ifdef CONFIG_GETAUXVAL unsigned long hwcap = getauxval(AT_HWCAP); if (hwcap & PPC_FEATURE_ARCH_2_06) { have_isa_2_06 = true; } #endif tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffffffff); tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff); tcg_regset_set32(tcg_target_call_clobber_regs, 0, (1 << TCG_REG_R0) | #ifdef __APPLE__ (1 << TCG_REG_R2) | #endif (1 << TCG_REG_R3) | (1 << TCG_REG_R4) | (1 << TCG_REG_R5) | (1 << TCG_REG_R6) | (1 << TCG_REG_R7) | (1 << TCG_REG_R8) | (1 << TCG_REG_R9) | (1 << TCG_REG_R10) | (1 << TCG_REG_R11) | (1 << TCG_REG_R12) ); tcg_regset_clear(VAR_0->reserved_regs); tcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R0); tcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R1); #ifndef __APPLE__ tcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R2); #endif tcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R13); tcg_add_target_add_op_defs(ppc_op_defs); }
[ "static void FUNC_0(TCGContext *VAR_0)\n{", "#ifdef CONFIG_GETAUXVAL\nunsigned long hwcap = getauxval(AT_HWCAP);", "if (hwcap & PPC_FEATURE_ARCH_2_06) {", "have_isa_2_06 = true;", "}", "#endif\ntcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffffffff);", "tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);", "tcg_regset_set32(tcg_target_call_clobber_regs, 0,\n(1 << TCG_REG_R0) |\n#ifdef __APPLE__\n(1 << TCG_REG_R2) |\n#endif\n(1 << TCG_REG_R3) |\n(1 << TCG_REG_R4) |\n(1 << TCG_REG_R5) |\n(1 << TCG_REG_R6) |\n(1 << TCG_REG_R7) |\n(1 << TCG_REG_R8) |\n(1 << TCG_REG_R9) |\n(1 << TCG_REG_R10) |\n(1 << TCG_REG_R11) |\n(1 << TCG_REG_R12)\n);", "tcg_regset_clear(VAR_0->reserved_regs);", "tcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R0);", "tcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R1);", "#ifndef __APPLE__\ntcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R2);", "#endif\ntcg_regset_set_reg(VAR_0->reserved_regs, TCG_REG_R13);", "tcg_add_target_add_op_defs(ppc_op_defs);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 19 ], [ 21 ], [ 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 73 ], [ 75 ] ]
3,364
static void test_validate_alternate(TestInputVisitorData *data, const void *unused) { UserDefAlternate *tmp = NULL; Visitor *v; v = validate_test_init(data, "42"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); qapi_free_UserDefAlternate(tmp); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_validate_alternate(TestInputVisitorData *data, const void *unused) { UserDefAlternate *tmp = NULL; Visitor *v; v = validate_test_init(data, "42"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); qapi_free_UserDefAlternate(tmp); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { UserDefAlternate *tmp = NULL; Visitor *v; v = validate_test_init(VAR_0, "42"); visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort); qapi_free_UserDefAlternate(tmp); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "UserDefAlternate *tmp = NULL;", "Visitor *v;", "v = validate_test_init(VAR_0, \"42\");", "visit_type_UserDefAlternate(v, NULL, &tmp, &error_abort);", "qapi_free_UserDefAlternate(tmp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
3,366
static void parse_chap(struct iscsi_context *iscsi, const char *target, Error **errp) { QemuOptsList *list; QemuOpts *opts; const char *user = NULL; const char *password = NULL; const char *secretid; char *secret = NULL; list = qemu_find_opts("iscsi"); if (!list) { return; } opts = qemu_opts_find(list, target); if (opts == NULL) { opts = QTAILQ_FIRST(&list->head); if (!opts) { return; } } user = qemu_opt_get(opts, "user"); if (!user) { return; } secretid = qemu_opt_get(opts, "password-secret"); password = qemu_opt_get(opts, "password"); if (secretid && password) { error_setg(errp, "'password' and 'password-secret' properties are " "mutually exclusive"); return; } if (secretid) { secret = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!secret) { return; } password = secret; } else if (!password) { error_setg(errp, "CHAP username specified but no password was given"); return; } if (iscsi_set_initiator_username_pwd(iscsi, user, password)) { error_setg(errp, "Failed to set initiator username and password"); } g_free(secret); }
false
qemu
4317142020921c6dcdcfda7a349a91088d969f14
static void parse_chap(struct iscsi_context *iscsi, const char *target, Error **errp) { QemuOptsList *list; QemuOpts *opts; const char *user = NULL; const char *password = NULL; const char *secretid; char *secret = NULL; list = qemu_find_opts("iscsi"); if (!list) { return; } opts = qemu_opts_find(list, target); if (opts == NULL) { opts = QTAILQ_FIRST(&list->head); if (!opts) { return; } } user = qemu_opt_get(opts, "user"); if (!user) { return; } secretid = qemu_opt_get(opts, "password-secret"); password = qemu_opt_get(opts, "password"); if (secretid && password) { error_setg(errp, "'password' and 'password-secret' properties are " "mutually exclusive"); return; } if (secretid) { secret = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!secret) { return; } password = secret; } else if (!password) { error_setg(errp, "CHAP username specified but no password was given"); return; } if (iscsi_set_initiator_username_pwd(iscsi, user, password)) { error_setg(errp, "Failed to set initiator username and password"); } g_free(secret); }
{ "code": [], "line_no": [] }
static void FUNC_0(struct iscsi_context *VAR_0, const char *VAR_1, Error **VAR_2) { QemuOptsList *list; QemuOpts *opts; const char *VAR_3 = NULL; const char *VAR_4 = NULL; const char *VAR_5; char *VAR_6 = NULL; list = qemu_find_opts("VAR_0"); if (!list) { return; } opts = qemu_opts_find(list, VAR_1); if (opts == NULL) { opts = QTAILQ_FIRST(&list->head); if (!opts) { return; } } VAR_3 = qemu_opt_get(opts, "VAR_3"); if (!VAR_3) { return; } VAR_5 = qemu_opt_get(opts, "VAR_4-VAR_6"); VAR_4 = qemu_opt_get(opts, "VAR_4"); if (VAR_5 && VAR_4) { error_setg(VAR_2, "'VAR_4' and 'VAR_4-VAR_6' properties are " "mutually exclusive"); return; } if (VAR_5) { VAR_6 = qcrypto_secret_lookup_as_utf8(VAR_5, VAR_2); if (!VAR_6) { return; } VAR_4 = VAR_6; } else if (!VAR_4) { error_setg(VAR_2, "CHAP username specified but no VAR_4 was given"); return; } if (iscsi_set_initiator_username_pwd(VAR_0, VAR_3, VAR_4)) { error_setg(VAR_2, "Failed to set initiator username and VAR_4"); } g_free(VAR_6); }
[ "static void FUNC_0(struct iscsi_context *VAR_0, const char *VAR_1,\nError **VAR_2)\n{", "QemuOptsList *list;", "QemuOpts *opts;", "const char *VAR_3 = NULL;", "const char *VAR_4 = NULL;", "const char *VAR_5;", "char *VAR_6 = NULL;", "list = qemu_find_opts(\"VAR_0\");", "if (!list) {", "return;", "}", "opts = qemu_opts_find(list, VAR_1);", "if (opts == NULL) {", "opts = QTAILQ_FIRST(&list->head);", "if (!opts) {", "return;", "}", "}", "VAR_3 = qemu_opt_get(opts, \"VAR_3\");", "if (!VAR_3) {", "return;", "}", "VAR_5 = qemu_opt_get(opts, \"VAR_4-VAR_6\");", "VAR_4 = qemu_opt_get(opts, \"VAR_4\");", "if (VAR_5 && VAR_4) {", "error_setg(VAR_2, \"'VAR_4' and 'VAR_4-VAR_6' properties are \"\n\"mutually exclusive\");", "return;", "}", "if (VAR_5) {", "VAR_6 = qcrypto_secret_lookup_as_utf8(VAR_5, VAR_2);", "if (!VAR_6) {", "return;", "}", "VAR_4 = VAR_6;", "} else if (!VAR_4) {", "error_setg(VAR_2, \"CHAP username specified but no VAR_4 was given\");", "return;", "}", "if (iscsi_set_initiator_username_pwd(VAR_0, VAR_3, VAR_4)) {", "error_setg(VAR_2, \"Failed to set initiator username and VAR_4\");", "}", "g_free(VAR_6);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ] ]
3,367
static void mips_fulong2e_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; /* init CPUs */ if (cpu_model == NULL) { cpu_model = "Loongson-2E"; } cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); /* fulong 2e has 256M ram. */ ram_size = 256 * 1024 * 1024; /* fulong 2e has a 1M flash.Winbond W39L040AP70Z */ bios_size = 1024 * 1024; /* allocate RAM */ memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); /* We do not support flash operation, just loading pmon.bin as raw BIOS. * Please use -L to set the BIOS path and -bios to set bios name. */ if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE); g_free(filename); } else { bios_size = -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename && !qtest_enabled()) { error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } } /* Init internal devices */ cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); /* North bridge, Bonito --> IP2 */ pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); /* South bridge */ ide_drive_get(hd, ARRAY_SIZE(hd)); isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (!isa_bus) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); } /* Interrupt controller */ /* The 8259 -> IP5 */ i8259 = i8259_init(isa_bus, env->irq[5]); isa_bus_irqs(isa_bus, i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3), "vt82c686b-usb-uhci"); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); /* TODO: Populate SPD eeprom data. */ smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd)); /* init other devices */ pit = pit_init(isa_bus, 0x40, 0, NULL); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); /* Super I/O */ isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); parallel_hds_isa_init(isa_bus, 1); /* Sound card */ audio_init(pci_bus); /* Network card */ network_init(pci_bus); }
false
qemu
5039d6e23586fe6bbedc5e4fe302b48a66890ade
static void mips_fulong2e_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; if (cpu_model == NULL) { cpu_model = "Loongson-2E"; } cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); ram_size = 256 * 1024 * 1024; bios_size = 1024 * 1024; memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE); g_free(filename); } else { bios_size = -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename && !qtest_enabled()) { error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); ide_drive_get(hd, ARRAY_SIZE(hd)); isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (!isa_bus) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); } i8259 = i8259_init(isa_bus, env->irq[5]); isa_bus_irqs(isa_bus, i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3), "vt82c686b-usb-uhci"); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd)); pit = pit_init(isa_bus, 0x40, 0, NULL); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); parallel_hds_isa_init(isa_bus, 1); audio_init(pci_bus); network_init(pci_bus); }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; char *VAR_5; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); long VAR_6; int64_t kernel_entry; qemu_irq *i8259; qemu_irq *cpu_exit_irq; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; if (VAR_1 == NULL) { VAR_1 = "Loongson-2E"; } cpu = cpu_mips_init(VAR_1); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); ram_size = 256 * 1024 * 1024; VAR_6 = 1024 * 1024; memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", VAR_6, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); if (VAR_2) { loaderparams.ram_size = ram_size; loaderparams.VAR_2 = VAR_2; loaderparams.VAR_3 = VAR_3; loaderparams.VAR_4 = VAR_4; kernel_entry = load_kernel (env); write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; } VAR_5 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_5) { VAR_6 = load_image_targphys(VAR_5, 0x1fc00000LL, BIOS_SIZE); g_free(VAR_5); } else { VAR_6 = -1; } if ((VAR_6 < 0 || VAR_6 > BIOS_SIZE) && !VAR_2 && !qtest_enabled()) { error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); ide_drive_get(hd, ARRAY_SIZE(hd)); isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); if (!isa_bus) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); } i8259 = i8259_init(isa_bus, env->irq[5]); isa_bus_irqs(isa_bus, i8259); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3), "vt82c686b-usb-uhci"); smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), 0xeee1, NULL); smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd)); pit = pit_init(isa_bus, 0x40, 0, NULL); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); parallel_hds_isa_init(isa_bus, 1); audio_init(pci_bus); network_init(pci_bus); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "char *VAR_5;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "MemoryRegion *bios = g_new(MemoryRegion, 1);", "long VAR_6;", "int64_t kernel_entry;", "qemu_irq *i8259;", "qemu_irq *cpu_exit_irq;", "PCIBus *pci_bus;", "ISABus *isa_bus;", "I2CBus *smbus;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "MIPSCPU *cpu;", "CPUMIPSState *env;", "if (VAR_1 == NULL) {", "VAR_1 = \"Loongson-2E\";", "}", "cpu = cpu_mips_init(VAR_1);", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "env = &cpu->env;", "qemu_register_reset(main_cpu_reset, cpu);", "ram_size = 256 * 1024 * 1024;", "VAR_6 = 1024 * 1024;", "memory_region_allocate_system_memory(ram, NULL, \"fulong2e.ram\", ram_size);", "memory_region_init_ram(bios, NULL, \"fulong2e.bios\", VAR_6,\n&error_abort);", "vmstate_register_ram_global(bios);", "memory_region_set_readonly(bios, true);", "memory_region_add_subregion(address_space_mem, 0, ram);", "memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);", "if (VAR_2) {", "loaderparams.ram_size = ram_size;", "loaderparams.VAR_2 = VAR_2;", "loaderparams.VAR_3 = VAR_3;", "loaderparams.VAR_4 = VAR_4;", "kernel_entry = load_kernel (env);", "write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry);", "} else {", "if (bios_name == NULL) {", "bios_name = FULONG_BIOSNAME;", "}", "VAR_5 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_5) {", "VAR_6 = load_image_targphys(VAR_5, 0x1fc00000LL,\nBIOS_SIZE);", "g_free(VAR_5);", "} else {", "VAR_6 = -1;", "}", "if ((VAR_6 < 0 || VAR_6 > BIOS_SIZE) &&\n!VAR_2 && !qtest_enabled()) {", "error_report(\"Could not load MIPS bios '%s'\", bios_name);", "exit(1);", "}", "}", "cpu_mips_irq_init_cpu(env);", "cpu_mips_clock_init(env);", "pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));", "ide_drive_get(hd, ARRAY_SIZE(hd));", "isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0));", "if (!isa_bus) {", "fprintf(stderr, \"vt82c686b_init error\\n\");", "exit(1);", "}", "i8259 = i8259_init(isa_bus, env->irq[5]);", "isa_bus_irqs(isa_bus, i8259);", "vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1));", "pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2),\n\"vt82c686b-usb-uhci\");", "pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3),\n\"vt82c686b-usb-uhci\");", "smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4),\n0xeee1, NULL);", "smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd));", "pit = pit_init(isa_bus, 0x40, 0, NULL);", "cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);", "DMA_init(0, cpu_exit_irq);", "isa_create_simple(isa_bus, \"i8042\");", "rtc_init(isa_bus, 2000, NULL);", "serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS);", "parallel_hds_isa_init(isa_bus, 1);", "audio_init(pci_bus);", "network_init(pci_bus);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 73 ], [ 79 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 165 ], [ 167 ], [ 173 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 199 ], [ 201 ], [ 205 ], [ 207, 209 ], [ 211, 213 ], [ 217, 219 ], [ 223 ], [ 229 ], [ 231 ], [ 233 ], [ 239 ], [ 243 ], [ 247 ], [ 249 ], [ 255 ], [ 259 ], [ 261 ] ]
3,369
static inline void downmix_dualmono_to_stereo(float *samples) { int i; float tmp; for (i = 0; i < 256; i++) { tmp = samples[i] + samples[i + 256]; samples[i] = samples[i + 256] = tmp; } }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static inline void downmix_dualmono_to_stereo(float *samples) { int i; float tmp; for (i = 0; i < 256; i++) { tmp = samples[i] + samples[i + 256]; samples[i] = samples[i + 256] = tmp; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(float *VAR_0) { int VAR_1; float VAR_2; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_2 = VAR_0[VAR_1] + VAR_0[VAR_1 + 256]; VAR_0[VAR_1] = VAR_0[VAR_1 + 256] = VAR_2; } }
[ "static inline void FUNC_0(float *VAR_0)\n{", "int VAR_1;", "float VAR_2;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_2 = VAR_0[VAR_1] + VAR_0[VAR_1 + 256];", "VAR_0[VAR_1] = VAR_0[VAR_1 + 256] = VAR_2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
3,370
static int64_t mmsh_read_seek(URLContext *h, int stream_index, int64_t timestamp, int flags) { MMSHContext *mmsh = h->priv_data; MMSContext *mms = &mmsh->mms; int ret; ret= mmsh_open_internal(h, mmsh->location, 0, timestamp, 0); if(ret>=0){ if (mms->mms_hd) ffurl_close(mms->mms_hd); av_freep(&mms->streams); av_freep(&mms->asf_header); av_free(mmsh); mmsh = h->priv_data; mms = &mmsh->mms; mms->asf_header_read_size= mms->asf_header_size; }else h->priv_data= mmsh; return ret; }
false
FFmpeg
8af4ac5272e8eaff90c3102b9473bb09cc6f4201
static int64_t mmsh_read_seek(URLContext *h, int stream_index, int64_t timestamp, int flags) { MMSHContext *mmsh = h->priv_data; MMSContext *mms = &mmsh->mms; int ret; ret= mmsh_open_internal(h, mmsh->location, 0, timestamp, 0); if(ret>=0){ if (mms->mms_hd) ffurl_close(mms->mms_hd); av_freep(&mms->streams); av_freep(&mms->asf_header); av_free(mmsh); mmsh = h->priv_data; mms = &mmsh->mms; mms->asf_header_read_size= mms->asf_header_size; }else h->priv_data= mmsh; return ret; }
{ "code": [], "line_no": [] }
static int64_t FUNC_0(URLContext *h, int stream_index, int64_t timestamp, int flags) { MMSHContext *mmsh = h->priv_data; MMSContext *mms = &mmsh->mms; int VAR_0; VAR_0= mmsh_open_internal(h, mmsh->location, 0, timestamp, 0); if(VAR_0>=0){ if (mms->mms_hd) ffurl_close(mms->mms_hd); av_freep(&mms->streams); av_freep(&mms->asf_header); av_free(mmsh); mmsh = h->priv_data; mms = &mmsh->mms; mms->asf_header_read_size= mms->asf_header_size; }else h->priv_data= mmsh; return VAR_0; }
[ "static int64_t FUNC_0(URLContext *h, int stream_index,\nint64_t timestamp, int flags)\n{", "MMSHContext *mmsh = h->priv_data;", "MMSContext *mms = &mmsh->mms;", "int VAR_0;", "VAR_0= mmsh_open_internal(h, mmsh->location, 0, timestamp, 0);", "if(VAR_0>=0){", "if (mms->mms_hd)\nffurl_close(mms->mms_hd);", "av_freep(&mms->streams);", "av_freep(&mms->asf_header);", "av_free(mmsh);", "mmsh = h->priv_data;", "mms = &mmsh->mms;", "mms->asf_header_read_size= mms->asf_header_size;", "}else", "h->priv_data= mmsh;", "return VAR_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 ] ]
3,371
static int get_current_cpu(void) { return cpu_single_env->cpu_index; }
true
qemu
c3203fa5b2c17a1c446e44c87788fef21b4af5f4
static int get_current_cpu(void) { return cpu_single_env->cpu_index; }
{ "code": [ " return cpu_single_env->cpu_index;" ], "line_no": [ 5 ] }
static int FUNC_0(void) { return cpu_single_env->cpu_index; }
[ "static int FUNC_0(void)\n{", "return cpu_single_env->cpu_index;", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
3,372
static void bonito_cop_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; ((uint32_t *)(&s->boncop))[addr/sizeof(uint32_t)] = val & 0xffffffff;
true
qemu
58d479786b11a7e982419c1e0905b8490ef9a787
static void bonito_cop_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; ((uint32_t *)(&s->boncop))[addr/sizeof(uint32_t)] = val & 0xffffffff;
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { PCIBonitoState *s = VAR_0; ((uint32_t *)(&s->boncop))[VAR_1/sizeof(uint32_t)] = VAR_2 & 0xffffffff;
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PCIBonitoState *s = VAR_0;", "((uint32_t *)(&s->boncop))[VAR_1/sizeof(uint32_t)] = VAR_2 & 0xffffffff;" ]
[ 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ] ]
3,373
static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) { AVIOContext *pb = mxf->fc->pb; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; uint64_t klv_end = avio_tell(pb) + klv->length; if (!ctx) return AVERROR(ENOMEM); mxf_metadataset_init(ctx, type); while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) { int ret; int tag = avio_rb16(pb); int size = avio_rb16(pb); /* KLV specified by 0x53 */ uint64_t next = avio_tell(pb) + size; UID uid = {0}; av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size); if (!size) { /* ignore empty tag, needed for some files with empty UMID tag */ av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag); continue; } if (tag > 0x7FFF) { /* dynamic tag */ int i; for (i = 0; i < mxf->local_tags_count; i++) { int local_tag = AV_RB16(mxf->local_tags+i*18); if (local_tag == tag) { memcpy(uid, mxf->local_tags+i*18+2, 16); av_dlog(mxf->fc, "local tag %#04x\n", local_tag); PRINT_KEY(mxf->fc, "uid", uid); } } } if (ctx_size && tag == 0x3C0A) avio_read(pb, ctx->uid, 16); else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0) return ret; /* Accept the 64k local set limit being exceeded (Avid). Don't accept * it extending past the end of the KLV though (zzuf5.mxf). */ if (avio_tell(pb) > klv_end) { if (ctx_size) av_free(ctx); av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x extends past end of local set @ %#"PRIx64"\n", tag, klv->offset); return AVERROR_INVALIDDATA; } else if (avio_tell(pb) <= next) /* only seek forward, else this can loop for a long time */ avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; }
true
FFmpeg
4373a25d94dba2cb361aa18e8d70806e1894df81
static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) { AVIOContext *pb = mxf->fc->pb; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; uint64_t klv_end = avio_tell(pb) + klv->length; if (!ctx) return AVERROR(ENOMEM); mxf_metadataset_init(ctx, type); while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) { int ret; int tag = avio_rb16(pb); int size = avio_rb16(pb); uint64_t next = avio_tell(pb) + size; UID uid = {0}; av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size); if (!size) { av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag); continue; } if (tag > 0x7FFF) { int i; for (i = 0; i < mxf->local_tags_count; i++) { int local_tag = AV_RB16(mxf->local_tags+i*18); if (local_tag == tag) { memcpy(uid, mxf->local_tags+i*18+2, 16); av_dlog(mxf->fc, "local tag %#04x\n", local_tag); PRINT_KEY(mxf->fc, "uid", uid); } } } if (ctx_size && tag == 0x3C0A) avio_read(pb, ctx->uid, 16); else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0) return ret; if (avio_tell(pb) > klv_end) { if (ctx_size) av_free(ctx); av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x extends past end of local set @ %#"PRIx64"\n", tag, klv->offset); return AVERROR_INVALIDDATA; } else if (avio_tell(pb) <= next) avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; }
{ "code": [ " if (ctx_size && tag == 0x3C0A)", " else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0)", " if (ctx_size)", " av_free(ctx);" ], "line_no": [ 65, 69, 81, 83 ] }
static int FUNC_0(MXFContext *VAR_0, KLVPacket *VAR_1, MXFMetadataReadFunc *VAR_2, int VAR_3, enum MXFMetadataSetType VAR_4) { AVIOContext *pb = VAR_0->fc->pb; MXFMetadataSet *ctx = VAR_3 ? av_mallocz(VAR_3) : VAR_0; uint64_t klv_end = avio_tell(pb) + VAR_1->length; if (!ctx) return AVERROR(ENOMEM); mxf_metadataset_init(ctx, VAR_4); while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) { int VAR_5; int VAR_6 = avio_rb16(pb); int VAR_7 = avio_rb16(pb); uint64_t next = avio_tell(pb) + VAR_7; UID uid = {0}; av_dlog(VAR_0->fc, "local VAR_6 %#04x VAR_7 %d\n", VAR_6, VAR_7); if (!VAR_7) { av_log(VAR_0->fc, AV_LOG_ERROR, "local VAR_6 %#04x with 0 VAR_7\n", VAR_6); continue; } if (VAR_6 > 0x7FFF) { int VAR_8; for (VAR_8 = 0; VAR_8 < VAR_0->local_tags_count; VAR_8++) { int local_tag = AV_RB16(VAR_0->local_tags+VAR_8*18); if (local_tag == VAR_6) { memcpy(uid, VAR_0->local_tags+VAR_8*18+2, 16); av_dlog(VAR_0->fc, "local VAR_6 %#04x\n", local_tag); PRINT_KEY(VAR_0->fc, "uid", uid); } } } if (VAR_3 && VAR_6 == 0x3C0A) avio_read(pb, ctx->uid, 16); else if ((VAR_5 = VAR_2(ctx, pb, VAR_6, VAR_7, uid, -1)) < 0) return VAR_5; if (avio_tell(pb) > klv_end) { if (VAR_3) av_free(ctx); av_log(VAR_0->fc, AV_LOG_ERROR, "local VAR_6 %#04x extends past end of local set @ %#"PRIx64"\n", VAR_6, VAR_1->offset); return AVERROR_INVALIDDATA; } else if (avio_tell(pb) <= next) avio_seek(pb, next, SEEK_SET); } if (VAR_3) ctx->VAR_4 = VAR_4; return VAR_3 ? mxf_add_metadata_set(VAR_0, ctx) : 0; }
[ "static int FUNC_0(MXFContext *VAR_0, KLVPacket *VAR_1, MXFMetadataReadFunc *VAR_2, int VAR_3, enum MXFMetadataSetType VAR_4)\n{", "AVIOContext *pb = VAR_0->fc->pb;", "MXFMetadataSet *ctx = VAR_3 ? av_mallocz(VAR_3) : VAR_0;", "uint64_t klv_end = avio_tell(pb) + VAR_1->length;", "if (!ctx)\nreturn AVERROR(ENOMEM);", "mxf_metadataset_init(ctx, VAR_4);", "while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) {", "int VAR_5;", "int VAR_6 = avio_rb16(pb);", "int VAR_7 = avio_rb16(pb);", "uint64_t next = avio_tell(pb) + VAR_7;", "UID uid = {0};", "av_dlog(VAR_0->fc, \"local VAR_6 %#04x VAR_7 %d\\n\", VAR_6, VAR_7);", "if (!VAR_7) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"local VAR_6 %#04x with 0 VAR_7\\n\", VAR_6);", "continue;", "}", "if (VAR_6 > 0x7FFF) {", "int VAR_8;", "for (VAR_8 = 0; VAR_8 < VAR_0->local_tags_count; VAR_8++) {", "int local_tag = AV_RB16(VAR_0->local_tags+VAR_8*18);", "if (local_tag == VAR_6) {", "memcpy(uid, VAR_0->local_tags+VAR_8*18+2, 16);", "av_dlog(VAR_0->fc, \"local VAR_6 %#04x\\n\", local_tag);", "PRINT_KEY(VAR_0->fc, \"uid\", uid);", "}", "}", "}", "if (VAR_3 && VAR_6 == 0x3C0A)\navio_read(pb, ctx->uid, 16);", "else if ((VAR_5 = VAR_2(ctx, pb, VAR_6, VAR_7, uid, -1)) < 0)\nreturn VAR_5;", "if (avio_tell(pb) > klv_end) {", "if (VAR_3)\nav_free(ctx);", "av_log(VAR_0->fc, AV_LOG_ERROR,\n\"local VAR_6 %#04x extends past end of local set @ %#\"PRIx64\"\\n\",\nVAR_6, VAR_1->offset);", "return AVERROR_INVALIDDATA;", "} else if (avio_tell(pb) <= next)", "avio_seek(pb, next, SEEK_SET);", "}", "if (VAR_3) ctx->VAR_4 = VAR_4;", "return VAR_3 ? mxf_add_metadata_set(VAR_0, ctx) : 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 79 ], [ 81, 83 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
3,374
static int vhost_client_migration_log(CPUPhysMemoryClient *client, int enable) { struct vhost_dev *dev = container_of(client, struct vhost_dev, client); int r; if (!!enable == dev->log_enabled) { return 0; } if (!dev->started) { dev->log_enabled = enable; return 0; } if (!enable) { r = vhost_dev_set_log(dev, false); if (r < 0) { return r; } if (dev->log) { g_free(dev->log); } dev->log = NULL; dev->log_size = 0; } else { vhost_dev_log_resize(dev, vhost_get_log_size(dev)); r = vhost_dev_set_log(dev, true); if (r < 0) { return r; } } dev->log_enabled = enable; return 0; }
true
qemu
04097f7c5957273c578f72b9bd603ba6b1d69e33
static int vhost_client_migration_log(CPUPhysMemoryClient *client, int enable) { struct vhost_dev *dev = container_of(client, struct vhost_dev, client); int r; if (!!enable == dev->log_enabled) { return 0; } if (!dev->started) { dev->log_enabled = enable; return 0; } if (!enable) { r = vhost_dev_set_log(dev, false); if (r < 0) { return r; } if (dev->log) { g_free(dev->log); } dev->log = NULL; dev->log_size = 0; } else { vhost_dev_log_resize(dev, vhost_get_log_size(dev)); r = vhost_dev_set_log(dev, true); if (r < 0) { return r; } } dev->log_enabled = enable; return 0; }
{ "code": [ " struct vhost_dev *dev = container_of(client, struct vhost_dev, client);", " struct vhost_dev *dev = container_of(client, struct vhost_dev, client);", "static int vhost_client_migration_log(CPUPhysMemoryClient *client,", " int enable)", " struct vhost_dev *dev = container_of(client, struct vhost_dev, client);" ], "line_no": [ 7, 7, 1, 3, 7 ] }
static int FUNC_0(CPUPhysMemoryClient *VAR_0, int VAR_1) { struct vhost_dev *VAR_2 = container_of(VAR_0, struct vhost_dev, VAR_0); int VAR_3; if (!!VAR_1 == VAR_2->log_enabled) { return 0; } if (!VAR_2->started) { VAR_2->log_enabled = VAR_1; return 0; } if (!VAR_1) { VAR_3 = vhost_dev_set_log(VAR_2, false); if (VAR_3 < 0) { return VAR_3; } if (VAR_2->log) { g_free(VAR_2->log); } VAR_2->log = NULL; VAR_2->log_size = 0; } else { vhost_dev_log_resize(VAR_2, vhost_get_log_size(VAR_2)); VAR_3 = vhost_dev_set_log(VAR_2, true); if (VAR_3 < 0) { return VAR_3; } } VAR_2->log_enabled = VAR_1; return 0; }
[ "static int FUNC_0(CPUPhysMemoryClient *VAR_0,\nint VAR_1)\n{", "struct vhost_dev *VAR_2 = container_of(VAR_0, struct vhost_dev, VAR_0);", "int VAR_3;", "if (!!VAR_1 == VAR_2->log_enabled) {", "return 0;", "}", "if (!VAR_2->started) {", "VAR_2->log_enabled = VAR_1;", "return 0;", "}", "if (!VAR_1) {", "VAR_3 = vhost_dev_set_log(VAR_2, false);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "if (VAR_2->log) {", "g_free(VAR_2->log);", "}", "VAR_2->log = NULL;", "VAR_2->log_size = 0;", "} else {", "vhost_dev_log_resize(VAR_2, vhost_get_log_size(VAR_2));", "VAR_3 = vhost_dev_set_log(VAR_2, true);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "}", "VAR_2->log_enabled = VAR_1;", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
3,376
long do_rt_sigreturn(CPUS390XState *env) { rt_sigframe *frame; abi_ulong frame_addr = env->regs[15]; sigset_t set; trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); set_sigmask(&set); /* ~_BLOCKABLE? */ if (restore_sigregs(env, &frame->uc.tuc_mcontext)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
true
qemu
c599d4d6d6e9bfdb64e54c33a22cb26e3496b96d
long do_rt_sigreturn(CPUS390XState *env) { rt_sigframe *frame; abi_ulong frame_addr = env->regs[15]; sigset_t set; trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); set_sigmask(&set); if (restore_sigregs(env, &frame->uc.tuc_mcontext)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
{ "code": [ " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;" ], "line_no": [ 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 ] }
long FUNC_0(CPUS390XState *VAR_0) { rt_sigframe *frame; abi_ulong frame_addr = VAR_0->regs[15]; sigset_t set; trace_user_do_rt_sigreturn(VAR_0, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); set_sigmask(&set); if (restore_sigregs(VAR_0, &frame->uc.tuc_mcontext)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(VAR_0)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
[ "long FUNC_0(CPUS390XState *VAR_0)\n{", "rt_sigframe *frame;", "abi_ulong frame_addr = VAR_0->regs[15];", "sigset_t set;", "trace_user_do_rt_sigreturn(VAR_0, frame_addr);", "if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {", "goto badframe;", "}", "target_to_host_sigset(&set, &frame->uc.tuc_sigmask);", "set_sigmask(&set);", "if (restore_sigregs(VAR_0, &frame->uc.tuc_mcontext)) {", "goto badframe;", "}", "if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.tuc_stack), 0,\nget_sp_from_cpustate(VAR_0)) == -EFAULT) {", "goto badframe;", "}", "unlock_user_struct(frame, frame_addr, 0);", "return -TARGET_QEMU_ESIGRETURN;", "badframe:\nunlock_user_struct(frame, frame_addr, 0);", "force_sig(TARGET_SIGSEGV);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ] ]
3,377
static int no_init_out (HWVoiceOut *hw, struct audsettings *as) { audio_pcm_init_info (&hw->info, as); hw->samples = 1024; return 0; }
true
qemu
5706db1deb061ee9affdcea81e59c4c2cad7c41e
static int no_init_out (HWVoiceOut *hw, struct audsettings *as) { audio_pcm_init_info (&hw->info, as); hw->samples = 1024; return 0; }
{ "code": [ "static int no_init_out (HWVoiceOut *hw, struct audsettings *as)" ], "line_no": [ 1 ] }
static int FUNC_0 (HWVoiceOut *VAR_0, struct audsettings *VAR_1) { audio_pcm_init_info (&VAR_0->info, VAR_1); VAR_0->samples = 1024; return 0; }
[ "static int FUNC_0 (HWVoiceOut *VAR_0, struct audsettings *VAR_1)\n{", "audio_pcm_init_info (&VAR_0->info, VAR_1);", "VAR_0->samples = 1024;", "return 0;", "}" ]
[ 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
3,378
static int protocol_client_vencrypt_init(VncState *vs, uint8_t *data, size_t len) { if (data[0] != 0 || data[1] != 2) { VNC_DEBUG("Unsupported VeNCrypt protocol %d.%d\n", (int)data[0], (int)data[1]); vnc_write_u8(vs, 1); /* Reject version */ vnc_flush(vs); vnc_client_error(vs); } else { VNC_DEBUG("Sending allowed auth %d\n", vs->subauth); vnc_write_u8(vs, 0); /* Accept version */ vnc_write_u8(vs, 1); /* Number of sub-auths */ vnc_write_u32(vs, vs->subauth); /* The supported auth */ vnc_flush(vs); vnc_read_when(vs, protocol_client_vencrypt_auth, 4); } return 0; }
true
qemu
7364dbdabb7824d5bde1e341bb6d928282f01c83
static int protocol_client_vencrypt_init(VncState *vs, uint8_t *data, size_t len) { if (data[0] != 0 || data[1] != 2) { VNC_DEBUG("Unsupported VeNCrypt protocol %d.%d\n", (int)data[0], (int)data[1]); vnc_write_u8(vs, 1); vnc_flush(vs); vnc_client_error(vs); } else { VNC_DEBUG("Sending allowed auth %d\n", vs->subauth); vnc_write_u8(vs, 0); vnc_write_u8(vs, 1); vnc_write_u32(vs, vs->subauth); vnc_flush(vs); vnc_read_when(vs, protocol_client_vencrypt_auth, 4); } return 0; }
{ "code": [ " VNC_DEBUG(\"Unsupported VeNCrypt protocol %d.%d\\n\", (int)data[0], (int)data[1]);", " VNC_DEBUG(\"Sending allowed auth %d\\n\", vs->subauth);" ], "line_no": [ 9, 19 ] }
static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2) { if (VAR_1[0] != 0 || VAR_1[1] != 2) { VNC_DEBUG("Unsupported VeNCrypt protocol %d.%d\n", (int)VAR_1[0], (int)VAR_1[1]); vnc_write_u8(VAR_0, 1); vnc_flush(VAR_0); vnc_client_error(VAR_0); } else { VNC_DEBUG("Sending allowed auth %d\n", VAR_0->subauth); vnc_write_u8(VAR_0, 0); vnc_write_u8(VAR_0, 1); vnc_write_u32(VAR_0, VAR_0->subauth); vnc_flush(VAR_0); vnc_read_when(VAR_0, protocol_client_vencrypt_auth, 4); } return 0; }
[ "static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)\n{", "if (VAR_1[0] != 0 ||\nVAR_1[1] != 2) {", "VNC_DEBUG(\"Unsupported VeNCrypt protocol %d.%d\\n\", (int)VAR_1[0], (int)VAR_1[1]);", "vnc_write_u8(VAR_0, 1);", "vnc_flush(VAR_0);", "vnc_client_error(VAR_0);", "} else {", "VNC_DEBUG(\"Sending allowed auth %d\\n\", VAR_0->subauth);", "vnc_write_u8(VAR_0, 0);", "vnc_write_u8(VAR_0, 1);", "vnc_write_u32(VAR_0, VAR_0->subauth);", "vnc_flush(VAR_0);", "vnc_read_when(VAR_0, protocol_client_vencrypt_auth, 4);", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 1, 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 ] ]
3,379
static always_inline int _pte_check (mmu_ctx_t *ctx, int is_64b, target_ulong pte0, target_ulong pte1, int h, int rw, int type) { target_ulong ptem, mmask; int access, ret, pteh, ptev, pp; access = 0; ret = -1; /* Check validity and table match */ #if defined(TARGET_PPC64) if (is_64b) { ptev = pte64_is_valid(pte0); pteh = (pte0 >> 1) & 1; } else #endif { ptev = pte_is_valid(pte0); pteh = (pte0 >> 6) & 1; } if (ptev && h == pteh) { /* Check vsid & api */ #if defined(TARGET_PPC64) if (is_64b) { ptem = pte0 & PTE64_PTEM_MASK; mmask = PTE64_CHECK_MASK; pp = (pte1 & 0x00000003) | ((pte1 >> 61) & 0x00000004); ctx->nx |= (pte1 >> 2) & 1; /* No execute bit */ ctx->nx |= (pte1 >> 3) & 1; /* Guarded bit */ } else #endif { ptem = pte0 & PTE_PTEM_MASK; mmask = PTE_CHECK_MASK; pp = pte1 & 0x00000003; } if (ptem == ctx->ptem) { if (ctx->raddr != (target_ulong)-1) { /* all matches should have equal RPN, WIMG & PP */ if ((ctx->raddr & mmask) != (pte1 & mmask)) { if (loglevel != 0) fprintf(logfile, "Bad RPN/WIMG/PP\n"); return -3; } } /* Compute access rights */ access = pp_check(ctx->key, pp, ctx->nx); /* Keep the matching PTE informations */ ctx->raddr = pte1; ctx->prot = access; ret = check_prot(ctx->prot, rw, type); if (ret == 0) { /* Access granted */ #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "PTE access granted !\n"); #endif } else { /* Access right violation */ #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "PTE access rejected\n"); #endif } } } return ret; }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
static always_inline int _pte_check (mmu_ctx_t *ctx, int is_64b, target_ulong pte0, target_ulong pte1, int h, int rw, int type) { target_ulong ptem, mmask; int access, ret, pteh, ptev, pp; access = 0; ret = -1; #if defined(TARGET_PPC64) if (is_64b) { ptev = pte64_is_valid(pte0); pteh = (pte0 >> 1) & 1; } else #endif { ptev = pte_is_valid(pte0); pteh = (pte0 >> 6) & 1; } if (ptev && h == pteh) { #if defined(TARGET_PPC64) if (is_64b) { ptem = pte0 & PTE64_PTEM_MASK; mmask = PTE64_CHECK_MASK; pp = (pte1 & 0x00000003) | ((pte1 >> 61) & 0x00000004); ctx->nx |= (pte1 >> 2) & 1; ctx->nx |= (pte1 >> 3) & 1; } else #endif { ptem = pte0 & PTE_PTEM_MASK; mmask = PTE_CHECK_MASK; pp = pte1 & 0x00000003; } if (ptem == ctx->ptem) { if (ctx->raddr != (target_ulong)-1) { if ((ctx->raddr & mmask) != (pte1 & mmask)) { if (loglevel != 0) fprintf(logfile, "Bad RPN/WIMG/PP\n"); return -3; } } access = pp_check(ctx->key, pp, ctx->nx); ctx->raddr = pte1; ctx->prot = access; ret = check_prot(ctx->prot, rw, type); if (ret == 0) { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "PTE access granted !\n"); #endif } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "PTE access rejected\n"); #endif } } } return ret; }
{ "code": [ " if (ctx->raddr != (target_ulong)-1) {" ], "line_no": [ 75 ] }
static always_inline int FUNC_0 (mmu_ctx_t *ctx, int is_64b, target_ulong pte0, target_ulong pte1, int h, int rw, int type) { target_ulong ptem, mmask; int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4; VAR_0 = 0; VAR_1 = -1; #if defined(TARGET_PPC64) if (is_64b) { VAR_3 = pte64_is_valid(pte0); VAR_2 = (pte0 >> 1) & 1; } else #endif { VAR_3 = pte_is_valid(pte0); VAR_2 = (pte0 >> 6) & 1; } if (VAR_3 && h == VAR_2) { #if defined(TARGET_PPC64) if (is_64b) { ptem = pte0 & PTE64_PTEM_MASK; mmask = PTE64_CHECK_MASK; VAR_4 = (pte1 & 0x00000003) | ((pte1 >> 61) & 0x00000004); ctx->nx |= (pte1 >> 2) & 1; ctx->nx |= (pte1 >> 3) & 1; } else #endif { ptem = pte0 & PTE_PTEM_MASK; mmask = PTE_CHECK_MASK; VAR_4 = pte1 & 0x00000003; } if (ptem == ctx->ptem) { if (ctx->raddr != (target_ulong)-1) { if ((ctx->raddr & mmask) != (pte1 & mmask)) { if (loglevel != 0) fprintf(logfile, "Bad RPN/WIMG/PP\n"); return -3; } } VAR_0 = pp_check(ctx->key, VAR_4, ctx->nx); ctx->raddr = pte1; ctx->prot = VAR_0; VAR_1 = check_prot(ctx->prot, rw, type); if (VAR_1 == 0) { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "PTE VAR_0 granted !\n"); #endif } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "PTE VAR_0 rejected\n"); #endif } } } return VAR_1; }
[ "static always_inline int FUNC_0 (mmu_ctx_t *ctx, int is_64b,\ntarget_ulong pte0, target_ulong pte1,\nint h, int rw, int type)\n{", "target_ulong ptem, mmask;", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4;", "VAR_0 = 0;", "VAR_1 = -1;", "#if defined(TARGET_PPC64)\nif (is_64b) {", "VAR_3 = pte64_is_valid(pte0);", "VAR_2 = (pte0 >> 1) & 1;", "} else", "#endif\n{", "VAR_3 = pte_is_valid(pte0);", "VAR_2 = (pte0 >> 6) & 1;", "}", "if (VAR_3 && h == VAR_2) {", "#if defined(TARGET_PPC64)\nif (is_64b) {", "ptem = pte0 & PTE64_PTEM_MASK;", "mmask = PTE64_CHECK_MASK;", "VAR_4 = (pte1 & 0x00000003) | ((pte1 >> 61) & 0x00000004);", "ctx->nx |= (pte1 >> 2) & 1;", "ctx->nx |= (pte1 >> 3) & 1;", "} else", "#endif\n{", "ptem = pte0 & PTE_PTEM_MASK;", "mmask = PTE_CHECK_MASK;", "VAR_4 = pte1 & 0x00000003;", "}", "if (ptem == ctx->ptem) {", "if (ctx->raddr != (target_ulong)-1) {", "if ((ctx->raddr & mmask) != (pte1 & mmask)) {", "if (loglevel != 0)\nfprintf(logfile, \"Bad RPN/WIMG/PP\\n\");", "return -3;", "}", "}", "VAR_0 = pp_check(ctx->key, VAR_4, ctx->nx);", "ctx->raddr = pte1;", "ctx->prot = VAR_0;", "VAR_1 = check_prot(ctx->prot, rw, type);", "if (VAR_1 == 0) {", "#if defined (DEBUG_MMU)\nif (loglevel != 0)\nfprintf(logfile, \"PTE VAR_0 granted !\\n\");", "#endif\n} else {", "#if defined (DEBUG_MMU)\nif (loglevel != 0)\nfprintf(logfile, \"PTE VAR_0 rejected\\n\");", "#endif\n}", "}", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109, 111 ], [ 113, 115 ], [ 119, 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ] ]
3,380
static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal) { const SPS *sps; const PPS *pps; int ret; unsigned int slice_type, tmp, i; int field_pic_flag, bottom_field_flag; int droppable, picture_structure; sl->first_mb_addr = get_ue_golomb(&sl->gb); 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, sl->first_mb_addr); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; sl->slice_type_fixed = 1; } else sl->slice_type_fixed = 0; slice_type = ff_h264_golomb_to_pict_type[slice_type]; sl->slice_type = slice_type; sl->slice_type_nos = slice_type & 3; if (nal->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; } sl->pps_id = get_ue_golomb(&sl->gb); if (sl->pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", sl->pps_id); return AVERROR_INVALIDDATA; } if (!h->ps.pps_list[sl->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", sl->pps_id); return AVERROR_INVALIDDATA; } pps = (const PPS*)h->ps.pps_list[sl->pps_id]->data; if (!h->ps.sps_list[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", pps->sps_id); return AVERROR_INVALIDDATA; } sps = (const SPS*)h->ps.sps_list[pps->sps_id]->data; sl->frame_num = get_bits(&sl->gb, sps->log2_max_frame_num); sl->mb_mbaff = 0; droppable = nal->ref_idc == 0; if (sps->frame_mbs_only_flag) { picture_structure = PICT_FRAME; } else { 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; } } sl->picture_structure = picture_structure; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (picture_structure == PICT_FRAME) { sl->curr_pic_num = sl->frame_num; sl->max_pic_num = 1 << sps->log2_max_frame_num; } else { sl->curr_pic_num = 2 * sl->frame_num + 1; sl->max_pic_num = 1 << (sps->log2_max_frame_num + 1); } if (nal->type == NAL_IDR_SLICE) get_ue_golomb(&sl->gb); /* idr_pic_id */ if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc_bottom = get_se_golomb(&sl->gb); } if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { sl->delta_poc[0] = get_se_golomb(&sl->gb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc[1] = get_se_golomb(&sl->gb); } if (pps->redundant_pic_cnt_present) sl->redundant_pic_count = get_ue_golomb(&sl->gb); if (sl->slice_type_nos == AV_PICTURE_TYPE_B) sl->direct_spatial_mv_pred = get_bits1(&sl->gb); ret = ff_h264_parse_ref_count(&sl->list_count, sl->ref_count, &sl->gb, pps, sl->slice_type_nos, picture_structure); if (ret < 0) return ret; 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; } } sl->pwt.use_weight = 0; for (i = 0; i < 2; i++) { sl->pwt.luma_weight_flag[i] = 0; sl->pwt.chroma_weight_flag[i] = 0; } if ((pps->weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (pps->weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count, sl->slice_type_nos, &sl->pwt); sl->explicit_ref_marking = 0; if (nal->ref_idc) { ret = ff_h264_decode_ref_pic_marking(h, sl, &sl->gb); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (sl->slice_type_nos != AV_PICTURE_TYPE_I && 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 = pps->init_qp + get_se_golomb(&sl->gb); if (tmp > 51 + 6 * (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(pps, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(pps, 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 (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; } } } return 0; }
false
FFmpeg
5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c
static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, const H2645NAL *nal) { const SPS *sps; const PPS *pps; int ret; unsigned int slice_type, tmp, i; int field_pic_flag, bottom_field_flag; int droppable, picture_structure; sl->first_mb_addr = get_ue_golomb(&sl->gb); 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, sl->first_mb_addr); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; sl->slice_type_fixed = 1; } else sl->slice_type_fixed = 0; slice_type = ff_h264_golomb_to_pict_type[slice_type]; sl->slice_type = slice_type; sl->slice_type_nos = slice_type & 3; if (nal->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; } sl->pps_id = get_ue_golomb(&sl->gb); if (sl->pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", sl->pps_id); return AVERROR_INVALIDDATA; } if (!h->ps.pps_list[sl->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", sl->pps_id); return AVERROR_INVALIDDATA; } pps = (const PPS*)h->ps.pps_list[sl->pps_id]->data; if (!h->ps.sps_list[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", pps->sps_id); return AVERROR_INVALIDDATA; } sps = (const SPS*)h->ps.sps_list[pps->sps_id]->data; sl->frame_num = get_bits(&sl->gb, sps->log2_max_frame_num); sl->mb_mbaff = 0; droppable = nal->ref_idc == 0; if (sps->frame_mbs_only_flag) { picture_structure = PICT_FRAME; } else { 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; } } sl->picture_structure = picture_structure; sl->mb_field_decoding_flag = picture_structure != PICT_FRAME; if (picture_structure == PICT_FRAME) { sl->curr_pic_num = sl->frame_num; sl->max_pic_num = 1 << sps->log2_max_frame_num; } else { sl->curr_pic_num = 2 * sl->frame_num + 1; sl->max_pic_num = 1 << (sps->log2_max_frame_num + 1); } if (nal->type == NAL_IDR_SLICE) get_ue_golomb(&sl->gb); if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc_bottom = get_se_golomb(&sl->gb); } if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { sl->delta_poc[0] = get_se_golomb(&sl->gb); if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) sl->delta_poc[1] = get_se_golomb(&sl->gb); } if (pps->redundant_pic_cnt_present) sl->redundant_pic_count = get_ue_golomb(&sl->gb); if (sl->slice_type_nos == AV_PICTURE_TYPE_B) sl->direct_spatial_mv_pred = get_bits1(&sl->gb); ret = ff_h264_parse_ref_count(&sl->list_count, sl->ref_count, &sl->gb, pps, sl->slice_type_nos, picture_structure); if (ret < 0) return ret; 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; } } sl->pwt.use_weight = 0; for (i = 0; i < 2; i++) { sl->pwt.luma_weight_flag[i] = 0; sl->pwt.chroma_weight_flag[i] = 0; } if ((pps->weighted_pred && sl->slice_type_nos == AV_PICTURE_TYPE_P) || (pps->weighted_bipred_idc == 1 && sl->slice_type_nos == AV_PICTURE_TYPE_B)) ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count, sl->slice_type_nos, &sl->pwt); sl->explicit_ref_marking = 0; if (nal->ref_idc) { ret = ff_h264_decode_ref_pic_marking(h, sl, &sl->gb); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (sl->slice_type_nos != AV_PICTURE_TYPE_I && 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 = pps->init_qp + get_se_golomb(&sl->gb); if (tmp > 51 + 6 * (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(pps, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(pps, 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 (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; } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1, const H2645NAL *VAR_2) { const SPS *VAR_3; const PPS *VAR_4; int VAR_5; unsigned int VAR_6, VAR_7, VAR_8; int VAR_9, VAR_10; int VAR_11, VAR_12; VAR_1->first_mb_addr = get_ue_golomb(&VAR_1->gb); VAR_6 = get_ue_golomb_31(&VAR_1->gb); if (VAR_6 > 9) { av_log(VAR_0->avctx, AV_LOG_ERROR, "slice type %d too large at %d\n", VAR_6, VAR_1->first_mb_addr); return AVERROR_INVALIDDATA; } if (VAR_6 > 4) { VAR_6 -= 5; VAR_1->slice_type_fixed = 1; } else VAR_1->slice_type_fixed = 0; VAR_6 = ff_h264_golomb_to_pict_type[VAR_6]; VAR_1->VAR_6 = VAR_6; VAR_1->slice_type_nos = VAR_6 & 3; if (VAR_2->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; } VAR_1->pps_id = get_ue_golomb(&VAR_1->gb); if (VAR_1->pps_id >= MAX_PPS_COUNT) { av_log(VAR_0->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", VAR_1->pps_id); return AVERROR_INVALIDDATA; } if (!VAR_0->ps.pps_list[VAR_1->pps_id]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", VAR_1->pps_id); return AVERROR_INVALIDDATA; } VAR_4 = (const PPS*)VAR_0->ps.pps_list[VAR_1->pps_id]->data; if (!VAR_0->ps.sps_list[VAR_4->sps_id]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", VAR_4->sps_id); return AVERROR_INVALIDDATA; } VAR_3 = (const SPS*)VAR_0->ps.sps_list[VAR_4->sps_id]->data; VAR_1->frame_num = get_bits(&VAR_1->gb, VAR_3->log2_max_frame_num); VAR_1->mb_mbaff = 0; VAR_11 = VAR_2->ref_idc == 0; if (VAR_3->frame_mbs_only_flag) { VAR_12 = PICT_FRAME; } else { VAR_9 = get_bits1(&VAR_1->gb); if (VAR_9) { VAR_10 = get_bits1(&VAR_1->gb); VAR_12 = PICT_TOP_FIELD + VAR_10; } else { VAR_12 = PICT_FRAME; } } VAR_1->VAR_12 = VAR_12; VAR_1->mb_field_decoding_flag = VAR_12 != PICT_FRAME; if (VAR_12 == PICT_FRAME) { VAR_1->curr_pic_num = VAR_1->frame_num; VAR_1->max_pic_num = 1 << VAR_3->log2_max_frame_num; } else { VAR_1->curr_pic_num = 2 * VAR_1->frame_num + 1; VAR_1->max_pic_num = 1 << (VAR_3->log2_max_frame_num + 1); } if (VAR_2->type == NAL_IDR_SLICE) get_ue_golomb(&VAR_1->gb); if (VAR_3->poc_type == 0) { VAR_1->poc_lsb = get_bits(&VAR_1->gb, VAR_3->log2_max_poc_lsb); if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME) VAR_1->delta_poc_bottom = get_se_golomb(&VAR_1->gb); } if (VAR_3->poc_type == 1 && !VAR_3->delta_pic_order_always_zero_flag) { VAR_1->delta_poc[0] = get_se_golomb(&VAR_1->gb); if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME) VAR_1->delta_poc[1] = get_se_golomb(&VAR_1->gb); } if (VAR_4->redundant_pic_cnt_present) VAR_1->redundant_pic_count = get_ue_golomb(&VAR_1->gb); if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_B) VAR_1->direct_spatial_mv_pred = get_bits1(&VAR_1->gb); VAR_5 = ff_h264_parse_ref_count(&VAR_1->list_count, VAR_1->ref_count, &VAR_1->gb, VAR_4, VAR_1->slice_type_nos, VAR_12); if (VAR_5 < 0) return VAR_5; if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) { VAR_5 = ff_h264_decode_ref_pic_list_reordering(VAR_0, VAR_1); if (VAR_5 < 0) { VAR_1->ref_count[1] = VAR_1->ref_count[0] = 0; return VAR_5; } } VAR_1->pwt.use_weight = 0; for (VAR_8 = 0; VAR_8 < 2; VAR_8++) { VAR_1->pwt.luma_weight_flag[VAR_8] = 0; VAR_1->pwt.chroma_weight_flag[VAR_8] = 0; } if ((VAR_4->weighted_pred && VAR_1->slice_type_nos == AV_PICTURE_TYPE_P) || (VAR_4->weighted_bipred_idc == 1 && VAR_1->slice_type_nos == AV_PICTURE_TYPE_B)) ff_h264_pred_weight_table(&VAR_1->gb, VAR_3, VAR_1->ref_count, VAR_1->slice_type_nos, &VAR_1->pwt); VAR_1->explicit_ref_marking = 0; if (VAR_2->ref_idc) { VAR_5 = ff_h264_decode_ref_pic_marking(VAR_0, VAR_1, &VAR_1->gb); if (VAR_5 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I && VAR_4->cabac) { VAR_7 = get_ue_golomb_31(&VAR_1->gb); if (VAR_7 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_1->cabac_init_idc = VAR_7; } VAR_1->last_qscale_diff = 0; VAR_7 = VAR_4->init_qp + get_se_golomb(&VAR_1->gb); if (VAR_7 > 51 + 6 * (VAR_3->bit_depth_luma - 8)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "QP %u out of range\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_1->qscale = VAR_7; VAR_1->chroma_qp[0] = get_chroma_qp(VAR_4, 0, VAR_1->qscale); VAR_1->chroma_qp[1] = get_chroma_qp(VAR_4, 1, VAR_1->qscale); if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP) get_bits1(&VAR_1->gb); if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP || VAR_1->VAR_6 == 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_4->deblocking_filter_parameters_present) { VAR_7 = get_ue_golomb_31(&VAR_1->gb); if (VAR_7 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", VAR_7); return AVERROR_INVALIDDATA; } VAR_1->deblocking_filter = VAR_7; 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; } } } return 0; }
[ "static int FUNC_0(const H264Context *VAR_0, H264SliceContext *VAR_1,\nconst H2645NAL *VAR_2)\n{", "const SPS *VAR_3;", "const PPS *VAR_4;", "int VAR_5;", "unsigned int VAR_6, VAR_7, VAR_8;", "int VAR_9, VAR_10;", "int VAR_11, VAR_12;", "VAR_1->first_mb_addr = get_ue_golomb(&VAR_1->gb);", "VAR_6 = get_ue_golomb_31(&VAR_1->gb);", "if (VAR_6 > 9) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"slice type %d too large at %d\\n\",\nVAR_6, VAR_1->first_mb_addr);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_6 > 4) {", "VAR_6 -= 5;", "VAR_1->slice_type_fixed = 1;", "} else", "VAR_1->slice_type_fixed = 0;", "VAR_6 = ff_h264_golomb_to_pict_type[VAR_6];", "VAR_1->VAR_6 = VAR_6;", "VAR_1->slice_type_nos = VAR_6 & 3;", "if (VAR_2->type == NAL_IDR_SLICE &&\nVAR_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;", "}", "VAR_1->pps_id = get_ue_golomb(&VAR_1->gb);", "if (VAR_1->pps_id >= MAX_PPS_COUNT) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"pps_id %u out of range\\n\", VAR_1->pps_id);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_0->ps.pps_list[VAR_1->pps_id]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"non-existing PPS %u referenced\\n\",\nVAR_1->pps_id);", "return AVERROR_INVALIDDATA;", "}", "VAR_4 = (const PPS*)VAR_0->ps.pps_list[VAR_1->pps_id]->data;", "if (!VAR_0->ps.sps_list[VAR_4->sps_id]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"non-existing SPS %u referenced\\n\", VAR_4->sps_id);", "return AVERROR_INVALIDDATA;", "}", "VAR_3 = (const SPS*)VAR_0->ps.sps_list[VAR_4->sps_id]->data;", "VAR_1->frame_num = get_bits(&VAR_1->gb, VAR_3->log2_max_frame_num);", "VAR_1->mb_mbaff = 0;", "VAR_11 = VAR_2->ref_idc == 0;", "if (VAR_3->frame_mbs_only_flag) {", "VAR_12 = PICT_FRAME;", "} else {", "VAR_9 = get_bits1(&VAR_1->gb);", "if (VAR_9) {", "VAR_10 = get_bits1(&VAR_1->gb);", "VAR_12 = PICT_TOP_FIELD + VAR_10;", "} else {", "VAR_12 = PICT_FRAME;", "}", "}", "VAR_1->VAR_12 = VAR_12;", "VAR_1->mb_field_decoding_flag = VAR_12 != PICT_FRAME;", "if (VAR_12 == PICT_FRAME) {", "VAR_1->curr_pic_num = VAR_1->frame_num;", "VAR_1->max_pic_num = 1 << VAR_3->log2_max_frame_num;", "} else {", "VAR_1->curr_pic_num = 2 * VAR_1->frame_num + 1;", "VAR_1->max_pic_num = 1 << (VAR_3->log2_max_frame_num + 1);", "}", "if (VAR_2->type == NAL_IDR_SLICE)\nget_ue_golomb(&VAR_1->gb);", "if (VAR_3->poc_type == 0) {", "VAR_1->poc_lsb = get_bits(&VAR_1->gb, VAR_3->log2_max_poc_lsb);", "if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME)\nVAR_1->delta_poc_bottom = get_se_golomb(&VAR_1->gb);", "}", "if (VAR_3->poc_type == 1 && !VAR_3->delta_pic_order_always_zero_flag) {", "VAR_1->delta_poc[0] = get_se_golomb(&VAR_1->gb);", "if (VAR_4->pic_order_present == 1 && VAR_12 == PICT_FRAME)\nVAR_1->delta_poc[1] = get_se_golomb(&VAR_1->gb);", "}", "if (VAR_4->redundant_pic_cnt_present)\nVAR_1->redundant_pic_count = get_ue_golomb(&VAR_1->gb);", "if (VAR_1->slice_type_nos == AV_PICTURE_TYPE_B)\nVAR_1->direct_spatial_mv_pred = get_bits1(&VAR_1->gb);", "VAR_5 = ff_h264_parse_ref_count(&VAR_1->list_count, VAR_1->ref_count,\n&VAR_1->gb, VAR_4, VAR_1->slice_type_nos,\nVAR_12);", "if (VAR_5 < 0)\nreturn VAR_5;", "if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I) {", "VAR_5 = ff_h264_decode_ref_pic_list_reordering(VAR_0, VAR_1);", "if (VAR_5 < 0) {", "VAR_1->ref_count[1] = VAR_1->ref_count[0] = 0;", "return VAR_5;", "}", "}", "VAR_1->pwt.use_weight = 0;", "for (VAR_8 = 0; VAR_8 < 2; VAR_8++) {", "VAR_1->pwt.luma_weight_flag[VAR_8] = 0;", "VAR_1->pwt.chroma_weight_flag[VAR_8] = 0;", "}", "if ((VAR_4->weighted_pred && VAR_1->slice_type_nos == AV_PICTURE_TYPE_P) ||\n(VAR_4->weighted_bipred_idc == 1 &&\nVAR_1->slice_type_nos == AV_PICTURE_TYPE_B))\nff_h264_pred_weight_table(&VAR_1->gb, VAR_3, VAR_1->ref_count,\nVAR_1->slice_type_nos, &VAR_1->pwt);", "VAR_1->explicit_ref_marking = 0;", "if (VAR_2->ref_idc) {", "VAR_5 = ff_h264_decode_ref_pic_marking(VAR_0, VAR_1, &VAR_1->gb);", "if (VAR_5 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\nreturn AVERROR_INVALIDDATA;", "}", "if (VAR_1->slice_type_nos != AV_PICTURE_TYPE_I && VAR_4->cabac) {", "VAR_7 = get_ue_golomb_31(&VAR_1->gb);", "if (VAR_7 > 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"cabac_init_idc %u overflow\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->cabac_init_idc = VAR_7;", "}", "VAR_1->last_qscale_diff = 0;", "VAR_7 = VAR_4->init_qp + get_se_golomb(&VAR_1->gb);", "if (VAR_7 > 51 + 6 * (VAR_3->bit_depth_luma - 8)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"QP %u out of range\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->qscale = VAR_7;", "VAR_1->chroma_qp[0] = get_chroma_qp(VAR_4, 0, VAR_1->qscale);", "VAR_1->chroma_qp[1] = get_chroma_qp(VAR_4, 1, VAR_1->qscale);", "if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP)\nget_bits1(&VAR_1->gb);", "if (VAR_1->VAR_6 == AV_PICTURE_TYPE_SP ||\nVAR_1->VAR_6 == AV_PICTURE_TYPE_SI)\nget_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_4->deblocking_filter_parameters_present) {", "VAR_7 = get_ue_golomb_31(&VAR_1->gb);", "if (VAR_7 > 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"deblocking_filter_idc %u out of range\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->deblocking_filter = VAR_7;", "if (VAR_1->deblocking_filter < 2)\nVAR_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 ||\nVAR_1->slice_alpha_c0_offset < -12 ||\nVAR_1->slice_beta_offset > 12 ||\nVAR_1->slice_beta_offset < -12) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"deblocking filter parameters %d %d out of range\\n\",\nVAR_1->slice_alpha_c0_offset, VAR_1->slice_beta_offset);", "return AVERROR_INVALIDDATA;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 171 ], [ 173 ], [ 177, 179 ], [ 181 ], [ 185 ], [ 187 ], [ 191, 193 ], [ 195 ], [ 199, 201 ], [ 205, 207 ], [ 211, 213, 215 ], [ 217, 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251, 253, 255, 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313, 315 ], [ 317, 319, 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 353 ], [ 355 ], [ 357 ], [ 359, 361, 363, 365 ], [ 367, 369, 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 383 ], [ 385 ] ]
3,381
static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { NUTContext * priv = avf->priv_data; ByteIOContext * bc = &avf->pb; nut_demuxer_opts_t dopts = { .input = { .priv = bc, .seek = av_seek, .read = av_read, .eof = NULL, .file_pos = 0, }, .alloc = { av_malloc, av_realloc, av_free }, .read_index = 1, .cache_syncpoints = 1, }; nut_context_t * nut = priv->nut = nut_demuxer_init(&dopts); nut_stream_header_t * s; int ret, i; if ((ret = nut_read_headers(nut, &s, NULL))) { if (ret < 0) av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(-ret)); nut_demuxer_uninit(nut); return -1; } priv->s = s; for (i = 0; s[i].type != -1 && i < 2; i++) { AVStream * st = av_new_stream(avf, i); int j; for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); st->codec->has_b_frames = s[i].decode_delay; st->codec->extradata_size = s[i].codec_specific_len; if (st->codec->extradata_size) { st->codec->extradata = av_mallocz(st->codec->extradata_size); memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size); } av_set_pts_info(avf->streams[i], 60, s[i].time_base.nom, s[i].time_base.den); st->start_time = 0; st->duration = s[i].max_pts; st->codec->codec_id = codec_get_id(nut_tags, st->codec->codec_tag); switch(s[i].type) { case NUT_AUDIO_CLASS: st->codec->codec_type = CODEC_TYPE_AUDIO; if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_wav_id(st->codec->codec_tag); st->codec->channels = s[i].channel_count; st->codec->sample_rate = s[i].samplerate_nom / s[i].samplerate_denom; break; case NUT_VIDEO_CLASS: st->codec->codec_type = CODEC_TYPE_VIDEO; if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_bmp_id(st->codec->codec_tag); st->codec->width = s[i].width; st->codec->height = s[i].height; st->codec->sample_aspect_ratio.num = s[i].sample_width; st->codec->sample_aspect_ratio.den = s[i].sample_height; break; } if (st->codec->codec_id == CODEC_ID_NONE) av_log(avf, AV_LOG_ERROR, "Unknown codec?!\n"); } return 0; }
false
FFmpeg
e4bb70838f0c3092a9b893f2210e7c303f0f2a4a
static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { NUTContext * priv = avf->priv_data; ByteIOContext * bc = &avf->pb; nut_demuxer_opts_t dopts = { .input = { .priv = bc, .seek = av_seek, .read = av_read, .eof = NULL, .file_pos = 0, }, .alloc = { av_malloc, av_realloc, av_free }, .read_index = 1, .cache_syncpoints = 1, }; nut_context_t * nut = priv->nut = nut_demuxer_init(&dopts); nut_stream_header_t * s; int ret, i; if ((ret = nut_read_headers(nut, &s, NULL))) { if (ret < 0) av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(-ret)); nut_demuxer_uninit(nut); return -1; } priv->s = s; for (i = 0; s[i].type != -1 && i < 2; i++) { AVStream * st = av_new_stream(avf, i); int j; for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); st->codec->has_b_frames = s[i].decode_delay; st->codec->extradata_size = s[i].codec_specific_len; if (st->codec->extradata_size) { st->codec->extradata = av_mallocz(st->codec->extradata_size); memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size); } av_set_pts_info(avf->streams[i], 60, s[i].time_base.nom, s[i].time_base.den); st->start_time = 0; st->duration = s[i].max_pts; st->codec->codec_id = codec_get_id(nut_tags, st->codec->codec_tag); switch(s[i].type) { case NUT_AUDIO_CLASS: st->codec->codec_type = CODEC_TYPE_AUDIO; if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_wav_id(st->codec->codec_tag); st->codec->channels = s[i].channel_count; st->codec->sample_rate = s[i].samplerate_nom / s[i].samplerate_denom; break; case NUT_VIDEO_CLASS: st->codec->codec_type = CODEC_TYPE_VIDEO; if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_bmp_id(st->codec->codec_tag); st->codec->width = s[i].width; st->codec->height = s[i].height; st->codec->sample_aspect_ratio.num = s[i].sample_width; st->codec->sample_aspect_ratio.den = s[i].sample_height; break; } if (st->codec->codec_id == CODEC_ID_NONE) av_log(avf, AV_LOG_ERROR, "Unknown codec?!\n"); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext * VAR_0, AVFormatParameters * VAR_1) { NUTContext * priv = VAR_0->priv_data; ByteIOContext * bc = &VAR_0->pb; nut_demuxer_opts_t dopts = { .input = { .priv = bc, .seek = av_seek, .read = av_read, .eof = NULL, .file_pos = 0, }, .alloc = { av_malloc, av_realloc, av_free }, .read_index = 1, .cache_syncpoints = 1, }; nut_context_t * nut = priv->nut = nut_demuxer_init(&dopts); nut_stream_header_t * s; int VAR_2, VAR_3; if ((VAR_2 = nut_read_headers(nut, &s, NULL))) { if (VAR_2 < 0) av_log(VAR_0, AV_LOG_ERROR, " NUT error: %s\n", nut_error(-VAR_2)); nut_demuxer_uninit(nut); return -1; } priv->s = s; for (VAR_3 = 0; s[VAR_3].type != -1 && VAR_3 < 2; VAR_3++) { AVStream * st = av_new_stream(VAR_0, VAR_3); int j; for (j = 0; j < s[VAR_3].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[VAR_3].fourcc[j]<<(j*8); st->codec->has_b_frames = s[VAR_3].decode_delay; st->codec->extradata_size = s[VAR_3].codec_specific_len; if (st->codec->extradata_size) { st->codec->extradata = av_mallocz(st->codec->extradata_size); memcpy(st->codec->extradata, s[VAR_3].codec_specific, st->codec->extradata_size); } av_set_pts_info(VAR_0->streams[VAR_3], 60, s[VAR_3].time_base.nom, s[VAR_3].time_base.den); st->start_time = 0; st->duration = s[VAR_3].max_pts; st->codec->codec_id = codec_get_id(nut_tags, st->codec->codec_tag); switch(s[VAR_3].type) { case NUT_AUDIO_CLASS: st->codec->codec_type = CODEC_TYPE_AUDIO; if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_wav_id(st->codec->codec_tag); st->codec->channels = s[VAR_3].channel_count; st->codec->sample_rate = s[VAR_3].samplerate_nom / s[VAR_3].samplerate_denom; break; case NUT_VIDEO_CLASS: st->codec->codec_type = CODEC_TYPE_VIDEO; if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_bmp_id(st->codec->codec_tag); st->codec->width = s[VAR_3].width; st->codec->height = s[VAR_3].height; st->codec->sample_aspect_ratio.num = s[VAR_3].sample_width; st->codec->sample_aspect_ratio.den = s[VAR_3].sample_height; break; } if (st->codec->codec_id == CODEC_ID_NONE) av_log(VAR_0, AV_LOG_ERROR, "Unknown codec?!\n"); } return 0; }
[ "static int FUNC_0(AVFormatContext * VAR_0, AVFormatParameters * VAR_1) {", "NUTContext * priv = VAR_0->priv_data;", "ByteIOContext * bc = &VAR_0->pb;", "nut_demuxer_opts_t dopts = {", ".input = {", ".priv = bc,\n.seek = av_seek,\n.read = av_read,\n.eof = NULL,\n.file_pos = 0,\n},", ".alloc = { av_malloc, av_realloc, av_free },", ".read_index = 1,\n.cache_syncpoints = 1,\n};", "nut_context_t * nut = priv->nut = nut_demuxer_init(&dopts);", "nut_stream_header_t * s;", "int VAR_2, VAR_3;", "if ((VAR_2 = nut_read_headers(nut, &s, NULL))) {", "if (VAR_2 < 0) av_log(VAR_0, AV_LOG_ERROR, \" NUT error: %s\\n\", nut_error(-VAR_2));", "nut_demuxer_uninit(nut);", "return -1;", "}", "priv->s = s;", "for (VAR_3 = 0; s[VAR_3].type != -1 && VAR_3 < 2; VAR_3++) {", "AVStream * st = av_new_stream(VAR_0, VAR_3);", "int j;", "for (j = 0; j < s[VAR_3].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[VAR_3].fourcc[j]<<(j*8);", "st->codec->has_b_frames = s[VAR_3].decode_delay;", "st->codec->extradata_size = s[VAR_3].codec_specific_len;", "if (st->codec->extradata_size) {", "st->codec->extradata = av_mallocz(st->codec->extradata_size);", "memcpy(st->codec->extradata, s[VAR_3].codec_specific, st->codec->extradata_size);", "}", "av_set_pts_info(VAR_0->streams[VAR_3], 60, s[VAR_3].time_base.nom, s[VAR_3].time_base.den);", "st->start_time = 0;", "st->duration = s[VAR_3].max_pts;", "st->codec->codec_id = codec_get_id(nut_tags, st->codec->codec_tag);", "switch(s[VAR_3].type) {", "case NUT_AUDIO_CLASS:\nst->codec->codec_type = CODEC_TYPE_AUDIO;", "if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_wav_id(st->codec->codec_tag);", "st->codec->channels = s[VAR_3].channel_count;", "st->codec->sample_rate = s[VAR_3].samplerate_nom / s[VAR_3].samplerate_denom;", "break;", "case NUT_VIDEO_CLASS:\nst->codec->codec_type = CODEC_TYPE_VIDEO;", "if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_bmp_id(st->codec->codec_tag);", "st->codec->width = s[VAR_3].width;", "st->codec->height = s[VAR_3].height;", "st->codec->sample_aspect_ratio.num = s[VAR_3].sample_width;", "st->codec->sample_aspect_ratio.den = s[VAR_3].sample_height;", "break;", "}", "if (st->codec->codec_id == CODEC_ID_NONE) av_log(VAR_0, AV_LOG_ERROR, \"Unknown codec?!\\n\");", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15, 17, 19, 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ] ]
3,382
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) { GetBitContext gb; int i; init_get_bits(&gb, src, length * 8); for (i = 0; i < 3; i++) { if (read_len_table(s->len[i], &gb) < 0) return -1; if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) { return -1; } ff_free_vlc(&s->vlc[i]); init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); } generate_joint_tables(s); return (get_bits_count(&gb) + 7) / 8; }
false
FFmpeg
f67a0d115254461649470452058fa3c28c0df294
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) { GetBitContext gb; int i; init_get_bits(&gb, src, length * 8); for (i = 0; i < 3; i++) { if (read_len_table(s->len[i], &gb) < 0) return -1; if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) { return -1; } ff_free_vlc(&s->vlc[i]); init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); } generate_joint_tables(s); return (get_bits_count(&gb) + 7) / 8; }
{ "code": [], "line_no": [] }
static int FUNC_0(HYuvContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { GetBitContext gb; int VAR_3; init_get_bits(&gb, VAR_1, VAR_2 * 8); for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { if (read_len_table(VAR_0->len[VAR_3], &gb) < 0) return -1; if (ff_huffyuv_generate_bits_table(VAR_0->bits[VAR_3], VAR_0->len[VAR_3]) < 0) { return -1; } ff_free_vlc(&VAR_0->vlc[VAR_3]); init_vlc(&VAR_0->vlc[VAR_3], VLC_BITS, 256, VAR_0->len[VAR_3], 1, 1, VAR_0->bits[VAR_3], 4, 4, 0); } generate_joint_tables(VAR_0); return (get_bits_count(&gb) + 7) / 8; }
[ "static int FUNC_0(HYuvContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "GetBitContext gb;", "int VAR_3;", "init_get_bits(&gb, VAR_1, VAR_2 * 8);", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "if (read_len_table(VAR_0->len[VAR_3], &gb) < 0)\nreturn -1;", "if (ff_huffyuv_generate_bits_table(VAR_0->bits[VAR_3], VAR_0->len[VAR_3]) < 0) {", "return -1;", "}", "ff_free_vlc(&VAR_0->vlc[VAR_3]);", "init_vlc(&VAR_0->vlc[VAR_3], VLC_BITS, 256, VAR_0->len[VAR_3], 1, 1,\nVAR_0->bits[VAR_3], 4, 4, 0);", "}", "generate_joint_tables(VAR_0);", "return (get_bits_count(&gb) + 7) / 8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ] ]
3,384
static int h264_slice_header_init(H264Context *h, int reinit) { int nb_slices = (HAVE_THREADS && h->avctx->active_thread_type & FF_THREAD_SLICE) ? h->avctx->thread_count : 1; int i, ret; h->avctx->sample_aspect_ratio = h->sps.sar; av_assert0(h->avctx->sample_aspect_ratio.den); av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt, &h->chroma_x_shift, &h->chroma_y_shift); if (h->sps.timing_info_present_flag) { int64_t den = h->sps.time_scale; if (h->x264_build < 44U) den *= 2; av_reduce(&h->avctx->time_base.num, &h->avctx->time_base.den, h->sps.num_units_in_tick, den, 1 << 30); } if (reinit) ff_h264_free_tables(h, 0); h->first_field = 0; h->prev_interlaced_frame = 1; init_scan_tables(h); ret = ff_h264_alloc_tables(h); if (ret < 0) { av_log(h->avctx, AV_LOG_ERROR, "Could not allocate memory\n"); return ret; } if (nb_slices > H264_MAX_THREADS || (nb_slices > h->mb_height && h->mb_height)) { int max_slices; if (h->mb_height) max_slices = FFMIN(H264_MAX_THREADS, h->mb_height); else max_slices = H264_MAX_THREADS; av_log(h->avctx, AV_LOG_WARNING, "too many threads/slices %d," " reducing to %d\n", nb_slices, max_slices); nb_slices = max_slices; } h->slice_context_count = nb_slices; if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) { ret = ff_h264_context_init(h); if (ret < 0) { av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return ret; } } else { for (i = 1; i < h->slice_context_count; i++) { H264Context *c; c = h->thread_context[i] = av_mallocz(sizeof(H264Context)); if (!c) return AVERROR(ENOMEM); c->avctx = h->avctx; c->dsp = h->dsp; c->vdsp = h->vdsp; c->h264dsp = h->h264dsp; c->h264qpel = h->h264qpel; c->h264chroma = h->h264chroma; c->sps = h->sps; c->pps = h->pps; c->pixel_shift = h->pixel_shift; c->width = h->width; c->height = h->height; c->linesize = h->linesize; c->uvlinesize = h->uvlinesize; c->chroma_x_shift = h->chroma_x_shift; c->chroma_y_shift = h->chroma_y_shift; c->qscale = h->qscale; c->droppable = h->droppable; c->data_partitioning = h->data_partitioning; c->low_delay = h->low_delay; c->mb_width = h->mb_width; c->mb_height = h->mb_height; c->mb_stride = h->mb_stride; c->mb_num = h->mb_num; c->flags = h->flags; c->workaround_bugs = h->workaround_bugs; c->pict_type = h->pict_type; init_scan_tables(c); clone_tables(c, h, i); c->context_initialized = 1; } for (i = 0; i < h->slice_context_count; i++) if ((ret = ff_h264_context_init(h->thread_context[i])) < 0) { av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return ret; } } h->context_initialized = 1; return 0; }
false
FFmpeg
9e500efdbe0deeff1602500ebc229a0a6b6bb1a2
static int h264_slice_header_init(H264Context *h, int reinit) { int nb_slices = (HAVE_THREADS && h->avctx->active_thread_type & FF_THREAD_SLICE) ? h->avctx->thread_count : 1; int i, ret; h->avctx->sample_aspect_ratio = h->sps.sar; av_assert0(h->avctx->sample_aspect_ratio.den); av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt, &h->chroma_x_shift, &h->chroma_y_shift); if (h->sps.timing_info_present_flag) { int64_t den = h->sps.time_scale; if (h->x264_build < 44U) den *= 2; av_reduce(&h->avctx->time_base.num, &h->avctx->time_base.den, h->sps.num_units_in_tick, den, 1 << 30); } if (reinit) ff_h264_free_tables(h, 0); h->first_field = 0; h->prev_interlaced_frame = 1; init_scan_tables(h); ret = ff_h264_alloc_tables(h); if (ret < 0) { av_log(h->avctx, AV_LOG_ERROR, "Could not allocate memory\n"); return ret; } if (nb_slices > H264_MAX_THREADS || (nb_slices > h->mb_height && h->mb_height)) { int max_slices; if (h->mb_height) max_slices = FFMIN(H264_MAX_THREADS, h->mb_height); else max_slices = H264_MAX_THREADS; av_log(h->avctx, AV_LOG_WARNING, "too many threads/slices %d," " reducing to %d\n", nb_slices, max_slices); nb_slices = max_slices; } h->slice_context_count = nb_slices; if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) { ret = ff_h264_context_init(h); if (ret < 0) { av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return ret; } } else { for (i = 1; i < h->slice_context_count; i++) { H264Context *c; c = h->thread_context[i] = av_mallocz(sizeof(H264Context)); if (!c) return AVERROR(ENOMEM); c->avctx = h->avctx; c->dsp = h->dsp; c->vdsp = h->vdsp; c->h264dsp = h->h264dsp; c->h264qpel = h->h264qpel; c->h264chroma = h->h264chroma; c->sps = h->sps; c->pps = h->pps; c->pixel_shift = h->pixel_shift; c->width = h->width; c->height = h->height; c->linesize = h->linesize; c->uvlinesize = h->uvlinesize; c->chroma_x_shift = h->chroma_x_shift; c->chroma_y_shift = h->chroma_y_shift; c->qscale = h->qscale; c->droppable = h->droppable; c->data_partitioning = h->data_partitioning; c->low_delay = h->low_delay; c->mb_width = h->mb_width; c->mb_height = h->mb_height; c->mb_stride = h->mb_stride; c->mb_num = h->mb_num; c->flags = h->flags; c->workaround_bugs = h->workaround_bugs; c->pict_type = h->pict_type; init_scan_tables(c); clone_tables(c, h, i); c->context_initialized = 1; } for (i = 0; i < h->slice_context_count; i++) if ((ret = ff_h264_context_init(h->thread_context[i])) < 0) { av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return ret; } } h->context_initialized = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0, int VAR_1) { int VAR_2 = (HAVE_THREADS && VAR_0->avctx->active_thread_type & FF_THREAD_SLICE) ? VAR_0->avctx->thread_count : 1; int VAR_3, VAR_4; VAR_0->avctx->sample_aspect_ratio = VAR_0->sps.sar; av_assert0(VAR_0->avctx->sample_aspect_ratio.den); av_pix_fmt_get_chroma_sub_sample(VAR_0->avctx->pix_fmt, &VAR_0->chroma_x_shift, &VAR_0->chroma_y_shift); if (VAR_0->sps.timing_info_present_flag) { int64_t den = VAR_0->sps.time_scale; if (VAR_0->x264_build < 44U) den *= 2; av_reduce(&VAR_0->avctx->time_base.num, &VAR_0->avctx->time_base.den, VAR_0->sps.num_units_in_tick, den, 1 << 30); } if (VAR_1) ff_h264_free_tables(VAR_0, 0); VAR_0->first_field = 0; VAR_0->prev_interlaced_frame = 1; init_scan_tables(VAR_0); VAR_4 = ff_h264_alloc_tables(VAR_0); if (VAR_4 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Could not allocate memory\n"); return VAR_4; } if (VAR_2 > H264_MAX_THREADS || (VAR_2 > VAR_0->mb_height && VAR_0->mb_height)) { int VAR_5; if (VAR_0->mb_height) VAR_5 = FFMIN(H264_MAX_THREADS, VAR_0->mb_height); else VAR_5 = H264_MAX_THREADS; av_log(VAR_0->avctx, AV_LOG_WARNING, "too many threads/slices %d," " reducing to %d\n", VAR_2, VAR_5); VAR_2 = VAR_5; } VAR_0->slice_context_count = VAR_2; if (!HAVE_THREADS || !(VAR_0->avctx->active_thread_type & FF_THREAD_SLICE)) { VAR_4 = ff_h264_context_init(VAR_0); if (VAR_4 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return VAR_4; } } else { for (VAR_3 = 1; VAR_3 < VAR_0->slice_context_count; VAR_3++) { H264Context *c; c = VAR_0->thread_context[VAR_3] = av_mallocz(sizeof(H264Context)); if (!c) return AVERROR(ENOMEM); c->avctx = VAR_0->avctx; c->dsp = VAR_0->dsp; c->vdsp = VAR_0->vdsp; c->h264dsp = VAR_0->h264dsp; c->h264qpel = VAR_0->h264qpel; c->h264chroma = VAR_0->h264chroma; c->sps = VAR_0->sps; c->pps = VAR_0->pps; c->pixel_shift = VAR_0->pixel_shift; c->width = VAR_0->width; c->height = VAR_0->height; c->linesize = VAR_0->linesize; c->uvlinesize = VAR_0->uvlinesize; c->chroma_x_shift = VAR_0->chroma_x_shift; c->chroma_y_shift = VAR_0->chroma_y_shift; c->qscale = VAR_0->qscale; c->droppable = VAR_0->droppable; c->data_partitioning = VAR_0->data_partitioning; c->low_delay = VAR_0->low_delay; c->mb_width = VAR_0->mb_width; c->mb_height = VAR_0->mb_height; c->mb_stride = VAR_0->mb_stride; c->mb_num = VAR_0->mb_num; c->flags = VAR_0->flags; c->workaround_bugs = VAR_0->workaround_bugs; c->pict_type = VAR_0->pict_type; init_scan_tables(c); clone_tables(c, VAR_0, VAR_3); c->context_initialized = 1; } for (VAR_3 = 0; VAR_3 < VAR_0->slice_context_count; VAR_3++) if ((VAR_4 = ff_h264_context_init(VAR_0->thread_context[VAR_3])) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "context_init() failed.\n"); return VAR_4; } } VAR_0->context_initialized = 1; return 0; }
[ "static int FUNC_0(H264Context *VAR_0, int VAR_1)\n{", "int VAR_2 = (HAVE_THREADS &&\nVAR_0->avctx->active_thread_type & FF_THREAD_SLICE) ?\nVAR_0->avctx->thread_count : 1;", "int VAR_3, VAR_4;", "VAR_0->avctx->sample_aspect_ratio = VAR_0->sps.sar;", "av_assert0(VAR_0->avctx->sample_aspect_ratio.den);", "av_pix_fmt_get_chroma_sub_sample(VAR_0->avctx->pix_fmt,\n&VAR_0->chroma_x_shift, &VAR_0->chroma_y_shift);", "if (VAR_0->sps.timing_info_present_flag) {", "int64_t den = VAR_0->sps.time_scale;", "if (VAR_0->x264_build < 44U)\nden *= 2;", "av_reduce(&VAR_0->avctx->time_base.num, &VAR_0->avctx->time_base.den,\nVAR_0->sps.num_units_in_tick, den, 1 << 30);", "}", "if (VAR_1)\nff_h264_free_tables(VAR_0, 0);", "VAR_0->first_field = 0;", "VAR_0->prev_interlaced_frame = 1;", "init_scan_tables(VAR_0);", "VAR_4 = ff_h264_alloc_tables(VAR_0);", "if (VAR_4 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Could not allocate memory\\n\");", "return VAR_4;", "}", "if (VAR_2 > H264_MAX_THREADS || (VAR_2 > VAR_0->mb_height && VAR_0->mb_height)) {", "int VAR_5;", "if (VAR_0->mb_height)\nVAR_5 = FFMIN(H264_MAX_THREADS, VAR_0->mb_height);", "else\nVAR_5 = H264_MAX_THREADS;", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"too many threads/slices %d,\"\n\" reducing to %d\\n\", VAR_2, VAR_5);", "VAR_2 = VAR_5;", "}", "VAR_0->slice_context_count = VAR_2;", "if (!HAVE_THREADS || !(VAR_0->avctx->active_thread_type & FF_THREAD_SLICE)) {", "VAR_4 = ff_h264_context_init(VAR_0);", "if (VAR_4 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"context_init() failed.\\n\");", "return VAR_4;", "}", "} else {", "for (VAR_3 = 1; VAR_3 < VAR_0->slice_context_count; VAR_3++) {", "H264Context *c;", "c = VAR_0->thread_context[VAR_3] = av_mallocz(sizeof(H264Context));", "if (!c)\nreturn AVERROR(ENOMEM);", "c->avctx = VAR_0->avctx;", "c->dsp = VAR_0->dsp;", "c->vdsp = VAR_0->vdsp;", "c->h264dsp = VAR_0->h264dsp;", "c->h264qpel = VAR_0->h264qpel;", "c->h264chroma = VAR_0->h264chroma;", "c->sps = VAR_0->sps;", "c->pps = VAR_0->pps;", "c->pixel_shift = VAR_0->pixel_shift;", "c->width = VAR_0->width;", "c->height = VAR_0->height;", "c->linesize = VAR_0->linesize;", "c->uvlinesize = VAR_0->uvlinesize;", "c->chroma_x_shift = VAR_0->chroma_x_shift;", "c->chroma_y_shift = VAR_0->chroma_y_shift;", "c->qscale = VAR_0->qscale;", "c->droppable = VAR_0->droppable;", "c->data_partitioning = VAR_0->data_partitioning;", "c->low_delay = VAR_0->low_delay;", "c->mb_width = VAR_0->mb_width;", "c->mb_height = VAR_0->mb_height;", "c->mb_stride = VAR_0->mb_stride;", "c->mb_num = VAR_0->mb_num;", "c->flags = VAR_0->flags;", "c->workaround_bugs = VAR_0->workaround_bugs;", "c->pict_type = VAR_0->pict_type;", "init_scan_tables(c);", "clone_tables(c, VAR_0, VAR_3);", "c->context_initialized = 1;", "}", "for (VAR_3 = 0; VAR_3 < VAR_0->slice_context_count; VAR_3++)", "if ((VAR_4 = ff_h264_context_init(VAR_0->thread_context[VAR_3])) < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"context_init() failed.\\n\");", "return VAR_4;", "}", "}", "VAR_0->context_initialized = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 195 ], [ 197 ] ]
3,385
static unsigned tget_long(GetByteContext *gb, int le) { unsigned v = le ? bytestream2_get_le32u(gb) : bytestream2_get_be32u(gb); return v; }
false
FFmpeg
ce1ebb31a9a0e556a89cd7681082af19fbc1cced
static unsigned tget_long(GetByteContext *gb, int le) { unsigned v = le ? bytestream2_get_le32u(gb) : bytestream2_get_be32u(gb); return v; }
{ "code": [], "line_no": [] }
static unsigned FUNC_0(GetByteContext *VAR_0, int VAR_1) { unsigned VAR_2 = VAR_1 ? bytestream2_get_le32u(VAR_0) : bytestream2_get_be32u(VAR_0); return VAR_2; }
[ "static unsigned FUNC_0(GetByteContext *VAR_0, int VAR_1)\n{", "unsigned VAR_2 = VAR_1 ? bytestream2_get_le32u(VAR_0) : bytestream2_get_be32u(VAR_0);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
3,386
static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst, int pitch, const uint8_t *table) { int i; int j; int out = 0; if (width & 1) return AVERROR_INVALIDDATA; /* first line contain absolute values, other lines contain deltas */ while (out < width) { int c = ir2_get_code(&ctx->gb); if (c >= 0x80) { /* we have a run */ c -= 0x7F; if (out + c*2 > width) return AVERROR_INVALIDDATA; for (i = 0; i < c * 2; i++) dst[out++] = 0x80; } else { /* copy two values from table */ dst[out++] = table[c * 2]; dst[out++] = table[(c * 2) + 1]; } } dst += pitch; for (j = 1; j < height; j++) { out = 0; if (get_bits_left(&ctx->gb) <= 0) return AVERROR_INVALIDDATA; while (out < width) { int c = ir2_get_code(&ctx->gb); if (c >= 0x80) { /* we have a skip */ c -= 0x7F; if (out + c*2 > width) return AVERROR_INVALIDDATA; for (i = 0; i < c * 2; i++) { dst[out] = dst[out - pitch]; out++; } } else { /* add two deltas from table */ int t = dst[out - pitch] + (table[c * 2] - 128); t = av_clip_uint8(t); dst[out] = t; out++; t = dst[out - pitch] + (table[(c * 2) + 1] - 128); t = av_clip_uint8(t); dst[out] = t; out++; } } dst += pitch; } return 0; }
true
FFmpeg
159fb8ff7e4038edf13e91d3c08bc7b8abc369b9
static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst, int pitch, const uint8_t *table) { int i; int j; int out = 0; if (width & 1) return AVERROR_INVALIDDATA; while (out < width) { int c = ir2_get_code(&ctx->gb); if (c >= 0x80) { c -= 0x7F; if (out + c*2 > width) return AVERROR_INVALIDDATA; for (i = 0; i < c * 2; i++) dst[out++] = 0x80; } else { dst[out++] = table[c * 2]; dst[out++] = table[(c * 2) + 1]; } } dst += pitch; for (j = 1; j < height; j++) { out = 0; if (get_bits_left(&ctx->gb) <= 0) return AVERROR_INVALIDDATA; while (out < width) { int c = ir2_get_code(&ctx->gb); if (c >= 0x80) { c -= 0x7F; if (out + c*2 > width) return AVERROR_INVALIDDATA; for (i = 0; i < c * 2; i++) { dst[out] = dst[out - pitch]; out++; } } else { int t = dst[out - pitch] + (table[c * 2] - 128); t = av_clip_uint8(t); dst[out] = t; out++; t = dst[out - pitch] + (table[(c * 2) + 1] - 128); t = av_clip_uint8(t); dst[out] = t; out++; } } dst += pitch; } return 0; }
{ "code": [ " int t = dst[out - pitch] + (table[c * 2] - 128);" ], "line_no": [ 83 ] }
static int FUNC_0(Ir2Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4, const uint8_t *VAR_5) { int VAR_6; int VAR_7; int VAR_8 = 0; if (VAR_1 & 1) return AVERROR_INVALIDDATA; while (VAR_8 < VAR_1) { int VAR_10 = ir2_get_code(&VAR_0->gb); if (VAR_10 >= 0x80) { VAR_10 -= 0x7F; if (VAR_8 + VAR_10*2 > VAR_1) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_10 * 2; VAR_6++) VAR_3[VAR_8++] = 0x80; } else { VAR_3[VAR_8++] = VAR_5[VAR_10 * 2]; VAR_3[VAR_8++] = VAR_5[(VAR_10 * 2) + 1]; } } VAR_3 += VAR_4; for (VAR_7 = 1; VAR_7 < VAR_2; VAR_7++) { VAR_8 = 0; if (get_bits_left(&VAR_0->gb) <= 0) return AVERROR_INVALIDDATA; while (VAR_8 < VAR_1) { int VAR_10 = ir2_get_code(&VAR_0->gb); if (VAR_10 >= 0x80) { VAR_10 -= 0x7F; if (VAR_8 + VAR_10*2 > VAR_1) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_10 * 2; VAR_6++) { VAR_3[VAR_8] = VAR_3[VAR_8 - VAR_4]; VAR_8++; } } else { int VAR_10 = VAR_3[VAR_8 - VAR_4] + (VAR_5[VAR_10 * 2] - 128); VAR_10 = av_clip_uint8(VAR_10); VAR_3[VAR_8] = VAR_10; VAR_8++; VAR_10 = VAR_3[VAR_8 - VAR_4] + (VAR_5[(VAR_10 * 2) + 1] - 128); VAR_10 = av_clip_uint8(VAR_10); VAR_3[VAR_8] = VAR_10; VAR_8++; } } VAR_3 += VAR_4; } return 0; }
[ "static int FUNC_0(Ir2Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3,\nint VAR_4, const uint8_t *VAR_5)\n{", "int VAR_6;", "int VAR_7;", "int VAR_8 = 0;", "if (VAR_1 & 1)\nreturn AVERROR_INVALIDDATA;", "while (VAR_8 < VAR_1) {", "int VAR_10 = ir2_get_code(&VAR_0->gb);", "if (VAR_10 >= 0x80) {", "VAR_10 -= 0x7F;", "if (VAR_8 + VAR_10*2 > VAR_1)\nreturn AVERROR_INVALIDDATA;", "for (VAR_6 = 0; VAR_6 < VAR_10 * 2; VAR_6++)", "VAR_3[VAR_8++] = 0x80;", "} else {", "VAR_3[VAR_8++] = VAR_5[VAR_10 * 2];", "VAR_3[VAR_8++] = VAR_5[(VAR_10 * 2) + 1];", "}", "}", "VAR_3 += VAR_4;", "for (VAR_7 = 1; VAR_7 < VAR_2; VAR_7++) {", "VAR_8 = 0;", "if (get_bits_left(&VAR_0->gb) <= 0)\nreturn AVERROR_INVALIDDATA;", "while (VAR_8 < VAR_1) {", "int VAR_10 = ir2_get_code(&VAR_0->gb);", "if (VAR_10 >= 0x80) {", "VAR_10 -= 0x7F;", "if (VAR_8 + VAR_10*2 > VAR_1)\nreturn AVERROR_INVALIDDATA;", "for (VAR_6 = 0; VAR_6 < VAR_10 * 2; VAR_6++) {", "VAR_3[VAR_8] = VAR_3[VAR_8 - VAR_4];", "VAR_8++;", "}", "} else {", "int VAR_10 = VAR_3[VAR_8 - VAR_4] + (VAR_5[VAR_10 * 2] - 128);", "VAR_10 = av_clip_uint8(VAR_10);", "VAR_3[VAR_8] = VAR_10;", "VAR_8++;", "VAR_10 = VAR_3[VAR_8 - VAR_4] + (VAR_5[(VAR_10 * 2) + 1] - 128);", "VAR_10 = av_clip_uint8(VAR_10);", "VAR_3[VAR_8] = VAR_10;", "VAR_8++;", "}", "}", "VAR_3 += VAR_4;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
3,387
void hmp_change(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); const char *target = qdict_get_str(qdict, "target"); const char *arg = qdict_get_try_str(qdict, "arg"); const char *read_only = qdict_get_try_str(qdict, "read-only-mode"); BlockdevChangeReadOnlyMode read_only_mode = 0; Error *err = NULL; if (strcmp(device, "vnc") == 0) { if (read_only) { monitor_printf(mon, "Parameter 'read-only-mode' is invalid for VNC\n"); return; } if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) { if (!arg) { monitor_read_password(mon, hmp_change_read_arg, NULL); return; } } qmp_change("vnc", target, !!arg, arg, &err); } else { if (read_only) { read_only_mode = qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup, read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX, BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); if (err) { hmp_handle_error(mon, &err); return; } } qmp_blockdev_change_medium(true, device, false, NULL, target, !!arg, arg, !!read_only, read_only_mode, &err); if (err && error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) { error_free(err); monitor_read_block_device_key(mon, device, NULL, NULL); return; } } hmp_handle_error(mon, &err); }
true
qemu
788cf9f8c8cbda53843e060540f3e91a060eb744
void hmp_change(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); const char *target = qdict_get_str(qdict, "target"); const char *arg = qdict_get_try_str(qdict, "arg"); const char *read_only = qdict_get_try_str(qdict, "read-only-mode"); BlockdevChangeReadOnlyMode read_only_mode = 0; Error *err = NULL; if (strcmp(device, "vnc") == 0) { if (read_only) { monitor_printf(mon, "Parameter 'read-only-mode' is invalid for VNC\n"); return; } if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) { if (!arg) { monitor_read_password(mon, hmp_change_read_arg, NULL); return; } } qmp_change("vnc", target, !!arg, arg, &err); } else { if (read_only) { read_only_mode = qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup, read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX, BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); if (err) { hmp_handle_error(mon, &err); return; } } qmp_blockdev_change_medium(true, device, false, NULL, target, !!arg, arg, !!read_only, read_only_mode, &err); if (err && error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) { error_free(err); monitor_read_block_device_key(mon, device, NULL, NULL); return; } } hmp_handle_error(mon, &err); }
{ "code": [ " if (err &&", " error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {", " error_free(err);", " monitor_read_block_device_key(mon, device, NULL, NULL);", " Error *err = NULL;" ], "line_no": [ 77, 79, 81, 83, 15 ] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4"); const char *VAR_5 = qdict_get_try_str(VAR_1, "read-only-mode"); BlockdevChangeReadOnlyMode read_only_mode = 0; Error *err = NULL; if (strcmp(VAR_2, "vnc") == 0) { if (VAR_5) { monitor_printf(VAR_0, "Parameter 'read-only-mode' is invalid for VNC\n"); return; } if (strcmp(VAR_3, "passwd") == 0 || strcmp(VAR_3, "password") == 0) { if (!VAR_4) { monitor_read_password(VAR_0, hmp_change_read_arg, NULL); return; } } qmp_change("vnc", VAR_3, !!VAR_4, VAR_4, &err); } else { if (VAR_5) { read_only_mode = qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup, VAR_5, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX, BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err); if (err) { hmp_handle_error(VAR_0, &err); return; } } qmp_blockdev_change_medium(true, VAR_2, false, NULL, VAR_3, !!VAR_4, VAR_4, !!VAR_5, read_only_mode, &err); if (err && error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) { error_free(err); monitor_read_block_device_key(VAR_0, VAR_2, NULL, NULL); return; } } hmp_handle_error(VAR_0, &err); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "const char *VAR_3 = qdict_get_str(VAR_1, \"VAR_3\");", "const char *VAR_4 = qdict_get_try_str(VAR_1, \"VAR_4\");", "const char *VAR_5 = qdict_get_try_str(VAR_1, \"read-only-mode\");", "BlockdevChangeReadOnlyMode read_only_mode = 0;", "Error *err = NULL;", "if (strcmp(VAR_2, \"vnc\") == 0) {", "if (VAR_5) {", "monitor_printf(VAR_0,\n\"Parameter 'read-only-mode' is invalid for VNC\\n\");", "return;", "}", "if (strcmp(VAR_3, \"passwd\") == 0 ||\nstrcmp(VAR_3, \"password\") == 0) {", "if (!VAR_4) {", "monitor_read_password(VAR_0, hmp_change_read_arg, NULL);", "return;", "}", "}", "qmp_change(\"vnc\", VAR_3, !!VAR_4, VAR_4, &err);", "} else {", "if (VAR_5) {", "read_only_mode =\nqapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,\nVAR_5, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,\nBLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);", "if (err) {", "hmp_handle_error(VAR_0, &err);", "return;", "}", "}", "qmp_blockdev_change_medium(true, VAR_2, false, NULL, VAR_3,\n!!VAR_4, VAR_4, !!VAR_5, read_only_mode,\n&err);", "if (err &&\nerror_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {", "error_free(err);", "monitor_read_block_device_key(VAR_0, VAR_2, NULL, NULL);", "return;", "}", "}", "hmp_handle_error(VAR_0, &err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
3,388
static CharDriverState *text_console_init(ChardevVC *vc) { CharDriverState *chr; QemuConsole *s; unsigned width = 0; unsigned height = 0; chr = g_malloc0(sizeof(CharDriverState)); if (vc->has_width) { width = vc->width; } else if (vc->has_cols) { width = vc->cols * FONT_WIDTH; } if (vc->has_height) { height = vc->height; } else if (vc->has_rows) { height = vc->rows * FONT_HEIGHT; } trace_console_txt_new(width, height); if (width == 0 || height == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); s->surface = qemu_create_displaysurface(width, height); } if (!s) { g_free(chr); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; /* console/chardev init sometimes completes elsewhere in a 2nd * stage, so defer OPENED events until they are fully initialized */ chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }
true
qemu
afff2b15e89ac81c113f2ebfd729aaa02b40edb6
static CharDriverState *text_console_init(ChardevVC *vc) { CharDriverState *chr; QemuConsole *s; unsigned width = 0; unsigned height = 0; chr = g_malloc0(sizeof(CharDriverState)); if (vc->has_width) { width = vc->width; } else if (vc->has_cols) { width = vc->cols * FONT_WIDTH; } if (vc->has_height) { height = vc->height; } else if (vc->has_rows) { height = vc->rows * FONT_HEIGHT; } trace_console_txt_new(width, height); if (width == 0 || height == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); s->surface = qemu_create_displaysurface(width, height); } if (!s) { g_free(chr); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }
{ "code": [ " s = new_console(NULL, TEXT_CONSOLE);", " s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);" ], "line_no": [ 47, 51 ] }
static CharDriverState *FUNC_0(ChardevVC *vc) { CharDriverState *chr; QemuConsole *s; unsigned VAR_0 = 0; unsigned VAR_1 = 0; chr = g_malloc0(sizeof(CharDriverState)); if (vc->has_width) { VAR_0 = vc->VAR_0; } else if (vc->has_cols) { VAR_0 = vc->cols * FONT_WIDTH; } if (vc->has_height) { VAR_1 = vc->VAR_1; } else if (vc->has_rows) { VAR_1 = vc->rows * FONT_HEIGHT; } trace_console_txt_new(VAR_0, VAR_1); if (VAR_0 == 0 || VAR_1 == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); s->surface = qemu_create_displaysurface(VAR_0, VAR_1); } if (!s) { g_free(chr); return NULL; } s->chr = chr; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; chr->explicit_be_open = true; if (display_state) { text_console_do_init(chr, display_state); } return chr; }
[ "static CharDriverState *FUNC_0(ChardevVC *vc)\n{", "CharDriverState *chr;", "QemuConsole *s;", "unsigned VAR_0 = 0;", "unsigned VAR_1 = 0;", "chr = g_malloc0(sizeof(CharDriverState));", "if (vc->has_width) {", "VAR_0 = vc->VAR_0;", "} else if (vc->has_cols) {", "VAR_0 = vc->cols * FONT_WIDTH;", "}", "if (vc->has_height) {", "VAR_1 = vc->VAR_1;", "} else if (vc->has_rows) {", "VAR_1 = vc->rows * FONT_HEIGHT;", "}", "trace_console_txt_new(VAR_0, VAR_1);", "if (VAR_0 == 0 || VAR_1 == 0) {", "s = new_console(NULL, TEXT_CONSOLE);", "} else {", "s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);", "s->surface = qemu_create_displaysurface(VAR_0, VAR_1);", "}", "if (!s) {", "g_free(chr);", "return NULL;", "}", "s->chr = chr;", "chr->opaque = s;", "chr->chr_set_echo = text_console_set_echo;", "chr->explicit_be_open = true;", "if (display_state) {", "text_console_do_init(chr, display_state);", "}", "return chr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
3,389
static int codec_reinit(AVCodecContext *avctx, int width, int height, int quality) { NuvContext *c = avctx->priv_data; width = (width + 1) & ~1; height = (height + 1) & ~1; if (quality >= 0) get_quant_quality(c, quality); if (width != c->width || height != c->height) { if (av_image_check_size(height, width, 0, avctx) < 0) return 0; avctx->width = c->width = width; avctx->height = c->height = height; c->decomp_size = c->height * c->width * 3 / 2; c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING); if (!c->decomp_buf) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 0; } rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq); } else if (quality != c->quality) rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq); return 1; }
true
FFmpeg
e7b95918fca1c3d057d35f77ba58ee2d00d03151
static int codec_reinit(AVCodecContext *avctx, int width, int height, int quality) { NuvContext *c = avctx->priv_data; width = (width + 1) & ~1; height = (height + 1) & ~1; if (quality >= 0) get_quant_quality(c, quality); if (width != c->width || height != c->height) { if (av_image_check_size(height, width, 0, avctx) < 0) return 0; avctx->width = c->width = width; avctx->height = c->height = height; c->decomp_size = c->height * c->width * 3 / 2; c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING); if (!c->decomp_buf) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 0; } rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq); } else if (quality != c->quality) rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq); return 1; }
{ "code": [ " c->decomp_size = c->height * c->width * 3 / 2;", " c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);" ], "line_no": [ 23, 25 ] }
static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { NuvContext *c = VAR_0->priv_data; VAR_1 = (VAR_1 + 1) & ~1; VAR_2 = (VAR_2 + 1) & ~1; if (VAR_3 >= 0) get_quant_quality(c, VAR_3); if (VAR_1 != c->VAR_1 || VAR_2 != c->VAR_2) { if (av_image_check_size(VAR_2, VAR_1, 0, VAR_0) < 0) return 0; VAR_0->VAR_1 = c->VAR_1 = VAR_1; VAR_0->VAR_2 = c->VAR_2 = VAR_2; c->decomp_size = c->VAR_2 * c->VAR_1 * 3 / 2; c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING); if (!c->decomp_buf) { av_log(VAR_0, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 0; } rtjpeg_decode_init(&c->rtj, &c->dsp, c->VAR_1, c->VAR_2, c->lq, c->cq); } else if (VAR_3 != c->VAR_3) rtjpeg_decode_init(&c->rtj, &c->dsp, c->VAR_1, c->VAR_2, c->lq, c->cq); return 1; }
[ "static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) {", "NuvContext *c = VAR_0->priv_data;", "VAR_1 = (VAR_1 + 1) & ~1;", "VAR_2 = (VAR_2 + 1) & ~1;", "if (VAR_3 >= 0)\nget_quant_quality(c, VAR_3);", "if (VAR_1 != c->VAR_1 || VAR_2 != c->VAR_2) {", "if (av_image_check_size(VAR_2, VAR_1, 0, VAR_0) < 0)\nreturn 0;", "VAR_0->VAR_1 = c->VAR_1 = VAR_1;", "VAR_0->VAR_2 = c->VAR_2 = VAR_2;", "c->decomp_size = c->VAR_2 * c->VAR_1 * 3 / 2;", "c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);", "if (!c->decomp_buf) {", "av_log(VAR_0, AV_LOG_ERROR, \"Can't allocate decompression buffer.\\n\");", "return 0;", "}", "rtjpeg_decode_init(&c->rtj, &c->dsp, c->VAR_1, c->VAR_2, c->lq, c->cq);", "} else if (VAR_3 != c->VAR_3)", "rtjpeg_decode_init(&c->rtj, &c->dsp, c->VAR_1, c->VAR_2, c->lq, c->cq);", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
3,390
int av_open_input_stream(AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; AVFormatContext *ic; AVFormatParameters default_ap; if(!ap){ ap=&default_ap; memset(ap, 0, sizeof(default_ap)); } if(!ap->prealloced_context) ic = avformat_alloc_context(); else ic = *ic_ptr; if (!ic) { err = AVERROR(ENOMEM); goto fail; } ic->iformat = fmt; ic->pb = pb; ic->duration = AV_NOPTS_VALUE; ic->start_time = AV_NOPTS_VALUE; av_strlcpy(ic->filename, filename, sizeof(ic->filename)); /* allocate private data */ if (fmt->priv_data_size > 0) { ic->priv_data = av_mallocz(fmt->priv_data_size); if (!ic->priv_data) { err = AVERROR(ENOMEM); goto fail; } } else { ic->priv_data = NULL; } if (ic->iformat->read_header) { err = ic->iformat->read_header(ic, ap); if (err < 0) goto fail; } if (pb && !ic->data_offset) ic->data_offset = url_ftell(ic->pb); #if LIBAVFORMAT_VERSION_MAJOR < 53 ff_metadata_demux_compat(ic); #endif ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; *ic_ptr = ic; return 0; fail: if (ic) { int i; av_freep(&ic->priv_data); for(i=0;i<ic->nb_streams;i++) { AVStream *st = ic->streams[i]; if (st) { av_free(st->priv_data); av_free(st->codec->extradata); } av_free(st); } } av_free(ic); *ic_ptr = NULL; return err; }
true
FFmpeg
ec973f45a3afd82fd53313b0b570645c03b2b178
int av_open_input_stream(AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; AVFormatContext *ic; AVFormatParameters default_ap; if(!ap){ ap=&default_ap; memset(ap, 0, sizeof(default_ap)); } if(!ap->prealloced_context) ic = avformat_alloc_context(); else ic = *ic_ptr; if (!ic) { err = AVERROR(ENOMEM); goto fail; } ic->iformat = fmt; ic->pb = pb; ic->duration = AV_NOPTS_VALUE; ic->start_time = AV_NOPTS_VALUE; av_strlcpy(ic->filename, filename, sizeof(ic->filename)); if (fmt->priv_data_size > 0) { ic->priv_data = av_mallocz(fmt->priv_data_size); if (!ic->priv_data) { err = AVERROR(ENOMEM); goto fail; } } else { ic->priv_data = NULL; } if (ic->iformat->read_header) { err = ic->iformat->read_header(ic, ap); if (err < 0) goto fail; } if (pb && !ic->data_offset) ic->data_offset = url_ftell(ic->pb); #if LIBAVFORMAT_VERSION_MAJOR < 53 ff_metadata_demux_compat(ic); #endif ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; *ic_ptr = ic; return 0; fail: if (ic) { int i; av_freep(&ic->priv_data); for(i=0;i<ic->nb_streams;i++) { AVStream *st = ic->streams[i]; if (st) { av_free(st->priv_data); av_free(st->codec->extradata); } av_free(st); } } av_free(ic); *ic_ptr = NULL; return err; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext **VAR_0, ByteIOContext *VAR_1, const char *VAR_2, AVInputFormat *VAR_3, AVFormatParameters *VAR_4) { int VAR_5; AVFormatContext *ic; AVFormatParameters default_ap; if(!VAR_4){ VAR_4=&default_ap; memset(VAR_4, 0, sizeof(default_ap)); } if(!VAR_4->prealloced_context) ic = avformat_alloc_context(); else ic = *VAR_0; if (!ic) { VAR_5 = AVERROR(ENOMEM); goto fail; } ic->iformat = VAR_3; ic->VAR_1 = VAR_1; ic->duration = AV_NOPTS_VALUE; ic->start_time = AV_NOPTS_VALUE; av_strlcpy(ic->VAR_2, VAR_2, sizeof(ic->VAR_2)); if (VAR_3->priv_data_size > 0) { ic->priv_data = av_mallocz(VAR_3->priv_data_size); if (!ic->priv_data) { VAR_5 = AVERROR(ENOMEM); goto fail; } } else { ic->priv_data = NULL; } if (ic->iformat->read_header) { VAR_5 = ic->iformat->read_header(ic, VAR_4); if (VAR_5 < 0) goto fail; } if (VAR_1 && !ic->data_offset) ic->data_offset = url_ftell(ic->VAR_1); #if LIBAVFORMAT_VERSION_MAJOR < 53 ff_metadata_demux_compat(ic); #endif ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; *VAR_0 = ic; return 0; fail: if (ic) { int VAR_6; av_freep(&ic->priv_data); for(VAR_6=0;VAR_6<ic->nb_streams;VAR_6++) { AVStream *st = ic->streams[VAR_6]; if (st) { av_free(st->priv_data); av_free(st->codec->extradata); } av_free(st); } } av_free(ic); *VAR_0 = NULL; return VAR_5; }
[ "int FUNC_0(AVFormatContext **VAR_0,\nByteIOContext *VAR_1, const char *VAR_2,\nAVInputFormat *VAR_3, AVFormatParameters *VAR_4)\n{", "int VAR_5;", "AVFormatContext *ic;", "AVFormatParameters default_ap;", "if(!VAR_4){", "VAR_4=&default_ap;", "memset(VAR_4, 0, sizeof(default_ap));", "}", "if(!VAR_4->prealloced_context)\nic = avformat_alloc_context();", "else\nic = *VAR_0;", "if (!ic) {", "VAR_5 = AVERROR(ENOMEM);", "goto fail;", "}", "ic->iformat = VAR_3;", "ic->VAR_1 = VAR_1;", "ic->duration = AV_NOPTS_VALUE;", "ic->start_time = AV_NOPTS_VALUE;", "av_strlcpy(ic->VAR_2, VAR_2, sizeof(ic->VAR_2));", "if (VAR_3->priv_data_size > 0) {", "ic->priv_data = av_mallocz(VAR_3->priv_data_size);", "if (!ic->priv_data) {", "VAR_5 = AVERROR(ENOMEM);", "goto fail;", "}", "} else {", "ic->priv_data = NULL;", "}", "if (ic->iformat->read_header) {", "VAR_5 = ic->iformat->read_header(ic, VAR_4);", "if (VAR_5 < 0)\ngoto fail;", "}", "if (VAR_1 && !ic->data_offset)\nic->data_offset = url_ftell(ic->VAR_1);", "#if LIBAVFORMAT_VERSION_MAJOR < 53\nff_metadata_demux_compat(ic);", "#endif\nic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;", "*VAR_0 = ic;", "return 0;", "fail:\nif (ic) {", "int VAR_6;", "av_freep(&ic->priv_data);", "for(VAR_6=0;VAR_6<ic->nb_streams;VAR_6++) {", "AVStream *st = ic->streams[VAR_6];", "if (st) {", "av_free(st->priv_data);", "av_free(st->codec->extradata);", "}", "av_free(st);", "}", "}", "av_free(ic);", "*VAR_0 = NULL;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89, 91 ], [ 95, 97 ], [ 99, 103 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 130 ], [ 132 ], [ 134 ], [ 136 ], [ 138 ], [ 140 ], [ 142 ], [ 144 ] ]
3,391
static void network_to_control(RDMAControlHeader *control) { control->type = ntohl(control->type); control->len = ntohl(control->len); control->repeat = ntohl(control->repeat); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void network_to_control(RDMAControlHeader *control) { control->type = ntohl(control->type); control->len = ntohl(control->len); control->repeat = ntohl(control->repeat); }
{ "code": [], "line_no": [] }
static void FUNC_0(RDMAControlHeader *VAR_0) { VAR_0->type = ntohl(VAR_0->type); VAR_0->len = ntohl(VAR_0->len); VAR_0->repeat = ntohl(VAR_0->repeat); }
[ "static void FUNC_0(RDMAControlHeader *VAR_0)\n{", "VAR_0->type = ntohl(VAR_0->type);", "VAR_0->len = ntohl(VAR_0->len);", "VAR_0->repeat = ntohl(VAR_0->repeat);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
3,393
void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) { int id; id = avio_rl16(pb); codec->codec_type = AVMEDIA_TYPE_AUDIO; codec->codec_tag = id; codec->channels = avio_rl16(pb); codec->sample_rate = avio_rl32(pb); codec->bit_rate = avio_rl32(pb) * 8; codec->block_align = avio_rl16(pb); if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ codec->bits_per_coded_sample = 8; }else codec->bits_per_coded_sample = avio_rl16(pb); if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ int cbSize = avio_rl16(pb); /* cbSize */ size -= 18; cbSize = FFMIN(size, cbSize); if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ codec->bits_per_coded_sample = avio_rl16(pb); codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ id = avio_rl32(pb); /* 4 first bytes of GUID */ avio_skip(pb, 12); /* skip end of GUID */ cbSize -= 22; size -= 22; } codec->extradata_size = cbSize; if (cbSize > 0) { codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); avio_read(pb, codec->extradata, codec->extradata_size); size -= cbSize; } /* It is possible for the chunk to contain garbage at the end */ if (size > 0) avio_skip(pb, size); } codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); if (codec->codec_id == CODEC_ID_AAC_LATM) { /* channels and sample_rate values are those prior to applying SBR and/or PS */ codec->channels = 0; codec->sample_rate = 0; } }
true
FFmpeg
ca402f32e392590a81a1381dab41c4f9c2c2f98a
void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) { int id; id = avio_rl16(pb); codec->codec_type = AVMEDIA_TYPE_AUDIO; codec->codec_tag = id; codec->channels = avio_rl16(pb); codec->sample_rate = avio_rl32(pb); codec->bit_rate = avio_rl32(pb) * 8; codec->block_align = avio_rl16(pb); if (size == 14) { codec->bits_per_coded_sample = 8; }else codec->bits_per_coded_sample = avio_rl16(pb); if (size >= 18) { int cbSize = avio_rl16(pb); size -= 18; cbSize = FFMIN(size, cbSize); if (cbSize >= 22 && id == 0xfffe) { codec->bits_per_coded_sample = avio_rl16(pb); codec->channel_layout = avio_rl32(pb); id = avio_rl32(pb); avio_skip(pb, 12); cbSize -= 22; size -= 22; } codec->extradata_size = cbSize; if (cbSize > 0) { codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); avio_read(pb, codec->extradata, codec->extradata_size); size -= cbSize; } if (size > 0) avio_skip(pb, size); } codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); if (codec->codec_id == CODEC_ID_AAC_LATM) { codec->channels = 0; codec->sample_rate = 0; } }
{ "code": [ "void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)" ], "line_no": [ 1 ] }
void FUNC_0(AVIOContext *VAR_0, AVCodecContext *VAR_1, int VAR_2) { int VAR_3; VAR_3 = avio_rl16(VAR_0); VAR_1->codec_type = AVMEDIA_TYPE_AUDIO; VAR_1->codec_tag = VAR_3; VAR_1->channels = avio_rl16(VAR_0); VAR_1->sample_rate = avio_rl32(VAR_0); VAR_1->bit_rate = avio_rl32(VAR_0) * 8; VAR_1->block_align = avio_rl16(VAR_0); if (VAR_2 == 14) { VAR_1->bits_per_coded_sample = 8; }else VAR_1->bits_per_coded_sample = avio_rl16(VAR_0); if (VAR_2 >= 18) { int VAR_4 = avio_rl16(VAR_0); VAR_2 -= 18; VAR_4 = FFMIN(VAR_2, VAR_4); if (VAR_4 >= 22 && VAR_3 == 0xfffe) { VAR_1->bits_per_coded_sample = avio_rl16(VAR_0); VAR_1->channel_layout = avio_rl32(VAR_0); VAR_3 = avio_rl32(VAR_0); avio_skip(VAR_0, 12); VAR_4 -= 22; VAR_2 -= 22; } VAR_1->extradata_size = VAR_4; if (VAR_4 > 0) { VAR_1->extradata = av_mallocz(VAR_1->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); avio_read(VAR_0, VAR_1->extradata, VAR_1->extradata_size); VAR_2 -= VAR_4; } if (VAR_2 > 0) avio_skip(VAR_0, VAR_2); } VAR_1->codec_id = ff_wav_codec_get_id(VAR_3, VAR_1->bits_per_coded_sample); if (VAR_1->codec_id == CODEC_ID_AAC_LATM) { VAR_1->channels = 0; VAR_1->sample_rate = 0; } }
[ "void FUNC_0(AVIOContext *VAR_0, AVCodecContext *VAR_1, int VAR_2)\n{", "int VAR_3;", "VAR_3 = avio_rl16(VAR_0);", "VAR_1->codec_type = AVMEDIA_TYPE_AUDIO;", "VAR_1->codec_tag = VAR_3;", "VAR_1->channels = avio_rl16(VAR_0);", "VAR_1->sample_rate = avio_rl32(VAR_0);", "VAR_1->bit_rate = avio_rl32(VAR_0) * 8;", "VAR_1->block_align = avio_rl16(VAR_0);", "if (VAR_2 == 14) {", "VAR_1->bits_per_coded_sample = 8;", "}else", "VAR_1->bits_per_coded_sample = avio_rl16(VAR_0);", "if (VAR_2 >= 18) {", "int VAR_4 = avio_rl16(VAR_0);", "VAR_2 -= 18;", "VAR_4 = FFMIN(VAR_2, VAR_4);", "if (VAR_4 >= 22 && VAR_3 == 0xfffe) {", "VAR_1->bits_per_coded_sample = avio_rl16(VAR_0);", "VAR_1->channel_layout = avio_rl32(VAR_0);", "VAR_3 = avio_rl32(VAR_0);", "avio_skip(VAR_0, 12);", "VAR_4 -= 22;", "VAR_2 -= 22;", "}", "VAR_1->extradata_size = VAR_4;", "if (VAR_4 > 0) {", "VAR_1->extradata = av_mallocz(VAR_1->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);", "avio_read(VAR_0, VAR_1->extradata, VAR_1->extradata_size);", "VAR_2 -= VAR_4;", "}", "if (VAR_2 > 0)\navio_skip(VAR_0, VAR_2);", "}", "VAR_1->codec_id = ff_wav_codec_get_id(VAR_3, VAR_1->bits_per_coded_sample);", "if (VAR_1->codec_id == CODEC_ID_AAC_LATM) {", "VAR_1->channels = 0;", "VAR_1->sample_rate = 0;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
3,395
static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, const uint8_t *buf, unsigned int substr) { SubStream *s = &m->substream[substr]; unsigned int ch; int sync_word, tmp; uint8_t checksum; uint8_t lossless_check; int start_count = get_bits_count(gbp); const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP ? MAX_MATRIX_CHANNEL_MLP : MAX_MATRIX_CHANNEL_TRUEHD; sync_word = get_bits(gbp, 13); if (sync_word != 0x31ea >> 1) { av_log(m->avctx, AV_LOG_ERROR, "restart header sync incorrect (got 0x%04x)\n", sync_word); return AVERROR_INVALIDDATA; } s->noise_type = get_bits1(gbp); if (m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) { av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n"); return AVERROR_INVALIDDATA; } skip_bits(gbp, 16); /* Output timestamp */ s->min_channel = get_bits(gbp, 4); s->max_channel = get_bits(gbp, 4); s->max_matrix_channel = get_bits(gbp, 4); if (s->max_matrix_channel > max_matrix_channel) { av_log(m->avctx, AV_LOG_ERROR, "Max matrix channel cannot be greater than %d.\n", max_matrix_channel); return AVERROR_INVALIDDATA; } if (s->max_channel != s->max_matrix_channel) { av_log(m->avctx, AV_LOG_ERROR, "Max channel must be equal max matrix channel.\n"); return AVERROR_INVALIDDATA; } /* This should happen for TrueHD streams with >6 channels and MLP's noise * type. It is not yet known if this is allowed. */ if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) { av_log_ask_for_sample(m->avctx, "Number of channels %d is larger than the maximum supported " "by the decoder.\n", s->max_channel + 2); return AVERROR_PATCHWELCOME; } if (s->min_channel > s->max_channel) { av_log(m->avctx, AV_LOG_ERROR, "Substream min channel cannot be greater than max channel.\n"); return AVERROR_INVALIDDATA; } if (m->avctx->request_channels > 0 && s->max_channel + 1 >= m->avctx->request_channels && substr < m->max_decoded_substream) { av_log(m->avctx, AV_LOG_DEBUG, "Extracting %d channel downmix from substream %d. " "Further substreams will be skipped.\n", s->max_channel + 1, substr); m->max_decoded_substream = substr; } s->noise_shift = get_bits(gbp, 4); s->noisegen_seed = get_bits(gbp, 23); skip_bits(gbp, 19); s->data_check_present = get_bits1(gbp); lossless_check = get_bits(gbp, 8); if (substr == m->max_decoded_substream && s->lossless_check_data != 0xffffffff) { tmp = xor_32_to_8(s->lossless_check_data); if (tmp != lossless_check) av_log(m->avctx, AV_LOG_WARNING, "Lossless check failed - expected %02x, calculated %02x.\n", lossless_check, tmp); } skip_bits(gbp, 16); memset(s->ch_assign, 0, sizeof(s->ch_assign)); for (ch = 0; ch <= s->max_matrix_channel; ch++) { int ch_assign = get_bits(gbp, 6); if (ch_assign > s->max_matrix_channel) { av_log_ask_for_sample(m->avctx, "Assignment of matrix channel %d to invalid output channel %d.\n", ch, ch_assign); return AVERROR_PATCHWELCOME; } s->ch_assign[ch_assign] = ch; } if (m->avctx->codec_id == CODEC_ID_MLP && m->needs_reordering) { if (m->avctx->channel_layout == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) || m->avctx->channel_layout == AV_CH_LAYOUT_5POINT0_BACK) { int i = s->ch_assign[4]; s->ch_assign[4] = s->ch_assign[3]; s->ch_assign[3] = s->ch_assign[2]; s->ch_assign[2] = i; } else if (m->avctx->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) { FFSWAP(int, s->ch_assign[2], s->ch_assign[4]); FFSWAP(int, s->ch_assign[3], s->ch_assign[5]); } } if (m->avctx->codec_id == CODEC_ID_TRUEHD && (m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1 || m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1_WIDE)) { FFSWAP(int, s->ch_assign[4], s->ch_assign[6]); FFSWAP(int, s->ch_assign[5], s->ch_assign[7]); } else if (m->avctx->codec_id == CODEC_ID_TRUEHD && (m->avctx->channel_layout == AV_CH_LAYOUT_6POINT1 || m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_CENTER) || m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_FRONT_CENTER))) { int i = s->ch_assign[6]; s->ch_assign[6] = s->ch_assign[5]; s->ch_assign[5] = s->ch_assign[4]; s->ch_assign[4] = i; } checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count); if (checksum != get_bits(gbp, 8)) av_log(m->avctx, AV_LOG_ERROR, "restart header checksum error\n"); /* Set default decoding parameters. */ s->param_presence_flags = 0xff; s->num_primitive_matrices = 0; s->blocksize = 8; s->lossless_check_data = 0; memset(s->output_shift , 0, sizeof(s->output_shift )); memset(s->quant_step_size, 0, sizeof(s->quant_step_size)); for (ch = s->min_channel; ch <= s->max_channel; ch++) { ChannelParams *cp = &s->channel_params[ch]; cp->filter_params[FIR].order = 0; cp->filter_params[IIR].order = 0; cp->filter_params[FIR].shift = 0; cp->filter_params[IIR].shift = 0; /* Default audio coding is 24-bit raw PCM. */ cp->huff_offset = 0; cp->sign_huff_offset = (-1) << 23; cp->codebook = 0; cp->huff_lsbs = 24; } if (substr == m->max_decoded_substream) m->avctx->channels = s->max_matrix_channel + 1; return 0; }
false
FFmpeg
a9cd12ee2afb3f3aad783c396816b23d8513f472
static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, const uint8_t *buf, unsigned int substr) { SubStream *s = &m->substream[substr]; unsigned int ch; int sync_word, tmp; uint8_t checksum; uint8_t lossless_check; int start_count = get_bits_count(gbp); const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP ? MAX_MATRIX_CHANNEL_MLP : MAX_MATRIX_CHANNEL_TRUEHD; sync_word = get_bits(gbp, 13); if (sync_word != 0x31ea >> 1) { av_log(m->avctx, AV_LOG_ERROR, "restart header sync incorrect (got 0x%04x)\n", sync_word); return AVERROR_INVALIDDATA; } s->noise_type = get_bits1(gbp); if (m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) { av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n"); return AVERROR_INVALIDDATA; } skip_bits(gbp, 16); s->min_channel = get_bits(gbp, 4); s->max_channel = get_bits(gbp, 4); s->max_matrix_channel = get_bits(gbp, 4); if (s->max_matrix_channel > max_matrix_channel) { av_log(m->avctx, AV_LOG_ERROR, "Max matrix channel cannot be greater than %d.\n", max_matrix_channel); return AVERROR_INVALIDDATA; } if (s->max_channel != s->max_matrix_channel) { av_log(m->avctx, AV_LOG_ERROR, "Max channel must be equal max matrix channel.\n"); return AVERROR_INVALIDDATA; } if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) { av_log_ask_for_sample(m->avctx, "Number of channels %d is larger than the maximum supported " "by the decoder.\n", s->max_channel + 2); return AVERROR_PATCHWELCOME; } if (s->min_channel > s->max_channel) { av_log(m->avctx, AV_LOG_ERROR, "Substream min channel cannot be greater than max channel.\n"); return AVERROR_INVALIDDATA; } if (m->avctx->request_channels > 0 && s->max_channel + 1 >= m->avctx->request_channels && substr < m->max_decoded_substream) { av_log(m->avctx, AV_LOG_DEBUG, "Extracting %d channel downmix from substream %d. " "Further substreams will be skipped.\n", s->max_channel + 1, substr); m->max_decoded_substream = substr; } s->noise_shift = get_bits(gbp, 4); s->noisegen_seed = get_bits(gbp, 23); skip_bits(gbp, 19); s->data_check_present = get_bits1(gbp); lossless_check = get_bits(gbp, 8); if (substr == m->max_decoded_substream && s->lossless_check_data != 0xffffffff) { tmp = xor_32_to_8(s->lossless_check_data); if (tmp != lossless_check) av_log(m->avctx, AV_LOG_WARNING, "Lossless check failed - expected %02x, calculated %02x.\n", lossless_check, tmp); } skip_bits(gbp, 16); memset(s->ch_assign, 0, sizeof(s->ch_assign)); for (ch = 0; ch <= s->max_matrix_channel; ch++) { int ch_assign = get_bits(gbp, 6); if (ch_assign > s->max_matrix_channel) { av_log_ask_for_sample(m->avctx, "Assignment of matrix channel %d to invalid output channel %d.\n", ch, ch_assign); return AVERROR_PATCHWELCOME; } s->ch_assign[ch_assign] = ch; } if (m->avctx->codec_id == CODEC_ID_MLP && m->needs_reordering) { if (m->avctx->channel_layout == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) || m->avctx->channel_layout == AV_CH_LAYOUT_5POINT0_BACK) { int i = s->ch_assign[4]; s->ch_assign[4] = s->ch_assign[3]; s->ch_assign[3] = s->ch_assign[2]; s->ch_assign[2] = i; } else if (m->avctx->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) { FFSWAP(int, s->ch_assign[2], s->ch_assign[4]); FFSWAP(int, s->ch_assign[3], s->ch_assign[5]); } } if (m->avctx->codec_id == CODEC_ID_TRUEHD && (m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1 || m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1_WIDE)) { FFSWAP(int, s->ch_assign[4], s->ch_assign[6]); FFSWAP(int, s->ch_assign[5], s->ch_assign[7]); } else if (m->avctx->codec_id == CODEC_ID_TRUEHD && (m->avctx->channel_layout == AV_CH_LAYOUT_6POINT1 || m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_CENTER) || m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_FRONT_CENTER))) { int i = s->ch_assign[6]; s->ch_assign[6] = s->ch_assign[5]; s->ch_assign[5] = s->ch_assign[4]; s->ch_assign[4] = i; } checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count); if (checksum != get_bits(gbp, 8)) av_log(m->avctx, AV_LOG_ERROR, "restart header checksum error\n"); s->param_presence_flags = 0xff; s->num_primitive_matrices = 0; s->blocksize = 8; s->lossless_check_data = 0; memset(s->output_shift , 0, sizeof(s->output_shift )); memset(s->quant_step_size, 0, sizeof(s->quant_step_size)); for (ch = s->min_channel; ch <= s->max_channel; ch++) { ChannelParams *cp = &s->channel_params[ch]; cp->filter_params[FIR].order = 0; cp->filter_params[IIR].order = 0; cp->filter_params[FIR].shift = 0; cp->filter_params[IIR].shift = 0; cp->huff_offset = 0; cp->sign_huff_offset = (-1) << 23; cp->codebook = 0; cp->huff_lsbs = 24; } if (substr == m->max_decoded_substream) m->avctx->channels = s->max_matrix_channel + 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MLPDecodeContext *VAR_0, GetBitContext *VAR_1, const uint8_t *VAR_2, unsigned int VAR_3) { SubStream *s = &VAR_0->substream[VAR_3]; unsigned int VAR_4; int VAR_5, VAR_6; uint8_t checksum; uint8_t lossless_check; int VAR_7 = get_bits_count(VAR_1); const int VAR_8 = VAR_0->avctx->codec_id == CODEC_ID_MLP ? MAX_MATRIX_CHANNEL_MLP : MAX_MATRIX_CHANNEL_TRUEHD; VAR_5 = get_bits(VAR_1, 13); if (VAR_5 != 0x31ea >> 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "restart header sync incorrect (got 0x%04x)\n", VAR_5); return AVERROR_INVALIDDATA; } s->noise_type = get_bits1(VAR_1); if (VAR_0->avctx->codec_id == CODEC_ID_MLP && s->noise_type) { av_log(VAR_0->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n"); return AVERROR_INVALIDDATA; } skip_bits(VAR_1, 16); s->min_channel = get_bits(VAR_1, 4); s->max_channel = get_bits(VAR_1, 4); s->VAR_8 = get_bits(VAR_1, 4); if (s->VAR_8 > VAR_8) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Max matrix channel cannot be greater than %d.\n", VAR_8); return AVERROR_INVALIDDATA; } if (s->max_channel != s->VAR_8) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Max channel must be equal max matrix channel.\n"); return AVERROR_INVALIDDATA; } if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) { av_log_ask_for_sample(VAR_0->avctx, "Number of channels %d is larger than the maximum supported " "by the decoder.\n", s->max_channel + 2); return AVERROR_PATCHWELCOME; } if (s->min_channel > s->max_channel) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Substream min channel cannot be greater than max channel.\n"); return AVERROR_INVALIDDATA; } if (VAR_0->avctx->request_channels > 0 && s->max_channel + 1 >= VAR_0->avctx->request_channels && VAR_3 < VAR_0->max_decoded_substream) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Extracting %d channel downmix from substream %d. " "Further substreams will be skipped.\n", s->max_channel + 1, VAR_3); VAR_0->max_decoded_substream = VAR_3; } s->noise_shift = get_bits(VAR_1, 4); s->noisegen_seed = get_bits(VAR_1, 23); skip_bits(VAR_1, 19); s->data_check_present = get_bits1(VAR_1); lossless_check = get_bits(VAR_1, 8); if (VAR_3 == VAR_0->max_decoded_substream && s->lossless_check_data != 0xffffffff) { VAR_6 = xor_32_to_8(s->lossless_check_data); if (VAR_6 != lossless_check) av_log(VAR_0->avctx, AV_LOG_WARNING, "Lossless check failed - expected %02x, calculated %02x.\n", lossless_check, VAR_6); } skip_bits(VAR_1, 16); memset(s->ch_assign, 0, sizeof(s->ch_assign)); for (VAR_4 = 0; VAR_4 <= s->VAR_8; VAR_4++) { int ch_assign = get_bits(VAR_1, 6); if (ch_assign > s->VAR_8) { av_log_ask_for_sample(VAR_0->avctx, "Assignment of matrix channel %d to invalid output channel %d.\n", VAR_4, ch_assign); return AVERROR_PATCHWELCOME; } s->ch_assign[ch_assign] = VAR_4; } if (VAR_0->avctx->codec_id == CODEC_ID_MLP && VAR_0->needs_reordering) { if (VAR_0->avctx->channel_layout == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) || VAR_0->avctx->channel_layout == AV_CH_LAYOUT_5POINT0_BACK) { int VAR_10 = s->ch_assign[4]; s->ch_assign[4] = s->ch_assign[3]; s->ch_assign[3] = s->ch_assign[2]; s->ch_assign[2] = VAR_10; } else if (VAR_0->avctx->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) { FFSWAP(int, s->ch_assign[2], s->ch_assign[4]); FFSWAP(int, s->ch_assign[3], s->ch_assign[5]); } } if (VAR_0->avctx->codec_id == CODEC_ID_TRUEHD && (VAR_0->avctx->channel_layout == AV_CH_LAYOUT_7POINT1 || VAR_0->avctx->channel_layout == AV_CH_LAYOUT_7POINT1_WIDE)) { FFSWAP(int, s->ch_assign[4], s->ch_assign[6]); FFSWAP(int, s->ch_assign[5], s->ch_assign[7]); } else if (VAR_0->avctx->codec_id == CODEC_ID_TRUEHD && (VAR_0->avctx->channel_layout == AV_CH_LAYOUT_6POINT1 || VAR_0->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_CENTER) || VAR_0->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_FRONT_CENTER))) { int VAR_10 = s->ch_assign[6]; s->ch_assign[6] = s->ch_assign[5]; s->ch_assign[5] = s->ch_assign[4]; s->ch_assign[4] = VAR_10; } checksum = ff_mlp_restart_checksum(VAR_2, get_bits_count(VAR_1) - VAR_7); if (checksum != get_bits(VAR_1, 8)) av_log(VAR_0->avctx, AV_LOG_ERROR, "restart header checksum error\n"); s->param_presence_flags = 0xff; s->num_primitive_matrices = 0; s->blocksize = 8; s->lossless_check_data = 0; memset(s->output_shift , 0, sizeof(s->output_shift )); memset(s->quant_step_size, 0, sizeof(s->quant_step_size)); for (VAR_4 = s->min_channel; VAR_4 <= s->max_channel; VAR_4++) { ChannelParams *cp = &s->channel_params[VAR_4]; cp->filter_params[FIR].order = 0; cp->filter_params[IIR].order = 0; cp->filter_params[FIR].shift = 0; cp->filter_params[IIR].shift = 0; cp->huff_offset = 0; cp->sign_huff_offset = (-1) << 23; cp->codebook = 0; cp->huff_lsbs = 24; } if (VAR_3 == VAR_0->max_decoded_substream) VAR_0->avctx->channels = s->VAR_8 + 1; return 0; }
[ "static int FUNC_0(MLPDecodeContext *VAR_0, GetBitContext *VAR_1,\nconst uint8_t *VAR_2, unsigned int VAR_3)\n{", "SubStream *s = &VAR_0->substream[VAR_3];", "unsigned int VAR_4;", "int VAR_5, VAR_6;", "uint8_t checksum;", "uint8_t lossless_check;", "int VAR_7 = get_bits_count(VAR_1);", "const int VAR_8 = VAR_0->avctx->codec_id == CODEC_ID_MLP\n? MAX_MATRIX_CHANNEL_MLP\n: MAX_MATRIX_CHANNEL_TRUEHD;", "VAR_5 = get_bits(VAR_1, 13);", "if (VAR_5 != 0x31ea >> 1) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"restart header sync incorrect (got 0x%04x)\\n\", VAR_5);", "return AVERROR_INVALIDDATA;", "}", "s->noise_type = get_bits1(VAR_1);", "if (VAR_0->avctx->codec_id == CODEC_ID_MLP && s->noise_type) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"MLP must have 0x31ea sync word.\\n\");", "return AVERROR_INVALIDDATA;", "}", "skip_bits(VAR_1, 16);", "s->min_channel = get_bits(VAR_1, 4);", "s->max_channel = get_bits(VAR_1, 4);", "s->VAR_8 = get_bits(VAR_1, 4);", "if (s->VAR_8 > VAR_8) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Max matrix channel cannot be greater than %d.\\n\",\nVAR_8);", "return AVERROR_INVALIDDATA;", "}", "if (s->max_channel != s->VAR_8) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Max channel must be equal max matrix channel.\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {", "av_log_ask_for_sample(VAR_0->avctx,\n\"Number of channels %d is larger than the maximum supported \"\n\"by the decoder.\\n\", s->max_channel + 2);", "return AVERROR_PATCHWELCOME;", "}", "if (s->min_channel > s->max_channel) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Substream min channel cannot be greater than max channel.\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_0->avctx->request_channels > 0\n&& s->max_channel + 1 >= VAR_0->avctx->request_channels\n&& VAR_3 < VAR_0->max_decoded_substream) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"Extracting %d channel downmix from substream %d. \"\n\"Further substreams will be skipped.\\n\",\ns->max_channel + 1, VAR_3);", "VAR_0->max_decoded_substream = VAR_3;", "}", "s->noise_shift = get_bits(VAR_1, 4);", "s->noisegen_seed = get_bits(VAR_1, 23);", "skip_bits(VAR_1, 19);", "s->data_check_present = get_bits1(VAR_1);", "lossless_check = get_bits(VAR_1, 8);", "if (VAR_3 == VAR_0->max_decoded_substream\n&& s->lossless_check_data != 0xffffffff) {", "VAR_6 = xor_32_to_8(s->lossless_check_data);", "if (VAR_6 != lossless_check)\nav_log(VAR_0->avctx, AV_LOG_WARNING,\n\"Lossless check failed - expected %02x, calculated %02x.\\n\",\nlossless_check, VAR_6);", "}", "skip_bits(VAR_1, 16);", "memset(s->ch_assign, 0, sizeof(s->ch_assign));", "for (VAR_4 = 0; VAR_4 <= s->VAR_8; VAR_4++) {", "int ch_assign = get_bits(VAR_1, 6);", "if (ch_assign > s->VAR_8) {", "av_log_ask_for_sample(VAR_0->avctx,\n\"Assignment of matrix channel %d to invalid output channel %d.\\n\",\nVAR_4, ch_assign);", "return AVERROR_PATCHWELCOME;", "}", "s->ch_assign[ch_assign] = VAR_4;", "}", "if (VAR_0->avctx->codec_id == CODEC_ID_MLP && VAR_0->needs_reordering) {", "if (VAR_0->avctx->channel_layout == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) ||\nVAR_0->avctx->channel_layout == AV_CH_LAYOUT_5POINT0_BACK) {", "int VAR_10 = s->ch_assign[4];", "s->ch_assign[4] = s->ch_assign[3];", "s->ch_assign[3] = s->ch_assign[2];", "s->ch_assign[2] = VAR_10;", "} else if (VAR_0->avctx->channel_layout == AV_CH_LAYOUT_5POINT1_BACK) {", "FFSWAP(int, s->ch_assign[2], s->ch_assign[4]);", "FFSWAP(int, s->ch_assign[3], s->ch_assign[5]);", "}", "}", "if (VAR_0->avctx->codec_id == CODEC_ID_TRUEHD &&\n(VAR_0->avctx->channel_layout == AV_CH_LAYOUT_7POINT1 ||\nVAR_0->avctx->channel_layout == AV_CH_LAYOUT_7POINT1_WIDE)) {", "FFSWAP(int, s->ch_assign[4], s->ch_assign[6]);", "FFSWAP(int, s->ch_assign[5], s->ch_assign[7]);", "} else if (VAR_0->avctx->codec_id == CODEC_ID_TRUEHD &&", "(VAR_0->avctx->channel_layout == AV_CH_LAYOUT_6POINT1 ||\nVAR_0->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_CENTER) ||\nVAR_0->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_FRONT_CENTER))) {", "int VAR_10 = s->ch_assign[6];", "s->ch_assign[6] = s->ch_assign[5];", "s->ch_assign[5] = s->ch_assign[4];", "s->ch_assign[4] = VAR_10;", "}", "checksum = ff_mlp_restart_checksum(VAR_2, get_bits_count(VAR_1) - VAR_7);", "if (checksum != get_bits(VAR_1, 8))\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"restart header checksum error\\n\");", "s->param_presence_flags = 0xff;", "s->num_primitive_matrices = 0;", "s->blocksize = 8;", "s->lossless_check_data = 0;", "memset(s->output_shift , 0, sizeof(s->output_shift ));", "memset(s->quant_step_size, 0, sizeof(s->quant_step_size));", "for (VAR_4 = s->min_channel; VAR_4 <= s->max_channel; VAR_4++) {", "ChannelParams *cp = &s->channel_params[VAR_4];", "cp->filter_params[FIR].order = 0;", "cp->filter_params[IIR].order = 0;", "cp->filter_params[FIR].shift = 0;", "cp->filter_params[IIR].shift = 0;", "cp->huff_offset = 0;", "cp->sign_huff_offset = (-1) << 23;", "cp->codebook = 0;", "cp->huff_lsbs = 24;", "}", "if (VAR_3 == VAR_0->max_decoded_substream)\nVAR_0->avctx->channels = s->VAR_8 + 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125, 127, 129 ], [ 131, 133, 135, 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167, 169, 171 ], [ 173 ], [ 177 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245, 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 265, 267 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 317, 319 ], [ 323 ], [ 325 ] ]
3,396
static void init_blk_migration(Monitor *mon, QEMUFile *f) { BlkMigDevState *bmds; BlockDriverState *bs; block_mig_state.submitted = 0; block_mig_state.read_done = 0; block_mig_state.transferred = 0; block_mig_state.total_sector_sum = 0; block_mig_state.prev_progress = -1; for (bs = bdrv_first; bs != NULL; bs = bs->next) { if (bs->type == BDRV_TYPE_HD) { bmds = qemu_mallocz(sizeof(BlkMigDevState)); bmds->bs = bs; bmds->bulk_completed = 0; bmds->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; bmds->completed_sectors = 0; bmds->shared_base = block_mig_state.shared_base; block_mig_state.total_sector_sum += bmds->total_sectors; if (bmds->shared_base) { monitor_printf(mon, "Start migration for %s with shared base " "image\n", bs->device_name); } else { monitor_printf(mon, "Start full migration for %s\n", bs->device_name); } QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); } } }
true
qemu
792773b2255d25c6f5fe9dfa0ae200debab92de4
static void init_blk_migration(Monitor *mon, QEMUFile *f) { BlkMigDevState *bmds; BlockDriverState *bs; block_mig_state.submitted = 0; block_mig_state.read_done = 0; block_mig_state.transferred = 0; block_mig_state.total_sector_sum = 0; block_mig_state.prev_progress = -1; for (bs = bdrv_first; bs != NULL; bs = bs->next) { if (bs->type == BDRV_TYPE_HD) { bmds = qemu_mallocz(sizeof(BlkMigDevState)); bmds->bs = bs; bmds->bulk_completed = 0; bmds->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; bmds->completed_sectors = 0; bmds->shared_base = block_mig_state.shared_base; block_mig_state.total_sector_sum += bmds->total_sectors; if (bmds->shared_base) { monitor_printf(mon, "Start migration for %s with shared base " "image\n", bs->device_name); } else { monitor_printf(mon, "Start full migration for %s\n", bs->device_name); } QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); } } }
{ "code": [ " bmds->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;", " block_mig_state.total_sector_sum += bmds->total_sectors;" ], "line_no": [ 33, 41 ] }
static void FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1) { BlkMigDevState *bmds; BlockDriverState *bs; block_mig_state.submitted = 0; block_mig_state.read_done = 0; block_mig_state.transferred = 0; block_mig_state.total_sector_sum = 0; block_mig_state.prev_progress = -1; for (bs = bdrv_first; bs != NULL; bs = bs->next) { if (bs->type == BDRV_TYPE_HD) { bmds = qemu_mallocz(sizeof(BlkMigDevState)); bmds->bs = bs; bmds->bulk_completed = 0; bmds->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; bmds->completed_sectors = 0; bmds->shared_base = block_mig_state.shared_base; block_mig_state.total_sector_sum += bmds->total_sectors; if (bmds->shared_base) { monitor_printf(VAR_0, "Start migration for %s with shared base " "image\n", bs->device_name); } else { monitor_printf(VAR_0, "Start full migration for %s\n", bs->device_name); } QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); } } }
[ "static void FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1)\n{", "BlkMigDevState *bmds;", "BlockDriverState *bs;", "block_mig_state.submitted = 0;", "block_mig_state.read_done = 0;", "block_mig_state.transferred = 0;", "block_mig_state.total_sector_sum = 0;", "block_mig_state.prev_progress = -1;", "for (bs = bdrv_first; bs != NULL; bs = bs->next) {", "if (bs->type == BDRV_TYPE_HD) {", "bmds = qemu_mallocz(sizeof(BlkMigDevState));", "bmds->bs = bs;", "bmds->bulk_completed = 0;", "bmds->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;", "bmds->completed_sectors = 0;", "bmds->shared_base = block_mig_state.shared_base;", "block_mig_state.total_sector_sum += bmds->total_sectors;", "if (bmds->shared_base) {", "monitor_printf(VAR_0, \"Start migration for %s with shared base \"\n\"image\\n\",\nbs->device_name);", "} else {", "monitor_printf(VAR_0, \"Start full migration for %s\\n\",\nbs->device_name);", "}", "QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ] ]
3,400
static void vmgenid_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_vmgenid; dc->realize = vmgenid_realize; dc->hotpluggable = false; dc->props = vmgenid_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); object_class_property_add_str(klass, VMGENID_GUID, NULL, vmgenid_set_guid, NULL); object_class_property_set_description(klass, VMGENID_GUID, "Set Global Unique Identifier " "(big-endian) or auto for random value", NULL); }
true
qemu
c8389550dedc65892fba9c3df29423efd802f544
static void vmgenid_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_vmgenid; dc->realize = vmgenid_realize; dc->hotpluggable = false; dc->props = vmgenid_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); object_class_property_add_str(klass, VMGENID_GUID, NULL, vmgenid_set_guid, NULL); object_class_property_set_description(klass, VMGENID_GUID, "Set Global Unique Identifier " "(big-endian) or auto for random value", NULL); }
{ "code": [ " dc->props = vmgenid_properties;" ], "line_no": [ 15 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->vmsd = &vmstate_vmgenid; dc->realize = vmgenid_realize; dc->hotpluggable = false; dc->props = vmgenid_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); object_class_property_add_str(VAR_0, VMGENID_GUID, NULL, vmgenid_set_guid, NULL); object_class_property_set_description(VAR_0, VMGENID_GUID, "Set Global Unique Identifier " "(big-endian) or auto for random value", NULL); }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->vmsd = &vmstate_vmgenid;", "dc->realize = vmgenid_realize;", "dc->hotpluggable = false;", "dc->props = vmgenid_properties;", "set_bit(DEVICE_CATEGORY_MISC, dc->categories);", "object_class_property_add_str(VAR_0, VMGENID_GUID, NULL,\nvmgenid_set_guid, NULL);", "object_class_property_set_description(VAR_0, VMGENID_GUID,\n\"Set Global Unique Identifier \"\n\"(big-endian) or auto for random value\",\nNULL);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27, 29, 31 ], [ 33 ] ]
3,402
static void run_block_job(BlockJob *job, Error **errp) { AioContext *aio_context = blk_get_aio_context(job->blk); /* FIXME In error cases, the job simply goes away and we access a dangling * pointer below. */ aio_context_acquire(aio_context); do { aio_poll(aio_context, true); qemu_progress_print(job->len ? ((float)job->offset / job->len * 100.f) : 0.0f, 0); } while (!job->ready); block_job_complete_sync(job, errp); aio_context_release(aio_context); /* A block job may finish instantaneously without publishing any progress, * so just signal completion here */ qemu_progress_print(100.f, 0); }
true
qemu
4172a00373b2c81374293becc02b16b7f8c76659
static void run_block_job(BlockJob *job, Error **errp) { AioContext *aio_context = blk_get_aio_context(job->blk); aio_context_acquire(aio_context); do { aio_poll(aio_context, true); qemu_progress_print(job->len ? ((float)job->offset / job->len * 100.f) : 0.0f, 0); } while (!job->ready); block_job_complete_sync(job, errp); aio_context_release(aio_context); qemu_progress_print(100.f, 0); }
{ "code": [ " } while (!job->ready);", " block_job_complete_sync(job, errp);", " qemu_progress_print(100.f, 0);" ], "line_no": [ 23, 27, 37 ] }
static void FUNC_0(BlockJob *VAR_0, Error **VAR_1) { AioContext *aio_context = blk_get_aio_context(VAR_0->blk); aio_context_acquire(aio_context); do { aio_poll(aio_context, true); qemu_progress_print(VAR_0->len ? ((float)VAR_0->offset / VAR_0->len * 100.f) : 0.0f, 0); } while (!VAR_0->ready); block_job_complete_sync(VAR_0, VAR_1); aio_context_release(aio_context); qemu_progress_print(100.f, 0); }
[ "static void FUNC_0(BlockJob *VAR_0, Error **VAR_1)\n{", "AioContext *aio_context = blk_get_aio_context(VAR_0->blk);", "aio_context_acquire(aio_context);", "do {", "aio_poll(aio_context, true);", "qemu_progress_print(VAR_0->len ?\n((float)VAR_0->offset / VAR_0->len * 100.f) : 0.0f, 0);", "} while (!VAR_0->ready);", "block_job_complete_sync(VAR_0, VAR_1);", "aio_context_release(aio_context);", "qemu_progress_print(100.f, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 37 ], [ 39 ] ]
3,403
static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { int h, w; uint8_t *Y1, *Y2, *U, *V; int ret; if (src_size < avctx->width * avctx->height * 3 / 2) { av_log(avctx, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } avctx->pix_fmt = AV_PIX_FMT_YUV420P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y1 = pic->data[0]; Y2 = pic->data[0] + pic->linesize[0]; U = pic->data[1]; V = pic->data[2]; for (h = 0; h < avctx->height; h += 2) { for (w = 0; w < avctx->width; w += 2) { AV_COPY16(Y1 + w, src); AV_COPY16(Y2 + w, src + 2); U[w >> 1] = src[4] + 0x80; V[w >> 1] = src[5] + 0x80; src += 6; } Y1 += pic->linesize[0] << 1; Y2 += pic->linesize[0] << 1; U += pic->linesize[1]; V += pic->linesize[2]; } return 0; }
true
FFmpeg
a392bf657015c9a79a5a13adfbfb15086c1943b9
static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size) { int h, w; uint8_t *Y1, *Y2, *U, *V; int ret; if (src_size < avctx->width * avctx->height * 3 / 2) { av_log(avctx, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } avctx->pix_fmt = AV_PIX_FMT_YUV420P; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; Y1 = pic->data[0]; Y2 = pic->data[0] + pic->linesize[0]; U = pic->data[1]; V = pic->data[2]; for (h = 0; h < avctx->height; h += 2) { for (w = 0; w < avctx->width; w += 2) { AV_COPY16(Y1 + w, src); AV_COPY16(Y2 + w, src + 2); U[w >> 1] = src[4] + 0x80; V[w >> 1] = src[5] + 0x80; src += 6; } Y1 += pic->linesize[0] << 1; Y2 += pic->linesize[0] << 1; U += pic->linesize[1]; V += pic->linesize[2]; } return 0; }
{ "code": [ " if (src_size < avctx->width * avctx->height * 3 / 2) {" ], "line_no": [ 15 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, const uint8_t *VAR_2, int VAR_3) { int VAR_4, VAR_5; uint8_t *Y1, *Y2, *U, *V; int VAR_6; if (VAR_3 < VAR_0->width * VAR_0->height * 3 / 2) { av_log(VAR_0, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } VAR_0->pix_fmt = AV_PIX_FMT_YUV420P; if ((VAR_6 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0) return VAR_6; Y1 = VAR_1->data[0]; Y2 = VAR_1->data[0] + VAR_1->linesize[0]; U = VAR_1->data[1]; V = VAR_1->data[2]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4 += 2) { for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 2) { AV_COPY16(Y1 + VAR_5, VAR_2); AV_COPY16(Y2 + VAR_5, VAR_2 + 2); U[VAR_5 >> 1] = VAR_2[4] + 0x80; V[VAR_5 >> 1] = VAR_2[5] + 0x80; VAR_2 += 6; } Y1 += VAR_1->linesize[0] << 1; Y2 += VAR_1->linesize[0] << 1; U += VAR_1->linesize[1]; V += VAR_1->linesize[2]; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5;", "uint8_t *Y1, *Y2, *U, *V;", "int VAR_6;", "if (VAR_3 < VAR_0->width * VAR_0->height * 3 / 2) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->pix_fmt = AV_PIX_FMT_YUV420P;", "if ((VAR_6 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0)\nreturn VAR_6;", "Y1 = VAR_1->data[0];", "Y2 = VAR_1->data[0] + VAR_1->linesize[0];", "U = VAR_1->data[1];", "V = VAR_1->data[2];", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4 += 2) {", "for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 2) {", "AV_COPY16(Y1 + VAR_5, VAR_2);", "AV_COPY16(Y2 + VAR_5, VAR_2 + 2);", "U[VAR_5 >> 1] = VAR_2[4] + 0x80;", "V[VAR_5 >> 1] = VAR_2[5] + 0x80;", "VAR_2 += 6;", "}", "Y1 += VAR_1->linesize[0] << 1;", "Y2 += VAR_1->linesize[0] << 1;", "U += VAR_1->linesize[1];", "V += VAR_1->linesize[2];", "}", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
3,404
int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; AVPacket user_pkt = *avpkt; int needs_realloc = !user_pkt.data; *got_packet_ptr = 0; if(CONFIG_FRAME_THREAD_ENCODER && avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME)) return ff_thread_video_encode_frame(avctx, avpkt, frame, got_packet_ptr); if ((avctx->flags&CODEC_FLAG_PASS1) && avctx->stats_out) avctx->stats_out[0] = '\0'; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); avpkt->size = 0; return 0; } if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) return AVERROR(EINVAL); av_assert0(avctx->codec->encode2); ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); av_assert0(ret <= 0); if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { needs_realloc = 0; if (user_pkt.data) { if (user_pkt.size >= avpkt->size) { memcpy(user_pkt.data, avpkt->data, avpkt->size); } else { av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); avpkt->size = user_pkt.size; ret = -1; } avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; #if FF_API_DESTRUCT_PACKET FF_DISABLE_DEPRECATION_WARNINGS avpkt->destruct = user_pkt.destruct; FF_ENABLE_DEPRECATION_WARNINGS #endif } else { if (av_dup_packet(avpkt) < 0) { ret = AVERROR(ENOMEM); } } } if (!ret) { if (!*got_packet_ptr) avpkt->size = 0; else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) avpkt->pts = avpkt->dts = frame->pts; if (needs_realloc && avpkt->data) { ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) av_free_packet(avpkt); else av_packet_merge_side_data(avpkt); emms_c(); return ret; }
true
FFmpeg
3393cd85459cb9c23dec90373da91559987000ee
int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; AVPacket user_pkt = *avpkt; int needs_realloc = !user_pkt.data; *got_packet_ptr = 0; if(CONFIG_FRAME_THREAD_ENCODER && avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME)) return ff_thread_video_encode_frame(avctx, avpkt, frame, got_packet_ptr); if ((avctx->flags&CODEC_FLAG_PASS1) && avctx->stats_out) avctx->stats_out[0] = '\0'; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); avpkt->size = 0; return 0; } if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) return AVERROR(EINVAL); av_assert0(avctx->codec->encode2); ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); av_assert0(ret <= 0); if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { needs_realloc = 0; if (user_pkt.data) { if (user_pkt.size >= avpkt->size) { memcpy(user_pkt.data, avpkt->data, avpkt->size); } else { av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); avpkt->size = user_pkt.size; ret = -1; } avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; #if FF_API_DESTRUCT_PACKET FF_DISABLE_DEPRECATION_WARNINGS avpkt->destruct = user_pkt.destruct; FF_ENABLE_DEPRECATION_WARNINGS #endif } else { if (av_dup_packet(avpkt) < 0) { ret = AVERROR(ENOMEM); } } } if (!ret) { if (!*got_packet_ptr) avpkt->size = 0; else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) avpkt->pts = avpkt->dts = frame->pts; if (needs_realloc && avpkt->data) { ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) av_free_packet(avpkt); else av_packet_merge_side_data(avpkt); emms_c(); return ret; }
{ "code": [], "line_no": [] }
int VAR_0 avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; AVPacket user_pkt = *avpkt; int needs_realloc = !user_pkt.data; *got_packet_ptr = 0; if(CONFIG_FRAME_THREAD_ENCODER && avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME)) return ff_thread_video_encode_frame(avctx, avpkt, frame, got_packet_ptr); if ((avctx->flags&CODEC_FLAG_PASS1) && avctx->stats_out) avctx->stats_out[0] = '\0'; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); avpkt->size = 0; return 0; } if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) return AVERROR(EINVAL); av_assert0(avctx->codec->encode2); ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); av_assert0(ret <= 0); if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { needs_realloc = 0; if (user_pkt.data) { if (user_pkt.size >= avpkt->size) { memcpy(user_pkt.data, avpkt->data, avpkt->size); } else { av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); avpkt->size = user_pkt.size; ret = -1; } avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; #if FF_API_DESTRUCT_PACKET FF_DISABLE_DEPRECATION_WARNINGS avpkt->destruct = user_pkt.destruct; FF_ENABLE_DEPRECATION_WARNINGS #endif } else { if (av_dup_packet(avpkt) < 0) { ret = AVERROR(ENOMEM); } } } if (!ret) { if (!*got_packet_ptr) avpkt->size = 0; else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) avpkt->pts = avpkt->dts = frame->pts; if (needs_realloc && avpkt->data) { ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) av_free_packet(avpkt); else av_packet_merge_side_data(avpkt); emms_c(); return ret; }
[ "int VAR_0 avcodec_encode_video2(AVCodecContext *avctx,\nAVPacket *avpkt,\nconst AVFrame *frame,\nint *got_packet_ptr)\n{", "int ret;", "AVPacket user_pkt = *avpkt;", "int needs_realloc = !user_pkt.data;", "*got_packet_ptr = 0;", "if(CONFIG_FRAME_THREAD_ENCODER &&\navctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))\nreturn ff_thread_video_encode_frame(avctx, avpkt, frame, got_packet_ptr);", "if ((avctx->flags&CODEC_FLAG_PASS1) && avctx->stats_out)\navctx->stats_out[0] = '\\0';", "if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {", "av_free_packet(avpkt);", "av_init_packet(avpkt);", "avpkt->size = 0;", "return 0;", "}", "if (av_image_check_size(avctx->width, avctx->height, 0, avctx))\nreturn AVERROR(EINVAL);", "av_assert0(avctx->codec->encode2);", "ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);", "av_assert0(ret <= 0);", "if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) {", "needs_realloc = 0;", "if (user_pkt.data) {", "if (user_pkt.size >= avpkt->size) {", "memcpy(user_pkt.data, avpkt->data, avpkt->size);", "} else {", "av_log(avctx, AV_LOG_ERROR, \"Provided packet is too small, needs to be %d\\n\", avpkt->size);", "avpkt->size = user_pkt.size;", "ret = -1;", "}", "avpkt->buf = user_pkt.buf;", "avpkt->data = user_pkt.data;", "#if FF_API_DESTRUCT_PACKET\nFF_DISABLE_DEPRECATION_WARNINGS\navpkt->destruct = user_pkt.destruct;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\n} else {", "if (av_dup_packet(avpkt) < 0) {", "ret = AVERROR(ENOMEM);", "}", "}", "}", "if (!ret) {", "if (!*got_packet_ptr)\navpkt->size = 0;", "else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))\navpkt->pts = avpkt->dts = frame->pts;", "if (needs_realloc && avpkt->data) {", "ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);", "if (ret >= 0)\navpkt->data = avpkt->buf->data;", "}", "avctx->frame_number++;", "}", "if (ret < 0 || !*got_packet_ptr)\nav_free_packet(avpkt);", "else\nav_packet_merge_side_data(avpkt);", "emms_c();", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4, 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10, 11, 12 ], [ 13, 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38, 39, 40 ], [ 41, 42, 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50, 51 ], [ 52, 53 ], [ 54 ], [ 55 ], [ 56, 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61, 62 ], [ 63, 64 ], [ 65 ], [ 66 ], [ 67 ] ]
3,405
static int dxva2_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const HEVCContext *h = avctx->priv_data; AVDXVAContext *ctx = avctx->hwaccel_context; struct hevc_dxva2_picture_context *ctx_pic = h->ref->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; av_assert0(ctx_pic); /* Fill up DXVA_PicParams_HEVC */ fill_picture_parameters(avctx, ctx, h, &ctx_pic->pp); /* Fill up DXVA_Qmatrix_HEVC */ fill_scaling_lists(ctx, h, &ctx_pic->qm); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; ctx_pic->bitstream = NULL; return 0; }
false
FFmpeg
ab28108a361196134704071b7b34c42fc7d747c7
static int dxva2_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const HEVCContext *h = avctx->priv_data; AVDXVAContext *ctx = avctx->hwaccel_context; struct hevc_dxva2_picture_context *ctx_pic = h->ref->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(avctx, ctx)) return -1; av_assert0(ctx_pic); fill_picture_parameters(avctx, ctx, h, &ctx_pic->pp); fill_scaling_lists(ctx, h, &ctx_pic->qm); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; ctx_pic->bitstream = NULL; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, av_unused const VAR_1 *buffer, av_unused uint32_t size) { const HEVCContext *VAR_2 = VAR_0->priv_data; AVDXVAContext *ctx = VAR_0->hwaccel_context; struct hevc_dxva2_picture_context *VAR_3 = VAR_2->ref->hwaccel_picture_private; if (!DXVA_CONTEXT_VALID(VAR_0, ctx)) return -1; av_assert0(VAR_3); fill_picture_parameters(VAR_0, ctx, VAR_2, &VAR_3->pp); fill_scaling_lists(ctx, VAR_2, &VAR_3->qm); VAR_3->slice_count = 0; VAR_3->bitstream_size = 0; VAR_3->bitstream = NULL; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nav_unused const VAR_1 *buffer,\nav_unused uint32_t size)\n{", "const HEVCContext *VAR_2 = VAR_0->priv_data;", "AVDXVAContext *ctx = VAR_0->hwaccel_context;", "struct hevc_dxva2_picture_context *VAR_3 = VAR_2->ref->hwaccel_picture_private;", "if (!DXVA_CONTEXT_VALID(VAR_0, ctx))\nreturn -1;", "av_assert0(VAR_3);", "fill_picture_parameters(VAR_0, ctx, VAR_2, &VAR_3->pp);", "fill_scaling_lists(ctx, VAR_2, &VAR_3->qm);", "VAR_3->slice_count = 0;", "VAR_3->bitstream_size = 0;", "VAR_3->bitstream = NULL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 27 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
3,406
static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, int *header_len, AVDictionary **m, int framing_bit) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; int size; uint8_t *p, *p0; ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit; p = av_mallocz(size); if (!p) return NULL; p0 = p; p += offset; ff_vorbiscomment_write(&p, m, vendor); if (framing_bit) bytestream_put_byte(&p, 1); *header_len = size; return p0; }
false
FFmpeg
0db5b2b9f8a96298eeba7988d43c4eb44220fab3
static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, int *header_len, AVDictionary **m, int framing_bit) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; int size; uint8_t *p, *p0; ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit; p = av_mallocz(size); if (!p) return NULL; p0 = p; p += offset; ff_vorbiscomment_write(&p, m, vendor); if (framing_bit) bytestream_put_byte(&p, 1); *header_len = size; return p0; }
{ "code": [], "line_no": [] }
static uint8_t *FUNC_0(int offset, int bitexact, int *header_len, AVDictionary **m, int framing_bit) { const char *VAR_0 = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; int VAR_1; uint8_t *p, *p0; ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); VAR_1 = offset + ff_vorbiscomment_length(*m, VAR_0) + framing_bit; p = av_mallocz(VAR_1); if (!p) return NULL; p0 = p; p += offset; ff_vorbiscomment_write(&p, m, VAR_0); if (framing_bit) bytestream_put_byte(&p, 1); *header_len = VAR_1; return p0; }
[ "static uint8_t *FUNC_0(int offset, int bitexact,\nint *header_len, AVDictionary **m, int framing_bit)\n{", "const char *VAR_0 = bitexact ? \"ffmpeg\" : LIBAVFORMAT_IDENT;", "int VAR_1;", "uint8_t *p, *p0;", "ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);", "VAR_1 = offset + ff_vorbiscomment_length(*m, VAR_0) + framing_bit;", "p = av_mallocz(VAR_1);", "if (!p)\nreturn NULL;", "p0 = p;", "p += offset;", "ff_vorbiscomment_write(&p, m, VAR_0);", "if (framing_bit)\nbytestream_put_byte(&p, 1);", "*header_len = VAR_1;", "return p0;", "}" ]
[ 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 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45 ] ]
3,407
static void envelope_peak16(WaveformContext *s, AVFrame *out, int plane, int component) { const int dst_linesize = out->linesize[component] / 2; const int bg = s->bg_color[component] * (s->size / 256); const int limit = s->size - 1; const int is_chroma = (component == 1 || component == 2); const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0); const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0); const int dst_h = FF_CEIL_RSHIFT(out->height, shift_h); const int dst_w = FF_CEIL_RSHIFT(out->width, shift_w); const int start = s->estart[plane]; const int end = s->eend[plane]; int *emax = s->emax[plane][component]; int *emin = s->emin[plane][component]; uint16_t *dst; int x, y; if (s->mode) { for (x = 0; x < dst_w; x++) { for (y = start; y < end && y < emin[x]; y++) { dst = (uint16_t *)out->data[component] + y * dst_linesize + x; if (dst[0] != bg) { emin[x] = y; break; } } for (y = end - 1; y >= start && y >= emax[x]; y--) { dst = (uint16_t *)out->data[component] + y * dst_linesize + x; if (dst[0] != bg) { emax[x] = y; break; } } } if (s->envelope == 3) envelope_instant16(s, out, plane, component); for (x = 0; x < dst_w; x++) { dst = (uint16_t *)out->data[component] + emin[x] * dst_linesize + x; dst[0] = limit; dst = (uint16_t *)out->data[component] + emax[x] * dst_linesize + x; dst[0] = limit; } } else { for (y = 0; y < dst_h; y++) { dst = (uint16_t *)out->data[component] + y * dst_linesize; for (x = start; x < end && x < emin[y]; x++) { if (dst[x] != bg) { emin[y] = x; break; } } for (x = end - 1; x >= start && x >= emax[y]; x--) { if (dst[x] != bg) { emax[y] = x; break; } } } if (s->envelope == 3) envelope_instant16(s, out, plane, component); for (y = 0; y < dst_h; y++) { dst = (uint16_t *)out->data[component] + y * dst_linesize + emin[y]; dst[0] = limit; dst = (uint16_t *)out->data[component] + y * dst_linesize + emax[y]; dst[0] = limit; } } }
false
FFmpeg
db592f3b03a21d5bd5237021c00af3ce0431fc60
static void envelope_peak16(WaveformContext *s, AVFrame *out, int plane, int component) { const int dst_linesize = out->linesize[component] / 2; const int bg = s->bg_color[component] * (s->size / 256); const int limit = s->size - 1; const int is_chroma = (component == 1 || component == 2); const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0); const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0); const int dst_h = FF_CEIL_RSHIFT(out->height, shift_h); const int dst_w = FF_CEIL_RSHIFT(out->width, shift_w); const int start = s->estart[plane]; const int end = s->eend[plane]; int *emax = s->emax[plane][component]; int *emin = s->emin[plane][component]; uint16_t *dst; int x, y; if (s->mode) { for (x = 0; x < dst_w; x++) { for (y = start; y < end && y < emin[x]; y++) { dst = (uint16_t *)out->data[component] + y * dst_linesize + x; if (dst[0] != bg) { emin[x] = y; break; } } for (y = end - 1; y >= start && y >= emax[x]; y--) { dst = (uint16_t *)out->data[component] + y * dst_linesize + x; if (dst[0] != bg) { emax[x] = y; break; } } } if (s->envelope == 3) envelope_instant16(s, out, plane, component); for (x = 0; x < dst_w; x++) { dst = (uint16_t *)out->data[component] + emin[x] * dst_linesize + x; dst[0] = limit; dst = (uint16_t *)out->data[component] + emax[x] * dst_linesize + x; dst[0] = limit; } } else { for (y = 0; y < dst_h; y++) { dst = (uint16_t *)out->data[component] + y * dst_linesize; for (x = start; x < end && x < emin[y]; x++) { if (dst[x] != bg) { emin[y] = x; break; } } for (x = end - 1; x >= start && x >= emax[y]; x--) { if (dst[x] != bg) { emax[y] = x; break; } } } if (s->envelope == 3) envelope_instant16(s, out, plane, component); for (y = 0; y < dst_h; y++) { dst = (uint16_t *)out->data[component] + y * dst_linesize + emin[y]; dst[0] = limit; dst = (uint16_t *)out->data[component] + y * dst_linesize + emax[y]; dst[0] = limit; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3) { const int VAR_4 = VAR_1->linesize[VAR_3] / 2; const int VAR_5 = VAR_0->bg_color[VAR_3] * (VAR_0->size / 256); const int VAR_6 = VAR_0->size - 1; const int VAR_7 = (VAR_3 == 1 || VAR_3 == 2); const int VAR_8 = (VAR_7 ? VAR_0->desc->log2_chroma_w : 0); const int VAR_9 = (VAR_7 ? VAR_0->desc->log2_chroma_h : 0); const int VAR_10 = FF_CEIL_RSHIFT(VAR_1->height, VAR_9); const int VAR_11 = FF_CEIL_RSHIFT(VAR_1->width, VAR_8); const int VAR_12 = VAR_0->estart[VAR_2]; const int VAR_13 = VAR_0->eend[VAR_2]; int *VAR_14 = VAR_0->VAR_14[VAR_2][VAR_3]; int *VAR_15 = VAR_0->VAR_15[VAR_2][VAR_3]; uint16_t *dst; int VAR_16, VAR_17; if (VAR_0->mode) { for (VAR_16 = 0; VAR_16 < VAR_11; VAR_16++) { for (VAR_17 = VAR_12; VAR_17 < VAR_13 && VAR_17 < VAR_15[VAR_16]; VAR_17++) { dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_16; if (dst[0] != VAR_5) { VAR_15[VAR_16] = VAR_17; break; } } for (VAR_17 = VAR_13 - 1; VAR_17 >= VAR_12 && VAR_17 >= VAR_14[VAR_16]; VAR_17--) { dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_16; if (dst[0] != VAR_5) { VAR_14[VAR_16] = VAR_17; break; } } } if (VAR_0->envelope == 3) envelope_instant16(VAR_0, VAR_1, VAR_2, VAR_3); for (VAR_16 = 0; VAR_16 < VAR_11; VAR_16++) { dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_15[VAR_16] * VAR_4 + VAR_16; dst[0] = VAR_6; dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_14[VAR_16] * VAR_4 + VAR_16; dst[0] = VAR_6; } } else { for (VAR_17 = 0; VAR_17 < VAR_10; VAR_17++) { dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4; for (VAR_16 = VAR_12; VAR_16 < VAR_13 && VAR_16 < VAR_15[VAR_17]; VAR_16++) { if (dst[VAR_16] != VAR_5) { VAR_15[VAR_17] = VAR_16; break; } } for (VAR_16 = VAR_13 - 1; VAR_16 >= VAR_12 && VAR_16 >= VAR_14[VAR_17]; VAR_16--) { if (dst[VAR_16] != VAR_5) { VAR_14[VAR_17] = VAR_16; break; } } } if (VAR_0->envelope == 3) envelope_instant16(VAR_0, VAR_1, VAR_2, VAR_3); for (VAR_17 = 0; VAR_17 < VAR_10; VAR_17++) { dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_15[VAR_17]; dst[0] = VAR_6; dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_14[VAR_17]; dst[0] = VAR_6; } } }
[ "static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, int VAR_2, int VAR_3)\n{", "const int VAR_4 = VAR_1->linesize[VAR_3] / 2;", "const int VAR_5 = VAR_0->bg_color[VAR_3] * (VAR_0->size / 256);", "const int VAR_6 = VAR_0->size - 1;", "const int VAR_7 = (VAR_3 == 1 || VAR_3 == 2);", "const int VAR_8 = (VAR_7 ? VAR_0->desc->log2_chroma_w : 0);", "const int VAR_9 = (VAR_7 ? VAR_0->desc->log2_chroma_h : 0);", "const int VAR_10 = FF_CEIL_RSHIFT(VAR_1->height, VAR_9);", "const int VAR_11 = FF_CEIL_RSHIFT(VAR_1->width, VAR_8);", "const int VAR_12 = VAR_0->estart[VAR_2];", "const int VAR_13 = VAR_0->eend[VAR_2];", "int *VAR_14 = VAR_0->VAR_14[VAR_2][VAR_3];", "int *VAR_15 = VAR_0->VAR_15[VAR_2][VAR_3];", "uint16_t *dst;", "int VAR_16, VAR_17;", "if (VAR_0->mode) {", "for (VAR_16 = 0; VAR_16 < VAR_11; VAR_16++) {", "for (VAR_17 = VAR_12; VAR_17 < VAR_13 && VAR_17 < VAR_15[VAR_16]; VAR_17++) {", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_16;", "if (dst[0] != VAR_5) {", "VAR_15[VAR_16] = VAR_17;", "break;", "}", "}", "for (VAR_17 = VAR_13 - 1; VAR_17 >= VAR_12 && VAR_17 >= VAR_14[VAR_16]; VAR_17--) {", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_16;", "if (dst[0] != VAR_5) {", "VAR_14[VAR_16] = VAR_17;", "break;", "}", "}", "}", "if (VAR_0->envelope == 3)\nenvelope_instant16(VAR_0, VAR_1, VAR_2, VAR_3);", "for (VAR_16 = 0; VAR_16 < VAR_11; VAR_16++) {", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_15[VAR_16] * VAR_4 + VAR_16;", "dst[0] = VAR_6;", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_14[VAR_16] * VAR_4 + VAR_16;", "dst[0] = VAR_6;", "}", "} else {", "for (VAR_17 = 0; VAR_17 < VAR_10; VAR_17++) {", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4;", "for (VAR_16 = VAR_12; VAR_16 < VAR_13 && VAR_16 < VAR_15[VAR_17]; VAR_16++) {", "if (dst[VAR_16] != VAR_5) {", "VAR_15[VAR_17] = VAR_16;", "break;", "}", "}", "for (VAR_16 = VAR_13 - 1; VAR_16 >= VAR_12 && VAR_16 >= VAR_14[VAR_17]; VAR_16--) {", "if (dst[VAR_16] != VAR_5) {", "VAR_14[VAR_17] = VAR_16;", "break;", "}", "}", "}", "if (VAR_0->envelope == 3)\nenvelope_instant16(VAR_0, VAR_1, VAR_2, VAR_3);", "for (VAR_17 = 0; VAR_17 < VAR_10; VAR_17++) {", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_15[VAR_17];", "dst[0] = VAR_6;", "dst = (uint16_t *)VAR_1->data[VAR_3] + VAR_17 * VAR_4 + VAR_14[VAR_17];", "dst[0] = VAR_6;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ] ]
3,408
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) { int64_t crv = inv_table[0]; int64_t cbu = inv_table[1]; int64_t cgu = -inv_table[2]; int64_t cgv = -inv_table[3]; int64_t cy = 1<<16; int64_t oy = 0; memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4); memcpy(c->dstColorspaceTable, table, sizeof(int)*4); c->brightness= brightness; c->contrast = contrast; c->saturation= saturation; c->srcRange = srcRange; c->dstRange = dstRange; if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1; c->uOffset= 0x0400040004000400LL; c->vOffset= 0x0400040004000400LL; if (!srcRange) { cy= (cy*255) / 219; oy= 16<<16; } else { crv= (crv*224) / 255; cbu= (cbu*224) / 255; cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } cy = (cy *contrast )>>16; crv= (crv*contrast * saturation)>>32; cbu= (cbu*contrast * saturation)>>32; cgu= (cgu*contrast * saturation)>>32; cgv= (cgv*contrast * saturation)>>32; oy -= 256*brightness; c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL; c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL; c->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL; c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL; c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL; c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL; c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13); c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9); c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13); c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13); c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13); c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13); ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); //FIXME factorize #if ARCH_PPC && HAVE_ALTIVEC if (c->flags & SWS_CPU_CAPS_ALTIVEC) ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation); #endif return 0; }
false
FFmpeg
f684f3c58a77a20f18b80f888d69c2bacb53ca9b
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) { int64_t crv = inv_table[0]; int64_t cbu = inv_table[1]; int64_t cgu = -inv_table[2]; int64_t cgv = -inv_table[3]; int64_t cy = 1<<16; int64_t oy = 0; memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4); memcpy(c->dstColorspaceTable, table, sizeof(int)*4); c->brightness= brightness; c->contrast = contrast; c->saturation= saturation; c->srcRange = srcRange; c->dstRange = dstRange; if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1; c->uOffset= 0x0400040004000400LL; c->vOffset= 0x0400040004000400LL; if (!srcRange) { cy= (cy*255) / 219; oy= 16<<16; } else { crv= (crv*224) / 255; cbu= (cbu*224) / 255; cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } cy = (cy *contrast )>>16; crv= (crv*contrast * saturation)>>32; cbu= (cbu*contrast * saturation)>>32; cgu= (cgu*contrast * saturation)>>32; cgv= (cgv*contrast * saturation)>>32; oy -= 256*brightness; c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL; c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL; c->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL; c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL; c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL; c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL; c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13); c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9); c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13); c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13); c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13); c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13); ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); #if ARCH_PPC && HAVE_ALTIVEC if (c->flags & SWS_CPU_CAPS_ALTIVEC) ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation); #endif return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(SwsContext *VAR_0, const int VAR_1[4], int VAR_2, const int VAR_3[4], int VAR_4, int VAR_5, int VAR_6, int VAR_7) { int64_t crv = VAR_1[0]; int64_t cbu = VAR_1[1]; int64_t cgu = -VAR_1[2]; int64_t cgv = -VAR_1[3]; int64_t cy = 1<<16; int64_t oy = 0; memcpy(VAR_0->srcColorspaceTable, VAR_1, sizeof(int)*4); memcpy(VAR_0->dstColorspaceTable, VAR_3, sizeof(int)*4); VAR_0->VAR_5= VAR_5; VAR_0->VAR_6 = VAR_6; VAR_0->VAR_7= VAR_7; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_4 = VAR_4; if (isYUV(VAR_0->dstFormat) || isGray(VAR_0->dstFormat)) return -1; VAR_0->uOffset= 0x0400040004000400LL; VAR_0->vOffset= 0x0400040004000400LL; if (!VAR_2) { cy= (cy*255) / 219; oy= 16<<16; } else { crv= (crv*224) / 255; cbu= (cbu*224) / 255; cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } cy = (cy *VAR_6 )>>16; crv= (crv*VAR_6 * VAR_7)>>32; cbu= (cbu*VAR_6 * VAR_7)>>32; cgu= (cgu*VAR_6 * VAR_7)>>32; cgv= (cgv*VAR_6 * VAR_7)>>32; oy -= 256*VAR_5; VAR_0->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL; VAR_0->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL; VAR_0->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL; VAR_0->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL; VAR_0->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL; VAR_0->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL; VAR_0->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13); VAR_0->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9); VAR_0->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13); VAR_0->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13); VAR_0->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13); VAR_0->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13); ff_yuv2rgb_c_init_tables(VAR_0, VAR_1, VAR_2, VAR_5, VAR_6, VAR_7); #if ARCH_PPC && HAVE_ALTIVEC if (VAR_0->flags & SWS_CPU_CAPS_ALTIVEC) ff_yuv2rgb_init_tables_altivec(VAR_0, VAR_1, VAR_5, VAR_6, VAR_7); #endif return 0; }
[ "int FUNC_0(SwsContext *VAR_0, const int VAR_1[4], int VAR_2, const int VAR_3[4], int VAR_4, int VAR_5, int VAR_6, int VAR_7)\n{", "int64_t crv = VAR_1[0];", "int64_t cbu = VAR_1[1];", "int64_t cgu = -VAR_1[2];", "int64_t cgv = -VAR_1[3];", "int64_t cy = 1<<16;", "int64_t oy = 0;", "memcpy(VAR_0->srcColorspaceTable, VAR_1, sizeof(int)*4);", "memcpy(VAR_0->dstColorspaceTable, VAR_3, sizeof(int)*4);", "VAR_0->VAR_5= VAR_5;", "VAR_0->VAR_6 = VAR_6;", "VAR_0->VAR_7= VAR_7;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_4 = VAR_4;", "if (isYUV(VAR_0->dstFormat) || isGray(VAR_0->dstFormat)) return -1;", "VAR_0->uOffset= 0x0400040004000400LL;", "VAR_0->vOffset= 0x0400040004000400LL;", "if (!VAR_2) {", "cy= (cy*255) / 219;", "oy= 16<<16;", "} else {", "crv= (crv*224) / 255;", "cbu= (cbu*224) / 255;", "cgu= (cgu*224) / 255;", "cgv= (cgv*224) / 255;", "}", "cy = (cy *VAR_6 )>>16;", "crv= (crv*VAR_6 * VAR_7)>>32;", "cbu= (cbu*VAR_6 * VAR_7)>>32;", "cgu= (cgu*VAR_6 * VAR_7)>>32;", "cgv= (cgv*VAR_6 * VAR_7)>>32;", "oy -= 256*VAR_5;", "VAR_0->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL;", "VAR_0->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL;", "VAR_0->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL;", "VAR_0->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL;", "VAR_0->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL;", "VAR_0->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL;", "VAR_0->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13);", "VAR_0->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);", "VAR_0->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13);", "VAR_0->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13);", "VAR_0->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);", "VAR_0->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);", "ff_yuv2rgb_c_init_tables(VAR_0, VAR_1, VAR_2, VAR_5, VAR_6, VAR_7);", "#if ARCH_PPC && HAVE_ALTIVEC\nif (VAR_0->flags & SWS_CPU_CAPS_ALTIVEC)\nff_yuv2rgb_init_tables_altivec(VAR_0, VAR_1, VAR_5, VAR_6, VAR_7);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 115, 117, 119 ], [ 121, 123 ], [ 125 ] ]
3,409
static int decode_mb_info(IVI5DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx) { int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, mv_scale, blks_per_mb; IVIMbInfo *mb, *ref_mb; int row_offset = band->mb_size * band->pitch; mb = tile->mbs; ref_mb = tile->ref_mbs; offs = tile->ypos * band->pitch + tile->xpos; if (!ref_mb && ((band->qdelta_present && band->inherit_qdelta) || band->inherit_mv)) return AVERROR_INVALIDDATA; /* scale factor for motion vectors */ mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3); mv_x = mv_y = 0; for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; if (get_bits1(&ctx->gb)) { if (ctx->frame_type == FRAMETYPE_INTRA) { av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return -1; } mb->type = 1; /* empty macroblocks are always INTER */ mb->cbp = 0; /* all blocks are empty */ mb->q_delta = 0; if (!band->plane && !band->band_num && (ctx->frame_flags & 8)) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->mv_x = mb->mv_y = 0; /* no motion vector coded */ if (band->inherit_mv && ref_mb){ /* motion vector inheritance */ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } } else { if (band->inherit_mv && ref_mb) { mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */ } else if (ctx->frame_type == FRAMETYPE_INTRA) { mb->type = 0; /* mb_type is always INTRA for intra-frames */ } else { mb->type = get_bits1(&ctx->gb); } blks_per_mb = band->mb_size != band->blk_size ? 4 : 1; mb->cbp = get_bits(&ctx->gb, blks_per_mb); mb->q_delta = 0; if (band->qdelta_present) { if (band->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!band->plane && !band->band_num && (ctx->frame_flags & 8))) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } } if (!mb->type) { mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */ } else { if (band->inherit_mv && ref_mb){ /* motion vector inheritance */ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } else { /* decode motion vector deltas */ mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_y += IVI_TOSIGNED(mv_delta); mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_x += IVI_TOSIGNED(mv_delta); mb->mv_x = mv_x; mb->mv_y = mv_y; } } } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } align_get_bits(&ctx->gb); return 0; }
false
FFmpeg
c855ece101cd960ddd20eabd5f295e0b02b71dcc
static int decode_mb_info(IVI5DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx) { int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, mv_scale, blks_per_mb; IVIMbInfo *mb, *ref_mb; int row_offset = band->mb_size * band->pitch; mb = tile->mbs; ref_mb = tile->ref_mbs; offs = tile->ypos * band->pitch + tile->xpos; if (!ref_mb && ((band->qdelta_present && band->inherit_qdelta) || band->inherit_mv)) return AVERROR_INVALIDDATA; mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3); mv_x = mv_y = 0; for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; if (get_bits1(&ctx->gb)) { if (ctx->frame_type == FRAMETYPE_INTRA) { av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return -1; } mb->type = 1; mb->cbp = 0; mb->q_delta = 0; if (!band->plane && !band->band_num && (ctx->frame_flags & 8)) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->mv_x = mb->mv_y = 0; if (band->inherit_mv && ref_mb){ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } } else { if (band->inherit_mv && ref_mb) { mb->type = ref_mb->type; } else if (ctx->frame_type == FRAMETYPE_INTRA) { mb->type = 0; } else { mb->type = get_bits1(&ctx->gb); } blks_per_mb = band->mb_size != band->blk_size ? 4 : 1; mb->cbp = get_bits(&ctx->gb, blks_per_mb); mb->q_delta = 0; if (band->qdelta_present) { if (band->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!band->plane && !band->band_num && (ctx->frame_flags & 8))) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } } if (!mb->type) { mb->mv_x = mb->mv_y = 0; } else { if (band->inherit_mv && ref_mb){ if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } else { mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_y += IVI_TOSIGNED(mv_delta); mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_x += IVI_TOSIGNED(mv_delta); mb->mv_x = mv_x; mb->mv_y = mv_y; } } } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } align_get_bits(&ctx->gb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(IVI5DecContext *VAR_0, IVIBandDesc *VAR_1, IVITile *VAR_2, AVCodecContext *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; IVIMbInfo *mb, *ref_mb; int VAR_13 = VAR_1->mb_size * VAR_1->pitch; mb = VAR_2->mbs; ref_mb = VAR_2->ref_mbs; VAR_9 = VAR_2->ypos * VAR_1->pitch + VAR_2->xpos; if (!ref_mb && ((VAR_1->qdelta_present && VAR_1->inherit_qdelta) || VAR_1->inherit_mv)) return AVERROR_INVALIDDATA; VAR_11 = (VAR_0->planes[0].bands[0].mb_size >> 3) - (VAR_1->mb_size >> 3); VAR_6 = VAR_7 = 0; for (VAR_5 = VAR_2->ypos; VAR_5 < (VAR_2->ypos + VAR_2->height); VAR_5 += VAR_1->mb_size) { VAR_10 = VAR_9; for (VAR_4 = VAR_2->xpos; VAR_4 < (VAR_2->xpos + VAR_2->width); VAR_4 += VAR_1->mb_size) { mb->xpos = VAR_4; mb->ypos = VAR_5; mb->buf_offs = VAR_10; if (get_bits1(&VAR_0->gb)) { if (VAR_0->frame_type == FRAMETYPE_INTRA) { av_log(VAR_3, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return -1; } mb->type = 1; mb->cbp = 0; mb->q_delta = 0; if (!VAR_1->plane && !VAR_1->band_num && (VAR_0->frame_flags & 8)) { mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->VAR_6 = mb->VAR_7 = 0; if (VAR_1->inherit_mv && ref_mb){ if (VAR_11) { mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_11); mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_11); } else { mb->VAR_6 = ref_mb->VAR_6; mb->VAR_7 = ref_mb->VAR_7; } } } else { if (VAR_1->inherit_mv && ref_mb) { mb->type = ref_mb->type; } else if (VAR_0->frame_type == FRAMETYPE_INTRA) { mb->type = 0; } else { mb->type = get_bits1(&VAR_0->gb); } VAR_12 = VAR_1->mb_size != VAR_1->blk_size ? 4 : 1; mb->cbp = get_bits(&VAR_0->gb, VAR_12); mb->q_delta = 0; if (VAR_1->qdelta_present) { if (VAR_1->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!VAR_1->plane && !VAR_1->band_num && (VAR_0->frame_flags & 8))) { mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } } if (!mb->type) { mb->VAR_6 = mb->VAR_7 = 0; } else { if (VAR_1->inherit_mv && ref_mb){ if (VAR_11) { mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_11); mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_11); } else { mb->VAR_6 = ref_mb->VAR_6; mb->VAR_7 = ref_mb->VAR_7; } } else { VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); VAR_7 += IVI_TOSIGNED(VAR_8); VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table, IVI_VLC_BITS, 1); VAR_6 += IVI_TOSIGNED(VAR_8); mb->VAR_6 = VAR_6; mb->VAR_7 = VAR_7; } } } mb++; if (ref_mb) ref_mb++; VAR_10 += VAR_1->mb_size; } VAR_9 += VAR_13; } align_get_bits(&VAR_0->gb); return 0; }
[ "static int FUNC_0(IVI5DecContext *VAR_0, IVIBandDesc *VAR_1,\nIVITile *VAR_2, AVCodecContext *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10,\nVAR_11, VAR_12;", "IVIMbInfo *mb, *ref_mb;", "int VAR_13 = VAR_1->mb_size * VAR_1->pitch;", "mb = VAR_2->mbs;", "ref_mb = VAR_2->ref_mbs;", "VAR_9 = VAR_2->ypos * VAR_1->pitch + VAR_2->xpos;", "if (!ref_mb &&\n((VAR_1->qdelta_present && VAR_1->inherit_qdelta) || VAR_1->inherit_mv))\nreturn AVERROR_INVALIDDATA;", "VAR_11 = (VAR_0->planes[0].bands[0].mb_size >> 3) - (VAR_1->mb_size >> 3);", "VAR_6 = VAR_7 = 0;", "for (VAR_5 = VAR_2->ypos; VAR_5 < (VAR_2->ypos + VAR_2->height); VAR_5 += VAR_1->mb_size) {", "VAR_10 = VAR_9;", "for (VAR_4 = VAR_2->xpos; VAR_4 < (VAR_2->xpos + VAR_2->width); VAR_4 += VAR_1->mb_size) {", "mb->xpos = VAR_4;", "mb->ypos = VAR_5;", "mb->buf_offs = VAR_10;", "if (get_bits1(&VAR_0->gb)) {", "if (VAR_0->frame_type == FRAMETYPE_INTRA) {", "av_log(VAR_3, AV_LOG_ERROR, \"Empty macroblock in an INTRA picture!\\n\");", "return -1;", "}", "mb->type = 1;", "mb->cbp = 0;", "mb->q_delta = 0;", "if (!VAR_1->plane && !VAR_1->band_num && (VAR_0->frame_flags & 8)) {", "mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "mb->q_delta = IVI_TOSIGNED(mb->q_delta);", "}", "mb->VAR_6 = mb->VAR_7 = 0;", "if (VAR_1->inherit_mv && ref_mb){", "if (VAR_11) {", "mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_11);", "mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_11);", "} else {", "mb->VAR_6 = ref_mb->VAR_6;", "mb->VAR_7 = ref_mb->VAR_7;", "}", "}", "} else {", "if (VAR_1->inherit_mv && ref_mb) {", "mb->type = ref_mb->type;", "} else if (VAR_0->frame_type == FRAMETYPE_INTRA) {", "mb->type = 0;", "} else {", "mb->type = get_bits1(&VAR_0->gb);", "}", "VAR_12 = VAR_1->mb_size != VAR_1->blk_size ? 4 : 1;", "mb->cbp = get_bits(&VAR_0->gb, VAR_12);", "mb->q_delta = 0;", "if (VAR_1->qdelta_present) {", "if (VAR_1->inherit_qdelta) {", "if (ref_mb) mb->q_delta = ref_mb->q_delta;", "} else if (mb->cbp || (!VAR_1->plane && !VAR_1->band_num &&", "(VAR_0->frame_flags & 8))) {", "mb->q_delta = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "mb->q_delta = IVI_TOSIGNED(mb->q_delta);", "}", "}", "if (!mb->type) {", "mb->VAR_6 = mb->VAR_7 = 0;", "} else {", "if (VAR_1->inherit_mv && ref_mb){", "if (VAR_11) {", "mb->VAR_6 = ivi_scale_mv(ref_mb->VAR_6, VAR_11);", "mb->VAR_7 = ivi_scale_mv(ref_mb->VAR_7, VAR_11);", "} else {", "mb->VAR_6 = ref_mb->VAR_6;", "mb->VAR_7 = ref_mb->VAR_7;", "}", "} else {", "VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "VAR_7 += IVI_TOSIGNED(VAR_8);", "VAR_8 = get_vlc2(&VAR_0->gb, VAR_0->mb_vlc.tab->table,\nIVI_VLC_BITS, 1);", "VAR_6 += IVI_TOSIGNED(VAR_8);", "mb->VAR_6 = VAR_6;", "mb->VAR_7 = VAR_7;", "}", "}", "}", "mb++;", "if (ref_mb)\nref_mb++;", "VAR_10 += VAR_1->mb_size;", "}", "VAR_9 += VAR_13;", "}", "align_get_bits(&VAR_0->gb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 227 ], [ 231 ], [ 233 ] ]
3,410
void ff_imdct_calc(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp) { int k, n8, n4, n2, n, j; const uint16_t *revtab = s->fft.revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)tmp; n = 1 << s->nbits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; /* pre rotation */ in1 = input; in2 = input + n2 - 1; for(k = 0; k < n4; k++) { j=revtab[k]; CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]); in1 += 2; in2 -= 2; } ff_fft_calc(&s->fft, z); /* post rotation + reordering */ /* XXX: optimize */ for(k = 0; k < n4; k++) { CMUL(z[k].re, z[k].im, z[k].re, z[k].im, tcos[k], tsin[k]); } for(k = 0; k < n8; k++) { output[2*k] = -z[n8 + k].im; output[n2-1-2*k] = z[n8 + k].im; output[2*k+1] = z[n8-1-k].re; output[n2-1-2*k-1] = -z[n8-1-k].re; output[n2 + 2*k]=-z[k+n8].re; output[n-1- 2*k]=-z[k+n8].re; output[n2 + 2*k+1]=z[n8-k-1].im; output[n-2 - 2 * k] = z[n8-k-1].im; } }
true
FFmpeg
b9fa32082c71013e90eab9e9997967d2939cf4a6
void ff_imdct_calc(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp) { int k, n8, n4, n2, n, j; const uint16_t *revtab = s->fft.revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)tmp; n = 1 << s->nbits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; in1 = input; in2 = input + n2 - 1; for(k = 0; k < n4; k++) { j=revtab[k]; CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]); in1 += 2; in2 -= 2; } ff_fft_calc(&s->fft, z); for(k = 0; k < n4; k++) { CMUL(z[k].re, z[k].im, z[k].re, z[k].im, tcos[k], tsin[k]); } for(k = 0; k < n8; k++) { output[2*k] = -z[n8 + k].im; output[n2-1-2*k] = z[n8 + k].im; output[2*k+1] = z[n8-1-k].re; output[n2-1-2*k-1] = -z[n8-1-k].re; output[n2 + 2*k]=-z[k+n8].re; output[n-1- 2*k]=-z[k+n8].re; output[n2 + 2*k+1]=z[n8-k-1].im; output[n-2 - 2 * k] = z[n8-k-1].im; } }
{ "code": [ " n8 = n >> 3;", " n8 = n >> 3;", "void ff_imdct_calc(MDCTContext *s, FFTSample *output,", " const FFTSample *input, FFTSample *tmp)", " int k, n8, n4, n2, n, j;", " n8 = n >> 3;" ], "line_no": [ 27, 27, 1, 3, 7, 27 ] }
void FUNC_0(MDCTContext *VAR_0, FFTSample *VAR_1, const FFTSample *VAR_2, FFTSample *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; const uint16_t *VAR_10 = VAR_0->fft.VAR_10; const FFTSample *VAR_11 = VAR_0->VAR_11; const FFTSample *VAR_12 = VAR_0->VAR_12; const FFTSample *VAR_13, *in2; FFTComplex *z = (FFTComplex *)VAR_3; VAR_8 = 1 << VAR_0->nbits; VAR_7 = VAR_8 >> 1; VAR_6 = VAR_8 >> 2; VAR_5 = VAR_8 >> 3; VAR_13 = VAR_2; in2 = VAR_2 + VAR_7 - 1; for(VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) { VAR_9=VAR_10[VAR_4]; CMUL(z[VAR_9].re, z[VAR_9].im, *in2, *VAR_13, VAR_11[VAR_4], VAR_12[VAR_4]); VAR_13 += 2; in2 -= 2; } ff_fft_calc(&VAR_0->fft, z); for(VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) { CMUL(z[VAR_4].re, z[VAR_4].im, z[VAR_4].re, z[VAR_4].im, VAR_11[VAR_4], VAR_12[VAR_4]); } for(VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { VAR_1[2*VAR_4] = -z[VAR_5 + VAR_4].im; VAR_1[VAR_7-1-2*VAR_4] = z[VAR_5 + VAR_4].im; VAR_1[2*VAR_4+1] = z[VAR_5-1-VAR_4].re; VAR_1[VAR_7-1-2*VAR_4-1] = -z[VAR_5-1-VAR_4].re; VAR_1[VAR_7 + 2*VAR_4]=-z[VAR_4+VAR_5].re; VAR_1[VAR_8-1- 2*VAR_4]=-z[VAR_4+VAR_5].re; VAR_1[VAR_7 + 2*VAR_4+1]=z[VAR_5-VAR_4-1].im; VAR_1[VAR_8-2 - 2 * VAR_4] = z[VAR_5-VAR_4-1].im; } }
[ "void FUNC_0(MDCTContext *VAR_0, FFTSample *VAR_1,\nconst FFTSample *VAR_2, FFTSample *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "const uint16_t *VAR_10 = VAR_0->fft.VAR_10;", "const FFTSample *VAR_11 = VAR_0->VAR_11;", "const FFTSample *VAR_12 = VAR_0->VAR_12;", "const FFTSample *VAR_13, *in2;", "FFTComplex *z = (FFTComplex *)VAR_3;", "VAR_8 = 1 << VAR_0->nbits;", "VAR_7 = VAR_8 >> 1;", "VAR_6 = VAR_8 >> 2;", "VAR_5 = VAR_8 >> 3;", "VAR_13 = VAR_2;", "in2 = VAR_2 + VAR_7 - 1;", "for(VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) {", "VAR_9=VAR_10[VAR_4];", "CMUL(z[VAR_9].re, z[VAR_9].im, *in2, *VAR_13, VAR_11[VAR_4], VAR_12[VAR_4]);", "VAR_13 += 2;", "in2 -= 2;", "}", "ff_fft_calc(&VAR_0->fft, z);", "for(VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) {", "CMUL(z[VAR_4].re, z[VAR_4].im, z[VAR_4].re, z[VAR_4].im, VAR_11[VAR_4], VAR_12[VAR_4]);", "}", "for(VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {", "VAR_1[2*VAR_4] = -z[VAR_5 + VAR_4].im;", "VAR_1[VAR_7-1-2*VAR_4] = z[VAR_5 + VAR_4].im;", "VAR_1[2*VAR_4+1] = z[VAR_5-1-VAR_4].re;", "VAR_1[VAR_7-1-2*VAR_4-1] = -z[VAR_5-1-VAR_4].re;", "VAR_1[VAR_7 + 2*VAR_4]=-z[VAR_4+VAR_5].re;", "VAR_1[VAR_8-1- 2*VAR_4]=-z[VAR_4+VAR_5].re;", "VAR_1[VAR_7 + 2*VAR_4+1]=z[VAR_5-VAR_4-1].im;", "VAR_1[VAR_8-2 - 2 * VAR_4] = z[VAR_5-VAR_4-1].im;", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
3,411
ISADevice *isa_create(const char *name) { DeviceState *dev; if (!isabus) { fprintf(stderr, "Tried to create isa device %s with no isa bus present.\n", name); return NULL; } dev = qdev_create(&isabus->qbus, name); return DO_UPCAST(ISADevice, qdev, dev); }
true
qemu
3f66aa9c07d6392757f9d7b83849c7f791981725
ISADevice *isa_create(const char *name) { DeviceState *dev; if (!isabus) { fprintf(stderr, "Tried to create isa device %s with no isa bus present.\n", name); return NULL; } dev = qdev_create(&isabus->qbus, name); return DO_UPCAST(ISADevice, qdev, dev); }
{ "code": [ " fprintf(stderr, \"Tried to create isa device %s with no isa bus present.\\n\", name);", " return NULL;", " return NULL;" ], "line_no": [ 11, 13, 13 ] }
ISADevice *FUNC_0(const char *name) { DeviceState *dev; if (!isabus) { fprintf(stderr, "Tried to create isa device %s with no isa bus present.\n", name); return NULL; } dev = qdev_create(&isabus->qbus, name); return DO_UPCAST(ISADevice, qdev, dev); }
[ "ISADevice *FUNC_0(const char *name)\n{", "DeviceState *dev;", "if (!isabus) {", "fprintf(stderr, \"Tried to create isa device %s with no isa bus present.\\n\", name);", "return NULL;", "}", "dev = qdev_create(&isabus->qbus, name);", "return DO_UPCAST(ISADevice, qdev, dev);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
3,412
static int applehttp_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AppleHTTPContext *c = s->priv_data; int i, j, ret; if ((flags & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished) return AVERROR(ENOSYS); timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ? s->streams[stream_index]->time_base.den : AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); ret = AVERROR(EIO); for (i = 0; i < c->n_variants; i++) { /* Reset reading */ struct variant *var = c->variants[i]; int64_t pos = 0; if (var->input) { ffurl_close(var->input); var->input = NULL; } av_free_packet(&var->pkt); reset_packet(&var->pkt); var->pb.eof_reached = 0; /* Locate the segment that contains the target timestamp */ for (j = 0; j < var->n_segments; j++) { if (timestamp >= pos && timestamp < pos + var->segments[j]->duration) { var->cur_seq_no = var->start_seq_no + j; ret = 0; break; } pos += var->segments[j]->duration; } } return ret; }
true
FFmpeg
6f20921deec135a68f78cb327472ea6cf28644a5
static int applehttp_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AppleHTTPContext *c = s->priv_data; int i, j, ret; if ((flags & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished) return AVERROR(ENOSYS); timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ? s->streams[stream_index]->time_base.den : AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); ret = AVERROR(EIO); for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; int64_t pos = 0; if (var->input) { ffurl_close(var->input); var->input = NULL; } av_free_packet(&var->pkt); reset_packet(&var->pkt); var->pb.eof_reached = 0; for (j = 0; j < var->n_segments; j++) { if (timestamp >= pos && timestamp < pos + var->segments[j]->duration) { var->cur_seq_no = var->start_seq_no + j; ret = 0; break; } pos += var->segments[j]->duration; } } return ret; }
{ "code": [ " int64_t pos = 0;", " if (var->input) {" ], "line_no": [ 35, 37 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { AppleHTTPContext *c = VAR_0->priv_data; int VAR_4, VAR_5, VAR_6; if ((VAR_3 & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished) return AVERROR(ENOSYS); VAR_2 = av_rescale_rnd(VAR_2, 1, VAR_1 >= 0 ? VAR_0->streams[VAR_1]->time_base.den : AV_TIME_BASE, VAR_3 & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); VAR_6 = AVERROR(EIO); for (VAR_4 = 0; VAR_4 < c->n_variants; VAR_4++) { struct variant *var = c->variants[VAR_4]; int64_t pos = 0; if (var->input) { ffurl_close(var->input); var->input = NULL; } av_free_packet(&var->pkt); reset_packet(&var->pkt); var->pb.eof_reached = 0; for (VAR_5 = 0; VAR_5 < var->n_segments; VAR_5++) { if (VAR_2 >= pos && VAR_2 < pos + var->segments[VAR_5]->duration) { var->cur_seq_no = var->start_seq_no + VAR_5; VAR_6 = 0; break; } pos += var->segments[VAR_5]->duration; } } return VAR_6; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint64_t VAR_2, int VAR_3)\n{", "AppleHTTPContext *c = VAR_0->priv_data;", "int VAR_4, VAR_5, VAR_6;", "if ((VAR_3 & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished)\nreturn AVERROR(ENOSYS);", "VAR_2 = av_rescale_rnd(VAR_2, 1, VAR_1 >= 0 ?\nVAR_0->streams[VAR_1]->time_base.den :\nAV_TIME_BASE, VAR_3 & AVSEEK_FLAG_BACKWARD ?\nAV_ROUND_DOWN : AV_ROUND_UP);", "VAR_6 = AVERROR(EIO);", "for (VAR_4 = 0; VAR_4 < c->n_variants; VAR_4++) {", "struct variant *var = c->variants[VAR_4];", "int64_t pos = 0;", "if (var->input) {", "ffurl_close(var->input);", "var->input = NULL;", "}", "av_free_packet(&var->pkt);", "reset_packet(&var->pkt);", "var->pb.eof_reached = 0;", "for (VAR_5 = 0; VAR_5 < var->n_segments; VAR_5++) {", "if (VAR_2 >= pos &&\nVAR_2 < pos + var->segments[VAR_5]->duration) {", "var->cur_seq_no = var->start_seq_no + VAR_5;", "VAR_6 = 0;", "break;", "}", "pos += var->segments[VAR_5]->duration;", "}", "}", "return VAR_6;", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21, 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
3,413
int coroutine_fn qemu_co_recvv(int sockfd, struct iovec *iov, int len, int iov_offset) { int total = 0; int ret; while (len) { ret = qemu_recvv(sockfd, iov, len, iov_offset + total); if (ret < 0) { if (errno == EAGAIN) { qemu_coroutine_yield(); continue; } if (total == 0) { total = -1; } break; } if (ret == 0) { break; } total += ret, len -= ret; } return total; }
true
qemu
3e80bf9351f8fec9085c46df6da075efd5e71003
int coroutine_fn qemu_co_recvv(int sockfd, struct iovec *iov, int len, int iov_offset) { int total = 0; int ret; while (len) { ret = qemu_recvv(sockfd, iov, len, iov_offset + total); if (ret < 0) { if (errno == EAGAIN) { qemu_coroutine_yield(); continue; } if (total == 0) { total = -1; } break; } if (ret == 0) { break; } total += ret, len -= ret; } return total; }
{ "code": [ " ret = qemu_recvv(sockfd, iov, len, iov_offset + total);" ], "line_no": [ 13 ] }
int VAR_0 qemu_co_recvv(int sockfd, struct iovec *iov, int len, int iov_offset) { int total = 0; int ret; while (len) { ret = qemu_recvv(sockfd, iov, len, iov_offset + total); if (ret < 0) { if (errno == EAGAIN) { qemu_coroutine_yield(); continue; } if (total == 0) { total = -1; } break; } if (ret == 0) { break; } total += ret, len -= ret; } return total; }
[ "int VAR_0 qemu_co_recvv(int sockfd, struct iovec *iov,\nint len, int iov_offset)\n{", "int total = 0;", "int ret;", "while (len) {", "ret = qemu_recvv(sockfd, iov, len, iov_offset + total);", "if (ret < 0) {", "if (errno == EAGAIN) {", "qemu_coroutine_yield();", "continue;", "}", "if (total == 0) {", "total = -1;", "}", "break;", "}", "if (ret == 0) {", "break;", "}", "total += ret, len -= ret;", "}", "return total;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
3,414
static void vc1_decode_p_blocks(VC1Context *v) { MpegEncContext *s = &v->s; int apply_loop_filter; /* select codingmode used for VLC tables selection */ switch (v->c_ac_table_index) { case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: v->codingset = CS_HIGH_MOT_INTRA; break; case 2: v->codingset = CS_MID_RATE_INTRA; break; } switch (v->c_ac_table_index) { case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: v->codingset2 = CS_HIGH_MOT_INTER; break; case 2: v->codingset2 = CS_MID_RATE_INTER; break; } apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); s->first_slice_line = 1; memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride); for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); if (v->fcm == ILACE_FIELD) vc1_decode_p_mb_intfi(v); else if (v->fcm == ILACE_FRAME) vc1_decode_p_mb_intfr(v); else vc1_decode_p_mb(v); if (s->mb_y != s->start_mb_y && apply_loop_filter && v->fcm == PROGRESSIVE) vc1_apply_p_loop_filter(v); if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { // TODO: may need modification to handle slice coding ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); return; } } memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0]) * s->mb_stride); memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0]) * s->mb_stride); memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0]) * s->mb_stride); if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16); s->first_slice_line = 0; } if (apply_loop_filter) { s->mb_x = 0; ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_apply_p_loop_filter(v); } } if (s->end_mb_y >= s->start_mb_y) ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, (s->end_mb_y << v->field_mode) - 1, ER_MB_END); }
true
FFmpeg
22ce78a95efb5d67dcd925285ad8c836b67d2c19
static void vc1_decode_p_blocks(VC1Context *v) { MpegEncContext *s = &v->s; int apply_loop_filter; switch (v->c_ac_table_index) { case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: v->codingset = CS_HIGH_MOT_INTRA; break; case 2: v->codingset = CS_MID_RATE_INTRA; break; } switch (v->c_ac_table_index) { case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: v->codingset2 = CS_HIGH_MOT_INTER; break; case 2: v->codingset2 = CS_MID_RATE_INTER; break; } apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); s->first_slice_line = 1; memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride); for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); if (v->fcm == ILACE_FIELD) vc1_decode_p_mb_intfi(v); else if (v->fcm == ILACE_FRAME) vc1_decode_p_mb_intfr(v); else vc1_decode_p_mb(v); if (s->mb_y != s->start_mb_y && apply_loop_filter && v->fcm == PROGRESSIVE) vc1_apply_p_loop_filter(v); if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); return; } } memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0]) * s->mb_stride); memmove(v->ttblk_base, v->ttblk, sizeof(v->ttblk_base[0]) * s->mb_stride); memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0]) * s->mb_stride); memmove(v->luma_mv_base, v->luma_mv, sizeof(v->luma_mv_base[0]) * s->mb_stride); if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16); s->first_slice_line = 0; } if (apply_loop_filter) { s->mb_x = 0; ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_apply_p_loop_filter(v); } } if (s->end_mb_y >= s->start_mb_y) ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, (s->end_mb_y << v->field_mode) - 1, ER_MB_END); }
{ "code": [ " if (apply_loop_filter) {" ], "line_no": [ 123 ] }
static void FUNC_0(VC1Context *VAR_0) { MpegEncContext *s = &VAR_0->s; int VAR_1; switch (VAR_0->c_ac_table_index) { case 0: VAR_0->codingset = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: VAR_0->codingset = CS_HIGH_MOT_INTRA; break; case 2: VAR_0->codingset = CS_MID_RATE_INTRA; break; } switch (VAR_0->c_ac_table_index) { case 0: VAR_0->codingset2 = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: VAR_0->codingset2 = CS_HIGH_MOT_INTER; break; case 2: VAR_0->codingset2 = CS_MID_RATE_INTER; break; } VAR_1 = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY); s->first_slice_line = 1; memset(VAR_0->cbp_base, 0, sizeof(VAR_0->cbp_base[0])*2*s->mb_stride); for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); if (VAR_0->fcm == ILACE_FIELD) vc1_decode_p_mb_intfi(VAR_0); else if (VAR_0->fcm == ILACE_FRAME) vc1_decode_p_mb_intfr(VAR_0); else vc1_decode_p_mb(VAR_0); if (s->mb_y != s->start_mb_y && VAR_1 && VAR_0->fcm == PROGRESSIVE) vc1_apply_p_loop_filter(VAR_0); if (get_bits_count(&s->gb) > VAR_0->bits || get_bits_count(&s->gb) < 0) { ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), VAR_0->bits, s->mb_x, s->mb_y); return; } } memmove(VAR_0->cbp_base, VAR_0->cbp, sizeof(VAR_0->cbp_base[0]) * s->mb_stride); memmove(VAR_0->ttblk_base, VAR_0->ttblk, sizeof(VAR_0->ttblk_base[0]) * s->mb_stride); memmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride); memmove(VAR_0->luma_mv_base, VAR_0->luma_mv, sizeof(VAR_0->luma_mv_base[0]) * s->mb_stride); if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16); s->first_slice_line = 0; } if (VAR_1) { s->mb_x = 0; ff_init_block_index(s); for (; s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_apply_p_loop_filter(VAR_0); } } if (s->end_mb_y >= s->start_mb_y) ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); ff_er_add_slice(s, 0, s->start_mb_y << VAR_0->field_mode, s->mb_width - 1, (s->end_mb_y << VAR_0->field_mode) - 1, ER_MB_END); }
[ "static void FUNC_0(VC1Context *VAR_0)\n{", "MpegEncContext *s = &VAR_0->s;", "int VAR_1;", "switch (VAR_0->c_ac_table_index) {", "case 0:\nVAR_0->codingset = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;", "break;", "case 1:\nVAR_0->codingset = CS_HIGH_MOT_INTRA;", "break;", "case 2:\nVAR_0->codingset = CS_MID_RATE_INTRA;", "break;", "}", "switch (VAR_0->c_ac_table_index) {", "case 0:\nVAR_0->codingset2 = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;", "break;", "case 1:\nVAR_0->codingset2 = CS_HIGH_MOT_INTER;", "break;", "case 2:\nVAR_0->codingset2 = CS_MID_RATE_INTER;", "break;", "}", "VAR_1 = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);", "s->first_slice_line = 1;", "memset(VAR_0->cbp_base, 0, sizeof(VAR_0->cbp_base[0])*2*s->mb_stride);", "for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {", "s->mb_x = 0;", "ff_init_block_index(s);", "for (; s->mb_x < s->mb_width; s->mb_x++) {", "ff_update_block_index(s);", "if (VAR_0->fcm == ILACE_FIELD)\nvc1_decode_p_mb_intfi(VAR_0);", "else if (VAR_0->fcm == ILACE_FRAME)\nvc1_decode_p_mb_intfr(VAR_0);", "else vc1_decode_p_mb(VAR_0);", "if (s->mb_y != s->start_mb_y && VAR_1 && VAR_0->fcm == PROGRESSIVE)\nvc1_apply_p_loop_filter(VAR_0);", "if (get_bits_count(&s->gb) > VAR_0->bits || get_bits_count(&s->gb) < 0) {", "ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR);", "av_log(s->avctx, AV_LOG_ERROR, \"Bits overconsumption: %i > %i at %ix%i\\n\",\nget_bits_count(&s->gb), VAR_0->bits, s->mb_x, s->mb_y);", "return;", "}", "}", "memmove(VAR_0->cbp_base, VAR_0->cbp, sizeof(VAR_0->cbp_base[0]) * s->mb_stride);", "memmove(VAR_0->ttblk_base, VAR_0->ttblk, sizeof(VAR_0->ttblk_base[0]) * s->mb_stride);", "memmove(VAR_0->is_intra_base, VAR_0->is_intra, sizeof(VAR_0->is_intra_base[0]) * s->mb_stride);", "memmove(VAR_0->luma_mv_base, VAR_0->luma_mv, sizeof(VAR_0->luma_mv_base[0]) * s->mb_stride);", "if (s->mb_y != s->start_mb_y) ff_draw_horiz_band(s, (s->mb_y - 1) * 16, 16);", "s->first_slice_line = 0;", "}", "if (VAR_1) {", "s->mb_x = 0;", "ff_init_block_index(s);", "for (; s->mb_x < s->mb_width; s->mb_x++) {", "ff_update_block_index(s);", "vc1_apply_p_loop_filter(VAR_0);", "}", "}", "if (s->end_mb_y >= s->start_mb_y)\nff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);", "ff_er_add_slice(s, 0, s->start_mb_y << VAR_0->field_mode, s->mb_width - 1,\n(s->end_mb_y << VAR_0->field_mode) - 1, ER_MB_END);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143, 145 ], [ 147 ] ]
3,415
static int get_metadata(AVFormatContext *s, const char *const tag, const unsigned data_size) { uint8_t *buf = ((data_size + 1) == 0) ? NULL : av_malloc(data_size + 1); if (!buf) return AVERROR(ENOMEM); if (avio_read(s->pb, buf, data_size) < 0) { av_free(buf); return AVERROR(EIO); } buf[data_size] = 0; av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); return 0; }
true
FFmpeg
8e90c7285d1cbf62a9c9a5f9e6efda998dc0d454
static int get_metadata(AVFormatContext *s, const char *const tag, const unsigned data_size) { uint8_t *buf = ((data_size + 1) == 0) ? NULL : av_malloc(data_size + 1); if (!buf) return AVERROR(ENOMEM); if (avio_read(s->pb, buf, data_size) < 0) { av_free(buf); return AVERROR(EIO); } buf[data_size] = 0; av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); return 0; }
{ "code": [ " if (avio_read(s->pb, buf, data_size) < 0) {" ], "line_no": [ 19 ] }
static int FUNC_0(AVFormatContext *VAR_0, const char *const VAR_1, const unsigned VAR_2) { uint8_t *buf = ((VAR_2 + 1) == 0) ? NULL : av_malloc(VAR_2 + 1); if (!buf) return AVERROR(ENOMEM); if (avio_read(VAR_0->pb, buf, VAR_2) < 0) { av_free(buf); return AVERROR(EIO); } buf[VAR_2] = 0; av_dict_set(&VAR_0->metadata, VAR_1, buf, AV_DICT_DONT_STRDUP_VAL); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nconst char *const VAR_1,\nconst unsigned VAR_2)\n{", "uint8_t *buf = ((VAR_2 + 1) == 0) ? NULL : av_malloc(VAR_2 + 1);", "if (!buf)\nreturn AVERROR(ENOMEM);", "if (avio_read(VAR_0->pb, buf, VAR_2) < 0) {", "av_free(buf);", "return AVERROR(EIO);", "}", "buf[VAR_2] = 0;", "av_dict_set(&VAR_0->metadata, VAR_1, buf, AV_DICT_DONT_STRDUP_VAL);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
3,417
static int set_sps(HEVCContext *s, const HEVCSPS *sps) { int ret; int num = 0, den = 0; pic_arrays_free(s); ret = pic_arrays_init(s, sps); if (ret < 0) goto fail; s->avctx->coded_width = sps->width; s->avctx->coded_height = sps->height; s->avctx->width = sps->output_width; s->avctx->height = sps->output_height; s->avctx->pix_fmt = sps->pix_fmt; s->avctx->sample_aspect_ratio = sps->vui.sar; s->avctx->has_b_frames = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics; if (sps->vui.video_signal_type_present_flag) s->avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; else s->avctx->color_range = AVCOL_RANGE_MPEG; if (sps->vui.colour_description_present_flag) { s->avctx->color_primaries = sps->vui.colour_primaries; s->avctx->color_trc = sps->vui.transfer_characteristic; s->avctx->colorspace = sps->vui.matrix_coeffs; } else { s->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; s->avctx->color_trc = AVCOL_TRC_UNSPECIFIED; s->avctx->colorspace = AVCOL_SPC_UNSPECIFIED; } ff_hevc_pred_init(&s->hpc, sps->bit_depth); ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth); ff_videodsp_init (&s->vdsp, sps->bit_depth); if (sps->sao_enabled) { av_frame_unref(s->tmp_frame); ret = ff_get_buffer(s->avctx, s->tmp_frame, AV_GET_BUFFER_FLAG_REF); if (ret < 0) goto fail; s->frame = s->tmp_frame; } s->sps = sps; s->vps = (HEVCVPS*) s->vps_list[s->sps->vps_id]->data; if (s->vps->vps_timing_info_present_flag) { num = s->vps->vps_num_units_in_tick; den = s->vps->vps_time_scale; } else if (sps->vui.vui_timing_info_present_flag) { num = sps->vui.vui_num_units_in_tick; den = sps->vui.vui_time_scale; } if (num != 0 && den != 0) av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den, num, den, 1 << 30); return 0; fail: pic_arrays_free(s); s->sps = NULL; return ret; }
false
FFmpeg
ed06e5d92b4c67b49068d538461fbbe0a53a8c5e
static int set_sps(HEVCContext *s, const HEVCSPS *sps) { int ret; int num = 0, den = 0; pic_arrays_free(s); ret = pic_arrays_init(s, sps); if (ret < 0) goto fail; s->avctx->coded_width = sps->width; s->avctx->coded_height = sps->height; s->avctx->width = sps->output_width; s->avctx->height = sps->output_height; s->avctx->pix_fmt = sps->pix_fmt; s->avctx->sample_aspect_ratio = sps->vui.sar; s->avctx->has_b_frames = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics; if (sps->vui.video_signal_type_present_flag) s->avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; else s->avctx->color_range = AVCOL_RANGE_MPEG; if (sps->vui.colour_description_present_flag) { s->avctx->color_primaries = sps->vui.colour_primaries; s->avctx->color_trc = sps->vui.transfer_characteristic; s->avctx->colorspace = sps->vui.matrix_coeffs; } else { s->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; s->avctx->color_trc = AVCOL_TRC_UNSPECIFIED; s->avctx->colorspace = AVCOL_SPC_UNSPECIFIED; } ff_hevc_pred_init(&s->hpc, sps->bit_depth); ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth); ff_videodsp_init (&s->vdsp, sps->bit_depth); if (sps->sao_enabled) { av_frame_unref(s->tmp_frame); ret = ff_get_buffer(s->avctx, s->tmp_frame, AV_GET_BUFFER_FLAG_REF); if (ret < 0) goto fail; s->frame = s->tmp_frame; } s->sps = sps; s->vps = (HEVCVPS*) s->vps_list[s->sps->vps_id]->data; if (s->vps->vps_timing_info_present_flag) { num = s->vps->vps_num_units_in_tick; den = s->vps->vps_time_scale; } else if (sps->vui.vui_timing_info_present_flag) { num = sps->vui.vui_num_units_in_tick; den = sps->vui.vui_time_scale; } if (num != 0 && den != 0) av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den, num, den, 1 << 30); return 0; fail: pic_arrays_free(s); s->sps = NULL; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(HEVCContext *VAR_0, const HEVCSPS *VAR_1) { int VAR_2; int VAR_3 = 0, VAR_4 = 0; pic_arrays_free(VAR_0); VAR_2 = pic_arrays_init(VAR_0, VAR_1); if (VAR_2 < 0) goto fail; VAR_0->avctx->coded_width = VAR_1->width; VAR_0->avctx->coded_height = VAR_1->height; VAR_0->avctx->width = VAR_1->output_width; VAR_0->avctx->height = VAR_1->output_height; VAR_0->avctx->pix_fmt = VAR_1->pix_fmt; VAR_0->avctx->sample_aspect_ratio = VAR_1->vui.sar; VAR_0->avctx->has_b_frames = VAR_1->temporal_layer[VAR_1->max_sub_layers - 1].num_reorder_pics; if (VAR_1->vui.video_signal_type_present_flag) VAR_0->avctx->color_range = VAR_1->vui.video_full_range_flag ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; else VAR_0->avctx->color_range = AVCOL_RANGE_MPEG; if (VAR_1->vui.colour_description_present_flag) { VAR_0->avctx->color_primaries = VAR_1->vui.colour_primaries; VAR_0->avctx->color_trc = VAR_1->vui.transfer_characteristic; VAR_0->avctx->colorspace = VAR_1->vui.matrix_coeffs; } else { VAR_0->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; VAR_0->avctx->color_trc = AVCOL_TRC_UNSPECIFIED; VAR_0->avctx->colorspace = AVCOL_SPC_UNSPECIFIED; } ff_hevc_pred_init(&VAR_0->hpc, VAR_1->bit_depth); ff_hevc_dsp_init (&VAR_0->hevcdsp, VAR_1->bit_depth); ff_videodsp_init (&VAR_0->vdsp, VAR_1->bit_depth); if (VAR_1->sao_enabled) { av_frame_unref(VAR_0->tmp_frame); VAR_2 = ff_get_buffer(VAR_0->avctx, VAR_0->tmp_frame, AV_GET_BUFFER_FLAG_REF); if (VAR_2 < 0) goto fail; VAR_0->frame = VAR_0->tmp_frame; } VAR_0->VAR_1 = VAR_1; VAR_0->vps = (HEVCVPS*) VAR_0->vps_list[VAR_0->VAR_1->vps_id]->data; if (VAR_0->vps->vps_timing_info_present_flag) { VAR_3 = VAR_0->vps->vps_num_units_in_tick; VAR_4 = VAR_0->vps->vps_time_scale; } else if (VAR_1->vui.vui_timing_info_present_flag) { VAR_3 = VAR_1->vui.vui_num_units_in_tick; VAR_4 = VAR_1->vui.vui_time_scale; } if (VAR_3 != 0 && VAR_4 != 0) av_reduce(&VAR_0->avctx->time_base.VAR_3, &VAR_0->avctx->time_base.VAR_4, VAR_3, VAR_4, 1 << 30); return 0; fail: pic_arrays_free(VAR_0); VAR_0->VAR_1 = NULL; return VAR_2; }
[ "static int FUNC_0(HEVCContext *VAR_0, const HEVCSPS *VAR_1)\n{", "int VAR_2;", "int VAR_3 = 0, VAR_4 = 0;", "pic_arrays_free(VAR_0);", "VAR_2 = pic_arrays_init(VAR_0, VAR_1);", "if (VAR_2 < 0)\ngoto fail;", "VAR_0->avctx->coded_width = VAR_1->width;", "VAR_0->avctx->coded_height = VAR_1->height;", "VAR_0->avctx->width = VAR_1->output_width;", "VAR_0->avctx->height = VAR_1->output_height;", "VAR_0->avctx->pix_fmt = VAR_1->pix_fmt;", "VAR_0->avctx->sample_aspect_ratio = VAR_1->vui.sar;", "VAR_0->avctx->has_b_frames = VAR_1->temporal_layer[VAR_1->max_sub_layers - 1].num_reorder_pics;", "if (VAR_1->vui.video_signal_type_present_flag)\nVAR_0->avctx->color_range = VAR_1->vui.video_full_range_flag ? AVCOL_RANGE_JPEG\n: AVCOL_RANGE_MPEG;", "else\nVAR_0->avctx->color_range = AVCOL_RANGE_MPEG;", "if (VAR_1->vui.colour_description_present_flag) {", "VAR_0->avctx->color_primaries = VAR_1->vui.colour_primaries;", "VAR_0->avctx->color_trc = VAR_1->vui.transfer_characteristic;", "VAR_0->avctx->colorspace = VAR_1->vui.matrix_coeffs;", "} else {", "VAR_0->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED;", "VAR_0->avctx->color_trc = AVCOL_TRC_UNSPECIFIED;", "VAR_0->avctx->colorspace = AVCOL_SPC_UNSPECIFIED;", "}", "ff_hevc_pred_init(&VAR_0->hpc, VAR_1->bit_depth);", "ff_hevc_dsp_init (&VAR_0->hevcdsp, VAR_1->bit_depth);", "ff_videodsp_init (&VAR_0->vdsp, VAR_1->bit_depth);", "if (VAR_1->sao_enabled) {", "av_frame_unref(VAR_0->tmp_frame);", "VAR_2 = ff_get_buffer(VAR_0->avctx, VAR_0->tmp_frame, AV_GET_BUFFER_FLAG_REF);", "if (VAR_2 < 0)\ngoto fail;", "VAR_0->frame = VAR_0->tmp_frame;", "}", "VAR_0->VAR_1 = VAR_1;", "VAR_0->vps = (HEVCVPS*) VAR_0->vps_list[VAR_0->VAR_1->vps_id]->data;", "if (VAR_0->vps->vps_timing_info_present_flag) {", "VAR_3 = VAR_0->vps->vps_num_units_in_tick;", "VAR_4 = VAR_0->vps->vps_time_scale;", "} else if (VAR_1->vui.vui_timing_info_present_flag) {", "VAR_3 = VAR_1->vui.vui_num_units_in_tick;", "VAR_4 = VAR_1->vui.vui_time_scale;", "}", "if (VAR_3 != 0 && VAR_4 != 0)\nav_reduce(&VAR_0->avctx->time_base.VAR_3, &VAR_0->avctx->time_base.VAR_4,\nVAR_3, VAR_4, 1 << 30);", "return 0;", "fail:\npic_arrays_free(VAR_0);", "VAR_0->VAR_1 = NULL;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117, 119 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ] ]
3,418
yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target) { const int16_t *buf0 = buf[0], *buf1 = buf[1]; const uint8_t * const d128 = dither_8x8_220[y & 7]; int yalpha1 = 4096 - yalpha; int i; if (c->flags & SWS_ERROR_DIFFUSION) { int err = 0; int acc = 0; for (i = 0; i < dstW; i +=2) { int Y; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4; c->dither_error[0][i] = err; acc = 2*acc + (Y >= 128); Y -= 220*(acc&1); err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4; c->dither_error[0][i+1] = Y; acc = 2*acc + (err >= 128); err -= 220*(acc&1); if ((i & 7) == 6) output_pixel(*dest++, acc); } c->dither_error[0][i] = err; } else { for (i = 0; i < dstW; i += 8) { int Y, acc = 0; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; accumulate_bit(acc, Y + d128[0]); Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; accumulate_bit(acc, Y + d128[1]); Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; accumulate_bit(acc, Y + d128[2]); Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; accumulate_bit(acc, Y + d128[3]); Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; accumulate_bit(acc, Y + d128[4]); Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; accumulate_bit(acc, Y + d128[5]); Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; accumulate_bit(acc, Y + d128[6]); Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; accumulate_bit(acc, Y + d128[7]); output_pixel(*dest++, acc); } } }
false
FFmpeg
1e0e193240a8e47a980ac76b8b5af831b17b7928
yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target) { const int16_t *buf0 = buf[0], *buf1 = buf[1]; const uint8_t * const d128 = dither_8x8_220[y & 7]; int yalpha1 = 4096 - yalpha; int i; if (c->flags & SWS_ERROR_DIFFUSION) { int err = 0; int acc = 0; for (i = 0; i < dstW; i +=2) { int Y; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4; c->dither_error[0][i] = err; acc = 2*acc + (Y >= 128); Y -= 220*(acc&1); err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4; c->dither_error[0][i+1] = Y; acc = 2*acc + (err >= 128); err -= 220*(acc&1); if ((i & 7) == 6) output_pixel(*dest++, acc); } c->dither_error[0][i] = err; } else { for (i = 0; i < dstW; i += 8) { int Y, acc = 0; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; accumulate_bit(acc, Y + d128[0]); Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; accumulate_bit(acc, Y + d128[1]); Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; accumulate_bit(acc, Y + d128[2]); Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; accumulate_bit(acc, Y + d128[3]); Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; accumulate_bit(acc, Y + d128[4]); Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; accumulate_bit(acc, Y + d128[5]); Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; accumulate_bit(acc, Y + d128[6]); Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; accumulate_bit(acc, Y + d128[7]); output_pixel(*dest++, acc); } } }
{ "code": [], "line_no": [] }
FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2], const int16_t *VAR_2[2], const int16_t *VAR_3[2], const int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, enum AVPixelFormat VAR_10) { const int16_t *VAR_11 = VAR_1[0], *buf1 = VAR_1[1]; const uint8_t * const VAR_12 = dither_8x8_220[VAR_9 & 7]; int VAR_13 = 4096 - VAR_7; int VAR_14; if (VAR_0->flags & SWS_ERROR_DIFFUSION) { int VAR_15 = 0; int VAR_18 = 0; for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 +=2) { int VAR_18; VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19; VAR_18 += (7*VAR_15 + 1*VAR_0->dither_error[0][VAR_14] + 5*VAR_0->dither_error[0][VAR_14+1] + 3*VAR_0->dither_error[0][VAR_14+2] + 8 - 256)>>4; VAR_0->dither_error[0][VAR_14] = VAR_15; VAR_18 = 2*VAR_18 + (VAR_18 >= 128); VAR_18 -= 220*(VAR_18&1); VAR_15 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19; VAR_15 += (7*VAR_18 + 1*VAR_0->dither_error[0][VAR_14+1] + 5*VAR_0->dither_error[0][VAR_14+2] + 3*VAR_0->dither_error[0][VAR_14+3] + 8 - 256)>>4; VAR_0->dither_error[0][VAR_14+1] = VAR_18; VAR_18 = 2*VAR_18 + (VAR_15 >= 128); VAR_15 -= 220*(VAR_18&1); if ((VAR_14 & 7) == 6) output_pixel(*VAR_5++, VAR_18); } VAR_0->dither_error[0][VAR_14] = VAR_15; } else { for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 += 8) { int VAR_18, VAR_18 = 0; VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[0]); VAR_18 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[1]); VAR_18 = (VAR_11[VAR_14 + 2] * VAR_13 + buf1[VAR_14 + 2] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[2]); VAR_18 = (VAR_11[VAR_14 + 3] * VAR_13 + buf1[VAR_14 + 3] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[3]); VAR_18 = (VAR_11[VAR_14 + 4] * VAR_13 + buf1[VAR_14 + 4] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[4]); VAR_18 = (VAR_11[VAR_14 + 5] * VAR_13 + buf1[VAR_14 + 5] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[5]); VAR_18 = (VAR_11[VAR_14 + 6] * VAR_13 + buf1[VAR_14 + 6] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[6]); VAR_18 = (VAR_11[VAR_14 + 7] * VAR_13 + buf1[VAR_14 + 7] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[7]); output_pixel(*VAR_5++, VAR_18); } } }
[ "FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2],\nconst int16_t *VAR_2[2], const int16_t *VAR_3[2],\nconst int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8, int VAR_9,\nenum AVPixelFormat VAR_10)\n{", "const int16_t *VAR_11 = VAR_1[0], *buf1 = VAR_1[1];", "const uint8_t * const VAR_12 = dither_8x8_220[VAR_9 & 7];", "int VAR_13 = 4096 - VAR_7;", "int VAR_14;", "if (VAR_0->flags & SWS_ERROR_DIFFUSION) {", "int VAR_15 = 0;", "int VAR_18 = 0;", "for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 +=2) {", "int VAR_18;", "VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19;", "VAR_18 += (7*VAR_15 + 1*VAR_0->dither_error[0][VAR_14] + 5*VAR_0->dither_error[0][VAR_14+1] + 3*VAR_0->dither_error[0][VAR_14+2] + 8 - 256)>>4;", "VAR_0->dither_error[0][VAR_14] = VAR_15;", "VAR_18 = 2*VAR_18 + (VAR_18 >= 128);", "VAR_18 -= 220*(VAR_18&1);", "VAR_15 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19;", "VAR_15 += (7*VAR_18 + 1*VAR_0->dither_error[0][VAR_14+1] + 5*VAR_0->dither_error[0][VAR_14+2] + 3*VAR_0->dither_error[0][VAR_14+3] + 8 - 256)>>4;", "VAR_0->dither_error[0][VAR_14+1] = VAR_18;", "VAR_18 = 2*VAR_18 + (VAR_15 >= 128);", "VAR_15 -= 220*(VAR_18&1);", "if ((VAR_14 & 7) == 6)\noutput_pixel(*VAR_5++, VAR_18);", "}", "VAR_0->dither_error[0][VAR_14] = VAR_15;", "} else {", "for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 += 8) {", "int VAR_18, VAR_18 = 0;", "VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[0]);", "VAR_18 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[1]);", "VAR_18 = (VAR_11[VAR_14 + 2] * VAR_13 + buf1[VAR_14 + 2] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[2]);", "VAR_18 = (VAR_11[VAR_14 + 3] * VAR_13 + buf1[VAR_14 + 3] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[3]);", "VAR_18 = (VAR_11[VAR_14 + 4] * VAR_13 + buf1[VAR_14 + 4] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[4]);", "VAR_18 = (VAR_11[VAR_14 + 5] * VAR_13 + buf1[VAR_14 + 5] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[5]);", "VAR_18 = (VAR_11[VAR_14 + 6] * VAR_13 + buf1[VAR_14 + 6] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[6]);", "VAR_18 = (VAR_11[VAR_14 + 7] * VAR_13 + buf1[VAR_14 + 7] * VAR_7) >> 19;", "accumulate_bit(VAR_18, VAR_18 + VAR_12[7]);", "output_pixel(*VAR_5++, VAR_18);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ] ]
3,419
static double eval_expr(Parser * p, AVEvalExpr * e) { switch (e->type) { case e_value: return e->value; case e_const: return e->value * p->const_value[e->a.const_index]; case e_func0: return e->value * e->a.func0(eval_expr(p, e->param[0])); case e_func1: return e->value * e->a.func1(p->opaque, eval_expr(p, e->param[0])); case e_func2: return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } case e_ld: return e->value * p->var[clip(eval_expr(p, e->param[0]), 0, VARS-1)]; case e_while: { double d; while(eval_expr(p, e->param[0])) d=eval_expr(p, e->param[1]); return d; } default: { double d = eval_expr(p, e->param[0]); double d2 = eval_expr(p, e->param[1]); switch (e->type) { case e_mod: return e->value * (d - floor(d/d2)*d2); case e_max: return e->value * (d > d2 ? d : d2); case e_min: return e->value * (d < d2 ? d : d2); case e_eq: return e->value * (d == d2 ? 1.0 : 0.0); case e_gt: return e->value * (d > d2 ? 1.0 : 0.0); case e_gte: return e->value * (d >= d2 ? 1.0 : 0.0); case e_pow: return e->value * pow(d, d2); case e_mul: return e->value * (d * d2); case e_div: return e->value * (d / d2); case e_add: return e->value * (d + d2); case e_last:return d2; case e_st : return e->value * (p->var[clip(d, 0, VARS-1)]= d2); } } } return NAN; }
false
FFmpeg
63a547eabc3ec874ca0f732d141eb2b2e95224a8
static double eval_expr(Parser * p, AVEvalExpr * e) { switch (e->type) { case e_value: return e->value; case e_const: return e->value * p->const_value[e->a.const_index]; case e_func0: return e->value * e->a.func0(eval_expr(p, e->param[0])); case e_func1: return e->value * e->a.func1(p->opaque, eval_expr(p, e->param[0])); case e_func2: return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } case e_ld: return e->value * p->var[clip(eval_expr(p, e->param[0]), 0, VARS-1)]; case e_while: { double d; while(eval_expr(p, e->param[0])) d=eval_expr(p, e->param[1]); return d; } default: { double d = eval_expr(p, e->param[0]); double d2 = eval_expr(p, e->param[1]); switch (e->type) { case e_mod: return e->value * (d - floor(d/d2)*d2); case e_max: return e->value * (d > d2 ? d : d2); case e_min: return e->value * (d < d2 ? d : d2); case e_eq: return e->value * (d == d2 ? 1.0 : 0.0); case e_gt: return e->value * (d > d2 ? 1.0 : 0.0); case e_gte: return e->value * (d >= d2 ? 1.0 : 0.0); case e_pow: return e->value * pow(d, d2); case e_mul: return e->value * (d * d2); case e_div: return e->value * (d / d2); case e_add: return e->value * (d + d2); case e_last:return d2; case e_st : return e->value * (p->var[clip(d, 0, VARS-1)]= d2); } } } return NAN; }
{ "code": [], "line_no": [] }
static double FUNC_0(Parser * VAR_0, AVEvalExpr * VAR_1) { switch (VAR_1->type) { case e_value: return VAR_1->value; case e_const: return VAR_1->value * VAR_0->const_value[VAR_1->a.const_index]; case e_func0: return VAR_1->value * VAR_1->a.func0(FUNC_0(VAR_0, VAR_1->param[0])); case e_func1: return VAR_1->value * VAR_1->a.func1(VAR_0->opaque, FUNC_0(VAR_0, VAR_1->param[0])); case e_func2: return VAR_1->value * VAR_1->a.func2(VAR_0->opaque, FUNC_0(VAR_0, VAR_1->param[0]), FUNC_0(VAR_0, VAR_1->param[1])); case e_squish: return 1/(1+exp(4*FUNC_0(VAR_0, VAR_1->param[0]))); case e_gauss: { double VAR_3 = FUNC_0(VAR_0, VAR_1->param[0]); return exp(-VAR_3*VAR_3/2)/sqrt(2*M_PI); } case e_ld: return VAR_1->value * VAR_0->var[clip(FUNC_0(VAR_0, VAR_1->param[0]), 0, VARS-1)]; case e_while: { double VAR_3; while(FUNC_0(VAR_0, VAR_1->param[0])) VAR_3=FUNC_0(VAR_0, VAR_1->param[1]); return VAR_3; } default: { double VAR_3 = FUNC_0(VAR_0, VAR_1->param[0]); double VAR_3 = FUNC_0(VAR_0, VAR_1->param[1]); switch (VAR_1->type) { case e_mod: return VAR_1->value * (VAR_3 - floor(VAR_3/VAR_3)*VAR_3); case e_max: return VAR_1->value * (VAR_3 > VAR_3 ? VAR_3 : VAR_3); case e_min: return VAR_1->value * (VAR_3 < VAR_3 ? VAR_3 : VAR_3); case e_eq: return VAR_1->value * (VAR_3 == VAR_3 ? 1.0 : 0.0); case e_gt: return VAR_1->value * (VAR_3 > VAR_3 ? 1.0 : 0.0); case e_gte: return VAR_1->value * (VAR_3 >= VAR_3 ? 1.0 : 0.0); case e_pow: return VAR_1->value * pow(VAR_3, VAR_3); case e_mul: return VAR_1->value * (VAR_3 * VAR_3); case e_div: return VAR_1->value * (VAR_3 / VAR_3); case e_add: return VAR_1->value * (VAR_3 + VAR_3); case e_last:return VAR_3; case e_st : return VAR_1->value * (VAR_0->var[clip(VAR_3, 0, VARS-1)]= VAR_3); } } } return NAN; }
[ "static double FUNC_0(Parser * VAR_0, AVEvalExpr * VAR_1) {", "switch (VAR_1->type) {", "case e_value: return VAR_1->value;", "case e_const: return VAR_1->value * VAR_0->const_value[VAR_1->a.const_index];", "case e_func0: return VAR_1->value * VAR_1->a.func0(FUNC_0(VAR_0, VAR_1->param[0]));", "case e_func1: return VAR_1->value * VAR_1->a.func1(VAR_0->opaque, FUNC_0(VAR_0, VAR_1->param[0]));", "case e_func2: return VAR_1->value * VAR_1->a.func2(VAR_0->opaque, FUNC_0(VAR_0, VAR_1->param[0]), FUNC_0(VAR_0, VAR_1->param[1]));", "case e_squish: return 1/(1+exp(4*FUNC_0(VAR_0, VAR_1->param[0])));", "case e_gauss: { double VAR_3 = FUNC_0(VAR_0, VAR_1->param[0]); return exp(-VAR_3*VAR_3/2)/sqrt(2*M_PI); }", "case e_ld: return VAR_1->value * VAR_0->var[clip(FUNC_0(VAR_0, VAR_1->param[0]), 0, VARS-1)];", "case e_while: {", "double VAR_3;", "while(FUNC_0(VAR_0, VAR_1->param[0]))\nVAR_3=FUNC_0(VAR_0, VAR_1->param[1]);", "return VAR_3;", "}", "default: {", "double VAR_3 = FUNC_0(VAR_0, VAR_1->param[0]);", "double VAR_3 = FUNC_0(VAR_0, VAR_1->param[1]);", "switch (VAR_1->type) {", "case e_mod: return VAR_1->value * (VAR_3 - floor(VAR_3/VAR_3)*VAR_3);", "case e_max: return VAR_1->value * (VAR_3 > VAR_3 ? VAR_3 : VAR_3);", "case e_min: return VAR_1->value * (VAR_3 < VAR_3 ? VAR_3 : VAR_3);", "case e_eq: return VAR_1->value * (VAR_3 == VAR_3 ? 1.0 : 0.0);", "case e_gt: return VAR_1->value * (VAR_3 > VAR_3 ? 1.0 : 0.0);", "case e_gte: return VAR_1->value * (VAR_3 >= VAR_3 ? 1.0 : 0.0);", "case e_pow: return VAR_1->value * pow(VAR_3, VAR_3);", "case e_mul: return VAR_1->value * (VAR_3 * VAR_3);", "case e_div: return VAR_1->value * (VAR_3 / VAR_3);", "case e_add: return VAR_1->value * (VAR_3 + VAR_3);", "case e_last:return VAR_3;", "case e_st : return VAR_1->value * (VAR_0->var[clip(VAR_3, 0, VARS-1)]= VAR_3);", "}", "}", "}", "return NAN;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
3,420
static int build_filter(ResampleContext *c, void *filter, double factor, int tap_count, int alloc, int phase_count, int scale, int filter_type, int kaiser_beta){ int ph, i; double x, y, w; double *tab = av_malloc_array(tap_count, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) return AVERROR(ENOMEM); /* if upsampling, only need to interpolate, no filter */ if (factor > 1.0) factor = 1.0; for(ph=0;ph<phase_count;ph++) { double norm = 0; for(i=0;i<tap_count;i++) { x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor; if (x == 0) y = 1.0; else y = sin(x) / x; switch(filter_type){ case SWR_FILTER_TYPE_CUBIC:{ const float d= -0.5; //first order derivative = -0.5 x = fabs(((double)(i - center) - (double)ph / phase_count) * factor); if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*( -x*x + x*x*x); else y= d*(-4 + 8*x - 5*x*x + x*x*x); break;} case SWR_FILTER_TYPE_BLACKMAN_NUTTALL: w = 2.0*x / (factor*tap_count) + M_PI; y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w); break; case SWR_FILTER_TYPE_KAISER: w = 2.0*x / (factor*tap_count*M_PI); y *= bessel(kaiser_beta*sqrt(FFMAX(1-w*w, 0))); break; default: av_assert0(0); } tab[i] = y; norm += y; } /* normalize so that an uniform color remains the same */ switch(c->format){ case AV_SAMPLE_FMT_S16P: for(i=0;i<tap_count;i++) ((int16_t*)filter)[ph * alloc + i] = av_clip(lrintf(tab[i] * scale / norm), INT16_MIN, INT16_MAX); break; case AV_SAMPLE_FMT_S32P: for(i=0;i<tap_count;i++) ((int32_t*)filter)[ph * alloc + i] = av_clipl_int32(llrint(tab[i] * scale / norm)); break; case AV_SAMPLE_FMT_FLTP: for(i=0;i<tap_count;i++) ((float*)filter)[ph * alloc + i] = tab[i] * scale / norm; break; case AV_SAMPLE_FMT_DBLP: for(i=0;i<tap_count;i++) ((double*)filter)[ph * alloc + i] = tab[i] * scale / norm; break; } } #if 0 { #define LEN 1024 int j,k; double sine[LEN + tap_count]; double filtered[LEN]; double maxff=-2, minff=2, maxsf=-2, minsf=2; for(i=0; i<LEN; i++){ double ss=0, sf=0, ff=0; for(j=0; j<LEN+tap_count; j++) sine[j]= cos(i*j*M_PI/LEN); for(j=0; j<LEN; j++){ double sum=0; ph=0; for(k=0; k<tap_count; k++) sum += filter[ph * tap_count + k] * sine[k+j]; filtered[j]= sum / (1<<FILTER_SHIFT); ss+= sine[j + center] * sine[j + center]; ff+= filtered[j] * filtered[j]; sf+= sine[j + center] * filtered[j]; } ss= sqrt(2*ss/LEN); ff= sqrt(2*ff/LEN); sf= 2*sf/LEN; maxff= FFMAX(maxff, ff); minff= FFMIN(minff, ff); maxsf= FFMAX(maxsf, sf); minsf= FFMIN(minsf, sf); if(i%11==0){ av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", i, ss, maxff, minff, maxsf, minsf); minff=minsf= 2; maxff=maxsf= -2; } } } #endif av_free(tab); return 0; }
true
FFmpeg
9bec6d71a22ab42908f900f3b3289fa1edfcea6e
static int build_filter(ResampleContext *c, void *filter, double factor, int tap_count, int alloc, int phase_count, int scale, int filter_type, int kaiser_beta){ int ph, i; double x, y, w; double *tab = av_malloc_array(tap_count, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) return AVERROR(ENOMEM); if (factor > 1.0) factor = 1.0; for(ph=0;ph<phase_count;ph++) { double norm = 0; for(i=0;i<tap_count;i++) { x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor; if (x == 0) y = 1.0; else y = sin(x) / x; switch(filter_type){ case SWR_FILTER_TYPE_CUBIC:{ const float d= -0.5; x = fabs(((double)(i - center) - (double)ph / phase_count) * factor); if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*( -x*x + x*x*x); else y= d*(-4 + 8*x - 5*x*x + x*x*x); break;} case SWR_FILTER_TYPE_BLACKMAN_NUTTALL: w = 2.0*x / (factor*tap_count) + M_PI; y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w); break; case SWR_FILTER_TYPE_KAISER: w = 2.0*x / (factor*tap_count*M_PI); y *= bessel(kaiser_beta*sqrt(FFMAX(1-w*w, 0))); break; default: av_assert0(0); } tab[i] = y; norm += y; } switch(c->format){ case AV_SAMPLE_FMT_S16P: for(i=0;i<tap_count;i++) ((int16_t*)filter)[ph * alloc + i] = av_clip(lrintf(tab[i] * scale / norm), INT16_MIN, INT16_MAX); break; case AV_SAMPLE_FMT_S32P: for(i=0;i<tap_count;i++) ((int32_t*)filter)[ph * alloc + i] = av_clipl_int32(llrint(tab[i] * scale / norm)); break; case AV_SAMPLE_FMT_FLTP: for(i=0;i<tap_count;i++) ((float*)filter)[ph * alloc + i] = tab[i] * scale / norm; break; case AV_SAMPLE_FMT_DBLP: for(i=0;i<tap_count;i++) ((double*)filter)[ph * alloc + i] = tab[i] * scale / norm; break; } } #if 0 { #define LEN 1024 int j,k; double sine[LEN + tap_count]; double filtered[LEN]; double maxff=-2, minff=2, maxsf=-2, minsf=2; for(i=0; i<LEN; i++){ double ss=0, sf=0, ff=0; for(j=0; j<LEN+tap_count; j++) sine[j]= cos(i*j*M_PI/LEN); for(j=0; j<LEN; j++){ double sum=0; ph=0; for(k=0; k<tap_count; k++) sum += filter[ph * tap_count + k] * sine[k+j]; filtered[j]= sum / (1<<FILTER_SHIFT); ss+= sine[j + center] * sine[j + center]; ff+= filtered[j] * filtered[j]; sf+= sine[j + center] * filtered[j]; } ss= sqrt(2*ss/LEN); ff= sqrt(2*ff/LEN); sf= 2*sf/LEN; maxff= FFMAX(maxff, ff); minff= FFMIN(minff, ff); maxsf= FFMAX(maxsf, sf); minsf= FFMIN(minsf, sf); if(i%11==0){ av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", i, ss, maxff, minff, maxsf, minsf); minff=minsf= 2; maxff=maxsf= -2; } } } #endif av_free(tab); return 0; }
{ "code": [ " double *tab = av_malloc_array(tap_count, sizeof(*tab));", " for(ph=0;ph<phase_count;ph++) {", " for(i=0;i<tap_count;i++) {", " norm += y;" ], "line_no": [ 9, 29, 33, 81 ] }
static int FUNC_0(ResampleContext *VAR_0, void *VAR_1, double VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8){ int VAR_9, VAR_10; double VAR_11, VAR_12, VAR_13; double *VAR_14 = av_malloc_array(VAR_3, sizeof(*VAR_14)); const int VAR_15= (VAR_3-1)/2; if (!VAR_14) return AVERROR(ENOMEM); if (VAR_2 > 1.0) VAR_2 = 1.0; for(VAR_9=0;VAR_9<VAR_5;VAR_9++) { double VAR_16 = 0; for(VAR_10=0;VAR_10<VAR_3;VAR_10++) { VAR_11 = M_PI * ((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2; if (VAR_11 == 0) VAR_12 = 1.0; else VAR_12 = sin(VAR_11) / VAR_11; switch(VAR_7){ case SWR_FILTER_TYPE_CUBIC:{ const float VAR_17= -0.5; VAR_11 = fabs(((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2); if(VAR_11<1.0) VAR_12= 1 - 3*VAR_11*VAR_11 + 2*VAR_11*VAR_11*VAR_11 + VAR_17*( -VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11); else VAR_12= VAR_17*(-4 + 8*VAR_11 - 5*VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11); break;} case SWR_FILTER_TYPE_BLACKMAN_NUTTALL: VAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3) + M_PI; VAR_12 *= 0.3635819 - 0.4891775 * cos(VAR_13) + 0.1365995 * cos(2*VAR_13) - 0.0106411 * cos(3*VAR_13); break; case SWR_FILTER_TYPE_KAISER: VAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3*M_PI); VAR_12 *= bessel(VAR_8*sqrt(FFMAX(1-VAR_13*VAR_13, 0))); break; default: av_assert0(0); } VAR_14[VAR_10] = VAR_12; VAR_16 += VAR_12; } switch(VAR_0->format){ case AV_SAMPLE_FMT_S16P: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((int16_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clip(lrintf(VAR_14[VAR_10] * VAR_6 / VAR_16), INT16_MIN, INT16_MAX); break; case AV_SAMPLE_FMT_S32P: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((int32_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clipl_int32(llrint(VAR_14[VAR_10] * VAR_6 / VAR_16)); break; case AV_SAMPLE_FMT_FLTP: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((float*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16; break; case AV_SAMPLE_FMT_DBLP: for(VAR_10=0;VAR_10<VAR_3;VAR_10++) ((double*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16; break; } } #if 0 { #define LEN 1024 int j,k; double sine[LEN + VAR_3]; double filtered[LEN]; double maxff=-2, minff=2, maxsf=-2, minsf=2; for(VAR_10=0; VAR_10<LEN; VAR_10++){ double ss=0, sf=0, ff=0; for(j=0; j<LEN+VAR_3; j++) sine[j]= cos(VAR_10*j*M_PI/LEN); for(j=0; j<LEN; j++){ double sum=0; VAR_9=0; for(k=0; k<VAR_3; k++) sum += VAR_1[VAR_9 * VAR_3 + k] * sine[k+j]; filtered[j]= sum / (1<<FILTER_SHIFT); ss+= sine[j + VAR_15] * sine[j + VAR_15]; ff+= filtered[j] * filtered[j]; sf+= sine[j + VAR_15] * filtered[j]; } ss= sqrt(2*ss/LEN); ff= sqrt(2*ff/LEN); sf= 2*sf/LEN; maxff= FFMAX(maxff, ff); minff= FFMIN(minff, ff); maxsf= FFMAX(maxsf, sf); minsf= FFMIN(minsf, sf); if(VAR_10%11==0){ av_log(NULL, AV_LOG_ERROR, "VAR_10:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", VAR_10, ss, maxff, minff, maxsf, minsf); minff=minsf= 2; maxff=maxsf= -2; } } } #endif av_free(VAR_14); return 0; }
[ "static int FUNC_0(ResampleContext *VAR_0, void *VAR_1, double VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6,\nint VAR_7, int VAR_8){", "int VAR_9, VAR_10;", "double VAR_11, VAR_12, VAR_13;", "double *VAR_14 = av_malloc_array(VAR_3, sizeof(*VAR_14));", "const int VAR_15= (VAR_3-1)/2;", "if (!VAR_14)\nreturn AVERROR(ENOMEM);", "if (VAR_2 > 1.0)\nVAR_2 = 1.0;", "for(VAR_9=0;VAR_9<VAR_5;VAR_9++) {", "double VAR_16 = 0;", "for(VAR_10=0;VAR_10<VAR_3;VAR_10++) {", "VAR_11 = M_PI * ((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2;", "if (VAR_11 == 0) VAR_12 = 1.0;", "else VAR_12 = sin(VAR_11) / VAR_11;", "switch(VAR_7){", "case SWR_FILTER_TYPE_CUBIC:{", "const float VAR_17= -0.5;", "VAR_11 = fabs(((double)(VAR_10 - VAR_15) - (double)VAR_9 / VAR_5) * VAR_2);", "if(VAR_11<1.0) VAR_12= 1 - 3*VAR_11*VAR_11 + 2*VAR_11*VAR_11*VAR_11 + VAR_17*( -VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11);", "else VAR_12= VAR_17*(-4 + 8*VAR_11 - 5*VAR_11*VAR_11 + VAR_11*VAR_11*VAR_11);", "break;}", "case SWR_FILTER_TYPE_BLACKMAN_NUTTALL:\nVAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3) + M_PI;", "VAR_12 *= 0.3635819 - 0.4891775 * cos(VAR_13) + 0.1365995 * cos(2*VAR_13) - 0.0106411 * cos(3*VAR_13);", "break;", "case SWR_FILTER_TYPE_KAISER:\nVAR_13 = 2.0*VAR_11 / (VAR_2*VAR_3*M_PI);", "VAR_12 *= bessel(VAR_8*sqrt(FFMAX(1-VAR_13*VAR_13, 0)));", "break;", "default:\nav_assert0(0);", "}", "VAR_14[VAR_10] = VAR_12;", "VAR_16 += VAR_12;", "}", "switch(VAR_0->format){", "case AV_SAMPLE_FMT_S16P:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((int16_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clip(lrintf(VAR_14[VAR_10] * VAR_6 / VAR_16), INT16_MIN, INT16_MAX);", "break;", "case AV_SAMPLE_FMT_S32P:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((int32_t*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = av_clipl_int32(llrint(VAR_14[VAR_10] * VAR_6 / VAR_16));", "break;", "case AV_SAMPLE_FMT_FLTP:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((float*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16;", "break;", "case AV_SAMPLE_FMT_DBLP:\nfor(VAR_10=0;VAR_10<VAR_3;VAR_10++)", "((double*)VAR_1)[VAR_9 * VAR_4 + VAR_10] = VAR_14[VAR_10] * VAR_6 / VAR_16;", "break;", "}", "}", "#if 0\n{", "#define LEN 1024\nint j,k;", "double sine[LEN + VAR_3];", "double filtered[LEN];", "double maxff=-2, minff=2, maxsf=-2, minsf=2;", "for(VAR_10=0; VAR_10<LEN; VAR_10++){", "double ss=0, sf=0, ff=0;", "for(j=0; j<LEN+VAR_3; j++)", "sine[j]= cos(VAR_10*j*M_PI/LEN);", "for(j=0; j<LEN; j++){", "double sum=0;", "VAR_9=0;", "for(k=0; k<VAR_3; k++)", "sum += VAR_1[VAR_9 * VAR_3 + k] * sine[k+j];", "filtered[j]= sum / (1<<FILTER_SHIFT);", "ss+= sine[j + VAR_15] * sine[j + VAR_15];", "ff+= filtered[j] * filtered[j];", "sf+= sine[j + VAR_15] * filtered[j];", "}", "ss= sqrt(2*ss/LEN);", "ff= sqrt(2*ff/LEN);", "sf= 2*sf/LEN;", "maxff= FFMAX(maxff, ff);", "minff= FFMIN(minff, ff);", "maxsf= FFMAX(maxsf, sf);", "minsf= FFMIN(minsf, sf);", "if(VAR_10%11==0){", "av_log(NULL, AV_LOG_ERROR, \"VAR_10:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\\n\", VAR_10, ss, maxff, minff, maxsf, minsf);", "minff=minsf= 2;", "maxff=maxsf= -2;", "}", "}", "}", "#endif\nav_free(VAR_14);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 201 ], [ 203 ], [ 205 ] ]
3,421
void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){ int flags=0; memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->codec_type = codec_type; if(codec_type == CODEC_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; else if(codec_type == CODEC_TYPE_VIDEO) flags= AV_OPT_FLAG_VIDEO_PARAM; else if(codec_type == CODEC_TYPE_SUBTITLE) flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); s->rc_eq= av_strdup("tex^qComp"); s->time_base= (AVRational){0,1}; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->sample_aspect_ratio= (AVRational){0,1}; s->pix_fmt= PIX_FMT_NONE; s->sample_fmt= SAMPLE_FMT_S16; // FIXME: set to NONE s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; }
true
FFmpeg
3cffbe090a5168dcfe580de8d662a32e7ad1d911
void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){ int flags=0; memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->codec_type = codec_type; if(codec_type == CODEC_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; else if(codec_type == CODEC_TYPE_VIDEO) flags= AV_OPT_FLAG_VIDEO_PARAM; else if(codec_type == CODEC_TYPE_SUBTITLE) flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); s->rc_eq= av_strdup("tex^qComp"); s->time_base= (AVRational){0,1}; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->sample_aspect_ratio= (AVRational){0,1}; s->pix_fmt= PIX_FMT_NONE; s->sample_fmt= SAMPLE_FMT_S16; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; }
{ "code": [ " s->rc_eq= av_strdup(\"tex^qComp\");" ], "line_no": [ 31 ] }
void FUNC_0(AVCodecContext *VAR_0, enum CodecType VAR_1){ int VAR_2=0; memset(VAR_0, 0, sizeof(AVCodecContext)); VAR_0->av_class= &av_codec_context_class; VAR_0->VAR_1 = VAR_1; if(VAR_1 == CODEC_TYPE_AUDIO) VAR_2= AV_OPT_FLAG_AUDIO_PARAM; else if(VAR_1 == CODEC_TYPE_VIDEO) VAR_2= AV_OPT_FLAG_VIDEO_PARAM; else if(VAR_1 == CODEC_TYPE_SUBTITLE) VAR_2= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(VAR_0, VAR_2, VAR_2); VAR_0->rc_eq= av_strdup("tex^qComp"); VAR_0->time_base= (AVRational){0,1}; VAR_0->get_buffer= avcodec_default_get_buffer; VAR_0->release_buffer= avcodec_default_release_buffer; VAR_0->get_format= avcodec_default_get_format; VAR_0->execute= avcodec_default_execute; VAR_0->sample_aspect_ratio= (AVRational){0,1}; VAR_0->pix_fmt= PIX_FMT_NONE; VAR_0->sample_fmt= SAMPLE_FMT_S16; VAR_0->palctrl = NULL; VAR_0->reget_buffer= avcodec_default_reget_buffer; }
[ "void FUNC_0(AVCodecContext *VAR_0, enum CodecType VAR_1){", "int VAR_2=0;", "memset(VAR_0, 0, sizeof(AVCodecContext));", "VAR_0->av_class= &av_codec_context_class;", "VAR_0->VAR_1 = VAR_1;", "if(VAR_1 == CODEC_TYPE_AUDIO)\nVAR_2= AV_OPT_FLAG_AUDIO_PARAM;", "else if(VAR_1 == CODEC_TYPE_VIDEO)\nVAR_2= AV_OPT_FLAG_VIDEO_PARAM;", "else if(VAR_1 == CODEC_TYPE_SUBTITLE)\nVAR_2= AV_OPT_FLAG_SUBTITLE_PARAM;", "av_opt_set_defaults2(VAR_0, VAR_2, VAR_2);", "VAR_0->rc_eq= av_strdup(\"tex^qComp\");", "VAR_0->time_base= (AVRational){0,1};", "VAR_0->get_buffer= avcodec_default_get_buffer;", "VAR_0->release_buffer= avcodec_default_release_buffer;", "VAR_0->get_format= avcodec_default_get_format;", "VAR_0->execute= avcodec_default_execute;", "VAR_0->sample_aspect_ratio= (AVRational){0,1};", "VAR_0->pix_fmt= PIX_FMT_NONE;", "VAR_0->sample_fmt= SAMPLE_FMT_S16;", "VAR_0->palctrl = NULL;", "VAR_0->reget_buffer= avcodec_default_reget_buffer;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ] ]
3,422
static void dec_float(DisasContext *dc, uint32_t insn) { uint32_t op0; uint32_t ra, rb, rd; op0 = extract32(insn, 0, 8); ra = extract32(insn, 16, 5); rb = extract32(insn, 11, 5); rd = extract32(insn, 21, 5); switch (op0) { case 0x00: /* lf.add.s */ LOG_DIS("lf.add.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_add_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x01: /* lf.sub.s */ LOG_DIS("lf.sub.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_sub_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x02: /* lf.mul.s */ LOG_DIS("lf.mul.s r%d, r%d, r%d\n", rd, ra, rb); if (ra != 0 && rb != 0) { gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); } else { tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF); tcg_gen_movi_i32(cpu_R[rd], 0x0); } break; case 0x03: /* lf.div.s */ LOG_DIS("lf.div.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_div_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x04: /* lf.itof.s */ LOG_DIS("lf.itof r%d, r%d\n", rd, ra); gen_helper_itofs(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x05: /* lf.ftoi.s */ LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); gen_helper_ftois(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x06: /* lf.rem.s */ LOG_DIS("lf.rem.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_rem_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x07: /* lf.madd.s */ LOG_DIS("lf.madd.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_madd_s(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], cpu_R[rb]); break; case 0x08: /* lf.sfeq.s */ LOG_DIS("lf.sfeq.s r%d, r%d\n", ra, rb); gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x09: /* lf.sfne.s */ LOG_DIS("lf.sfne.s r%d, r%d\n", ra, rb); gen_helper_float_ne_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0a: /* lf.sfgt.s */ LOG_DIS("lf.sfgt.s r%d, r%d\n", ra, rb); gen_helper_float_gt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0b: /* lf.sfge.s */ LOG_DIS("lf.sfge.s r%d, r%d\n", ra, rb); gen_helper_float_ge_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0c: /* lf.sflt.s */ LOG_DIS("lf.sflt.s r%d, r%d\n", ra, rb); gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0d: /* lf.sfle.s */ LOG_DIS("lf.sfle.s r%d, r%d\n", ra, rb); gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; /* not used yet, open it when we need or64. */ /*#ifdef TARGET_OPENRISC64 case 0x10: lf.add.d LOG_DIS("lf.add.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); gen_helper_float_add_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x11: lf.sub.d LOG_DIS("lf.sub.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); gen_helper_float_sub_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x12: lf.mul.d LOG_DIS("lf.mul.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); if (ra != 0 && rb != 0) { gen_helper_float_mul_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); } else { tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF); tcg_gen_movi_i64(cpu_R[rd], 0x0); } break; case 0x13: lf.div.d LOG_DIS("lf.div.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); gen_helper_float_div_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x14: lf.itof.d LOG_DIS("lf.itof r%d, r%d\n", rd, ra); check_of64s(dc); gen_helper_itofd(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x15: lf.ftoi.d LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); check_of64s(dc); gen_helper_ftoid(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x16: lf.rem.d LOG_DIS("lf.rem.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); gen_helper_float_rem_d(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x17: lf.madd.d LOG_DIS("lf.madd.d r%d, r%d, r%d\n", rd, ra, rb); check_of64s(dc); gen_helper_float_madd_d(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], cpu_R[rb]); break; case 0x18: lf.sfeq.d LOG_DIS("lf.sfeq.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_eq_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x1a: lf.sfgt.d LOG_DIS("lf.sfgt.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_gt_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x1b: lf.sfge.d LOG_DIS("lf.sfge.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_ge_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x19: lf.sfne.d LOG_DIS("lf.sfne.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_ne_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x1c: lf.sflt.d LOG_DIS("lf.sflt.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_lt_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x1d: lf.sfle.d LOG_DIS("lf.sfle.d r%d, r%d\n", ra, rb); check_of64s(dc); gen_helper_float_le_d(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; #endif*/ default: gen_illegal_exception(dc); break; } }
true
qemu
6597c28d618a3d16d468770b7c30a0237a8c8ea9
static void dec_float(DisasContext *dc, uint32_t insn) { uint32_t op0; uint32_t ra, rb, rd; op0 = extract32(insn, 0, 8); ra = extract32(insn, 16, 5); rb = extract32(insn, 11, 5); rd = extract32(insn, 21, 5); switch (op0) { case 0x00: LOG_DIS("lf.add.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_add_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x01: LOG_DIS("lf.sub.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_sub_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x02: LOG_DIS("lf.mul.s r%d, r%d, r%d\n", rd, ra, rb); if (ra != 0 && rb != 0) { gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); } else { tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF); tcg_gen_movi_i32(cpu_R[rd], 0x0); } break; case 0x03: LOG_DIS("lf.div.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_div_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x04: LOG_DIS("lf.itof r%d, r%d\n", rd, ra); gen_helper_itofs(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x05: LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); gen_helper_ftois(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x06: LOG_DIS("lf.rem.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_rem_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x07: LOG_DIS("lf.madd.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_madd_s(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], cpu_R[rb]); break; case 0x08: LOG_DIS("lf.sfeq.s r%d, r%d\n", ra, rb); gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x09: LOG_DIS("lf.sfne.s r%d, r%d\n", ra, rb); gen_helper_float_ne_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0a: LOG_DIS("lf.sfgt.s r%d, r%d\n", ra, rb); gen_helper_float_gt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0b: LOG_DIS("lf.sfge.s r%d, r%d\n", ra, rb); gen_helper_float_ge_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0c: LOG_DIS("lf.sflt.s r%d, r%d\n", ra, rb); gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0d: LOG_DIS("lf.sfle.s r%d, r%d\n", ra, rb); gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; default: gen_illegal_exception(dc); break; } }
{ "code": [ " if (ra != 0 && rb != 0) {", " gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]);", " } else {", " tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF);", " tcg_gen_movi_i32(cpu_R[rd], 0x0);", " if (ra != 0 && rb != 0) {", " } else {", " tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF);" ], "line_no": [ 47, 49, 51, 53, 55, 47, 51, 53 ] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { uint32_t op0; uint32_t ra, rb, rd; op0 = extract32(VAR_1, 0, 8); ra = extract32(VAR_1, 16, 5); rb = extract32(VAR_1, 11, 5); rd = extract32(VAR_1, 21, 5); switch (op0) { case 0x00: LOG_DIS("lf.add.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_add_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x01: LOG_DIS("lf.sub.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_sub_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x02: LOG_DIS("lf.mul.s r%d, r%d, r%d\n", rd, ra, rb); if (ra != 0 && rb != 0) { gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); } else { tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF); tcg_gen_movi_i32(cpu_R[rd], 0x0); } break; case 0x03: LOG_DIS("lf.div.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_div_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x04: LOG_DIS("lf.itof r%d, r%d\n", rd, ra); gen_helper_itofs(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x05: LOG_DIS("lf.ftoi r%d, r%d\n", rd, ra); gen_helper_ftois(cpu_R[rd], cpu_env, cpu_R[ra]); break; case 0x06: LOG_DIS("lf.rem.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_rem_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x07: LOG_DIS("lf.madd.s r%d, r%d, r%d\n", rd, ra, rb); gen_helper_float_madd_s(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], cpu_R[rb]); break; case 0x08: LOG_DIS("lf.sfeq.s r%d, r%d\n", ra, rb); gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x09: LOG_DIS("lf.sfne.s r%d, r%d\n", ra, rb); gen_helper_float_ne_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0a: LOG_DIS("lf.sfgt.s r%d, r%d\n", ra, rb); gen_helper_float_gt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0b: LOG_DIS("lf.sfge.s r%d, r%d\n", ra, rb); gen_helper_float_ge_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0c: LOG_DIS("lf.sflt.s r%d, r%d\n", ra, rb); gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; case 0x0d: LOG_DIS("lf.sfle.s r%d, r%d\n", ra, rb); gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]); break; default: gen_illegal_exception(VAR_0); break; } }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "uint32_t op0;", "uint32_t ra, rb, rd;", "op0 = extract32(VAR_1, 0, 8);", "ra = extract32(VAR_1, 16, 5);", "rb = extract32(VAR_1, 11, 5);", "rd = extract32(VAR_1, 21, 5);", "switch (op0) {", "case 0x00:\nLOG_DIS(\"lf.add.s r%d, r%d, r%d\\n\", rd, ra, rb);", "gen_helper_float_add_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x01:\nLOG_DIS(\"lf.sub.s r%d, r%d, r%d\\n\", rd, ra, rb);", "gen_helper_float_sub_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x02:\nLOG_DIS(\"lf.mul.s r%d, r%d, r%d\\n\", rd, ra, rb);", "if (ra != 0 && rb != 0) {", "gen_helper_float_mul_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]);", "} else {", "tcg_gen_ori_tl(fpcsr, fpcsr, FPCSR_ZF);", "tcg_gen_movi_i32(cpu_R[rd], 0x0);", "}", "break;", "case 0x03:\nLOG_DIS(\"lf.div.s r%d, r%d, r%d\\n\", rd, ra, rb);", "gen_helper_float_div_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x04:\nLOG_DIS(\"lf.itof r%d, r%d\\n\", rd, ra);", "gen_helper_itofs(cpu_R[rd], cpu_env, cpu_R[ra]);", "break;", "case 0x05:\nLOG_DIS(\"lf.ftoi r%d, r%d\\n\", rd, ra);", "gen_helper_ftois(cpu_R[rd], cpu_env, cpu_R[ra]);", "break;", "case 0x06:\nLOG_DIS(\"lf.rem.s r%d, r%d, r%d\\n\", rd, ra, rb);", "gen_helper_float_rem_s(cpu_R[rd], cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x07:\nLOG_DIS(\"lf.madd.s r%d, r%d, r%d\\n\", rd, ra, rb);", "gen_helper_float_madd_s(cpu_R[rd], cpu_env, cpu_R[rd],\ncpu_R[ra], cpu_R[rb]);", "break;", "case 0x08:\nLOG_DIS(\"lf.sfeq.s r%d, r%d\\n\", ra, rb);", "gen_helper_float_eq_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x09:\nLOG_DIS(\"lf.sfne.s r%d, r%d\\n\", ra, rb);", "gen_helper_float_ne_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x0a:\nLOG_DIS(\"lf.sfgt.s r%d, r%d\\n\", ra, rb);", "gen_helper_float_gt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x0b:\nLOG_DIS(\"lf.sfge.s r%d, r%d\\n\", ra, rb);", "gen_helper_float_ge_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x0c:\nLOG_DIS(\"lf.sflt.s r%d, r%d\\n\", ra, rb);", "gen_helper_float_lt_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "case 0x0d:\nLOG_DIS(\"lf.sfle.s r%d, r%d\\n\", ra, rb);", "gen_helper_float_le_s(cpu_sr_f, cpu_env, cpu_R[ra], cpu_R[rb]);", "break;", "default:\ngen_illegal_exception(VAR_0);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 107, 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ] ]
3,423
void rng_backend_open(RngBackend *s, Error **errp) { object_property_set_bool(OBJECT(s), true, "opened", errp); }
true
qemu
57d3e1b3f52d07d215ed96df946ee01f8d9f9526
void rng_backend_open(RngBackend *s, Error **errp) { object_property_set_bool(OBJECT(s), true, "opened", errp); }
{ "code": [ "void rng_backend_open(RngBackend *s, Error **errp)", " object_property_set_bool(OBJECT(s), true, \"opened\", errp);" ], "line_no": [ 1, 5 ] }
void FUNC_0(RngBackend *VAR_0, Error **VAR_1) { object_property_set_bool(OBJECT(VAR_0), true, "opened", VAR_1); }
[ "void FUNC_0(RngBackend *VAR_0, Error **VAR_1)\n{", "object_property_set_bool(OBJECT(VAR_0), true, \"opened\", VAR_1);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]