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
4,045
static void an5206_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; M68kCPU *cpu; CPUM68KState *env; int kernel_size; uint64_t elf_entry; hwaddr entry; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); if (!cpu_model) { cpu_model = "m5206"; } cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model)); if (!cpu) { error_report("Unable to find m68k CPU definition"); exit(1); } env = &cpu->env; /* Initialize CPU registers. */ env->vbr = 0; /* TODO: allow changing MBAR and RAMBAR. */ env->mbar = AN5206_MBAR_ADDR | 1; env->rambar0 = AN5206_RAMBAR_ADDR | 1; /* DRAM at address zero */ memory_region_allocate_system_memory(ram, NULL, "an5206.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); /* Internal SRAM. */ memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal); memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram); mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, cpu); /* Load kernel. */ if (!kernel_filename) { if (qtest_enabled()) { return; } fprintf(stderr, "Kernel image must be specified\n"); exit(1); } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (kernel_size < 0) { kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL, NULL, NULL); } if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR, ram_size - KERNEL_LOAD_ADDR); entry = KERNEL_LOAD_ADDR; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } env->pc = entry; }
true
qemu
4482e05cbbb7e50e476f6a9500cf0b38913bd939
static void an5206_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; M68kCPU *cpu; CPUM68KState *env; int kernel_size; uint64_t elf_entry; hwaddr entry; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); if (!cpu_model) { cpu_model = "m5206"; } cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model)); if (!cpu) { error_report("Unable to find m68k CPU definition"); exit(1); } env = &cpu->env; env->vbr = 0; env->mbar = AN5206_MBAR_ADDR | 1; env->rambar0 = AN5206_RAMBAR_ADDR | 1; memory_region_allocate_system_memory(ram, NULL, "an5206.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal); memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram); mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, cpu); if (!kernel_filename) { if (qtest_enabled()) { return; } fprintf(stderr, "Kernel image must be specified\n"); exit(1); } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (kernel_size < 0) { kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL, NULL, NULL); } if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR, ram_size - KERNEL_LOAD_ADDR); entry = KERNEL_LOAD_ADDR; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } env->pc = entry; }
{ "code": [ " if (!cpu) {", " exit(1);", " if (!cpu) {", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " if (!cpu) {", " error_report(\"Unable to find m68k CPU definition\");", " exit(1);", " if (!cpu) {", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " if (!cpu) {", " exit(1);", " exit(1);", " exit(1);", " if (!cpu) {", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " if (!cpu) {", " exit(1);", " if (!cpu) {", " exit(1);", " if (!cpu) {" ], "line_no": [ 37, 41, 37, 41, 41, 41, 41, 41, 41, 41, 41, 41, 37, 39, 41, 37, 41, 41, 41, 41, 41, 37, 41, 41, 41, 37, 41, 41, 41, 41, 41, 41, 41, 37, 41, 37, 41, 37 ] }
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; M68kCPU *cpu; CPUM68KState *env; int VAR_3; uint64_t elf_entry; hwaddr entry; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); if (!VAR_1) { VAR_1 = "m5206"; } cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, VAR_1)); if (!cpu) { error_report("Unable to find m68k CPU definition"); exit(1); } env = &cpu->env; env->vbr = 0; env->mbar = AN5206_MBAR_ADDR | 1; env->rambar0 = AN5206_RAMBAR_ADDR | 1; memory_region_allocate_system_memory(ram, NULL, "an5206.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal); memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram); mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, cpu); if (!VAR_2) { if (qtest_enabled()) { return; } fprintf(stderr, "Kernel image must be specified\n"); exit(1); } VAR_3 = load_elf(VAR_2, NULL, NULL, &elf_entry, NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (VAR_3 < 0) { VAR_3 = load_uimage(VAR_2, &entry, NULL, NULL, NULL, NULL); } if (VAR_3 < 0) { VAR_3 = load_image_targphys(VAR_2, KERNEL_LOAD_ADDR, ram_size - KERNEL_LOAD_ADDR); entry = KERNEL_LOAD_ADDR; } if (VAR_3 < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_2); exit(1); } env->pc = entry; }
[ "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;", "M68kCPU *cpu;", "CPUM68KState *env;", "int VAR_3;", "uint64_t elf_entry;", "hwaddr entry;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "MemoryRegion *sram = g_new(MemoryRegion, 1);", "if (!VAR_1) {", "VAR_1 = \"m5206\";", "}", "cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, VAR_1));", "if (!cpu) {", "error_report(\"Unable to find m68k CPU definition\");", "exit(1);", "}", "env = &cpu->env;", "env->vbr = 0;", "env->mbar = AN5206_MBAR_ADDR | 1;", "env->rambar0 = AN5206_RAMBAR_ADDR | 1;", "memory_region_allocate_system_memory(ram, NULL, \"an5206.ram\", ram_size);", "memory_region_add_subregion(address_space_mem, 0, ram);", "memory_region_init_ram(sram, NULL, \"an5206.sram\", 512, &error_fatal);", "memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);", "mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, cpu);", "if (!VAR_2) {", "if (qtest_enabled()) {", "return;", "}", "fprintf(stderr, \"Kernel image must be specified\\n\");", "exit(1);", "}", "VAR_3 = load_elf(VAR_2, NULL, NULL, &elf_entry,\nNULL, NULL, 1, EM_68K, 0, 0);", "entry = elf_entry;", "if (VAR_3 < 0) {", "VAR_3 = load_uimage(VAR_2, &entry, NULL, NULL,\nNULL, NULL);", "}", "if (VAR_3 < 0) {", "VAR_3 = load_image_targphys(VAR_2, KERNEL_LOAD_ADDR,\nram_size - KERNEL_LOAD_ADDR);", "entry = KERNEL_LOAD_ADDR;", "}", "if (VAR_3 < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\", VAR_2);", "exit(1);", "}", "env->pc = entry;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
4,046
static int mv_read_header(AVFormatContext *avctx) { MvContext *mv = avctx->priv_data; AVIOContext *pb = avctx->pb; AVStream *ast = NULL, *vst = NULL; //initialization to suppress warning int version, i; avio_skip(pb, 4); version = avio_rb16(pb); if (version == 2) { uint64_t timestamp; int v; avio_skip(pb, 22); /* allocate audio track first to prevent unnecessary seeking (audio packet always precede video packet for a given frame) */ ast = avformat_new_stream(avctx, NULL); if (!ast) return AVERROR(ENOMEM); vst = avformat_new_stream(avctx, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->time_base = (AVRational){1, 15}; vst->nb_frames = avio_rb32(pb); v = avio_rb32(pb); switch (v) { case 1: vst->codec->codec_id = AV_CODEC_ID_MVC1; break; case 2: vst->codec->pix_fmt = AV_PIX_FMT_ARGB; vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO; break; default: av_log_ask_for_sample(avctx, "unknown video compression %i\n", v); break; } vst->codec->codec_tag = 0; vst->codec->width = avio_rb32(pb); vst->codec->height = avio_rb32(pb); avio_skip(pb, 12); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->nb_frames = vst->nb_frames; ast->codec->sample_rate = avio_rb32(pb); avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate); ast->codec->channels = avio_rb32(pb); ast->codec->channel_layout = (ast->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; v = avio_rb32(pb); if (v == AUDIO_FORMAT_SIGNED) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { av_log_ask_for_sample(avctx, "unknown audio compression (format %i)\n", v); } avio_skip(pb, 12); var_read_metadata(avctx, "title", 0x80); var_read_metadata(avctx, "comment", 0x100); avio_skip(pb, 0x80); timestamp = 0; for (i = 0; i < vst->nb_frames; i++) { uint32_t pos = avio_rb32(pb); uint32_t asize = avio_rb32(pb); uint32_t vsize = avio_rb32(pb); avio_skip(pb, 8); av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME); av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME); timestamp += asize / (ast->codec->channels * 2); } } else if (!version && avio_rb16(pb) == 3) { avio_skip(pb, 4); read_table(avctx, NULL, parse_global_var); if (mv->nb_audio_tracks > 1) { av_log_ask_for_sample(avctx, "multiple audio streams\n"); return AVERROR_PATCHWELCOME; } else if (mv->nb_audio_tracks) { ast = avformat_new_stream(avctx, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; /* temporarily store compression value in codec_tag; format value in codec_id */ read_table(avctx, ast, parse_audio_var); if (ast->codec->codec_tag == 100 && ast->codec->codec_id == AUDIO_FORMAT_SIGNED && ast->codec->bits_per_coded_sample == 16) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { av_log_ask_for_sample(avctx, "unknown audio compression %i (format %i, width %i)\n", ast->codec->codec_tag, ast->codec->codec_id, ast->codec->bits_per_coded_sample); ast->codec->codec_id = AV_CODEC_ID_NONE; } ast->codec->codec_tag = 0; } if (mv->nb_video_tracks > 1) { av_log_ask_for_sample(avctx, "multiple video streams\n"); return AVERROR_PATCHWELCOME; } else if (mv->nb_video_tracks) { vst = avformat_new_stream(avctx, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; read_table(avctx, vst, parse_video_var); } if (mv->nb_audio_tracks) read_index(pb, ast); if (mv->nb_video_tracks) read_index(pb, vst); } else { av_log_ask_for_sample(avctx, "unknown version %i\n", version); return AVERROR_PATCHWELCOME; } return 0; }
true
FFmpeg
4c9f35bb7c94d20455d3fca3a184b892f1a0aa4e
static int mv_read_header(AVFormatContext *avctx) { MvContext *mv = avctx->priv_data; AVIOContext *pb = avctx->pb; AVStream *ast = NULL, *vst = NULL; int version, i; avio_skip(pb, 4); version = avio_rb16(pb); if (version == 2) { uint64_t timestamp; int v; avio_skip(pb, 22); ast = avformat_new_stream(avctx, NULL); if (!ast) return AVERROR(ENOMEM); vst = avformat_new_stream(avctx, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->time_base = (AVRational){1, 15}; vst->nb_frames = avio_rb32(pb); v = avio_rb32(pb); switch (v) { case 1: vst->codec->codec_id = AV_CODEC_ID_MVC1; break; case 2: vst->codec->pix_fmt = AV_PIX_FMT_ARGB; vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO; break; default: av_log_ask_for_sample(avctx, "unknown video compression %i\n", v); break; } vst->codec->codec_tag = 0; vst->codec->width = avio_rb32(pb); vst->codec->height = avio_rb32(pb); avio_skip(pb, 12); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->nb_frames = vst->nb_frames; ast->codec->sample_rate = avio_rb32(pb); avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate); ast->codec->channels = avio_rb32(pb); ast->codec->channel_layout = (ast->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; v = avio_rb32(pb); if (v == AUDIO_FORMAT_SIGNED) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { av_log_ask_for_sample(avctx, "unknown audio compression (format %i)\n", v); } avio_skip(pb, 12); var_read_metadata(avctx, "title", 0x80); var_read_metadata(avctx, "comment", 0x100); avio_skip(pb, 0x80); timestamp = 0; for (i = 0; i < vst->nb_frames; i++) { uint32_t pos = avio_rb32(pb); uint32_t asize = avio_rb32(pb); uint32_t vsize = avio_rb32(pb); avio_skip(pb, 8); av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME); av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME); timestamp += asize / (ast->codec->channels * 2); } } else if (!version && avio_rb16(pb) == 3) { avio_skip(pb, 4); read_table(avctx, NULL, parse_global_var); if (mv->nb_audio_tracks > 1) { av_log_ask_for_sample(avctx, "multiple audio streams\n"); return AVERROR_PATCHWELCOME; } else if (mv->nb_audio_tracks) { ast = avformat_new_stream(avctx, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; read_table(avctx, ast, parse_audio_var); if (ast->codec->codec_tag == 100 && ast->codec->codec_id == AUDIO_FORMAT_SIGNED && ast->codec->bits_per_coded_sample == 16) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { av_log_ask_for_sample(avctx, "unknown audio compression %i (format %i, width %i)\n", ast->codec->codec_tag, ast->codec->codec_id, ast->codec->bits_per_coded_sample); ast->codec->codec_id = AV_CODEC_ID_NONE; } ast->codec->codec_tag = 0; } if (mv->nb_video_tracks > 1) { av_log_ask_for_sample(avctx, "multiple video streams\n"); return AVERROR_PATCHWELCOME; } else if (mv->nb_video_tracks) { vst = avformat_new_stream(avctx, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; read_table(avctx, vst, parse_video_var); } if (mv->nb_audio_tracks) read_index(pb, ast); if (mv->nb_video_tracks) read_index(pb, vst); } else { av_log_ask_for_sample(avctx, "unknown version %i\n", version); return AVERROR_PATCHWELCOME; } return 0; }
{ "code": [ " vst->time_base = (AVRational){1, 15};" ], "line_no": [ 51 ] }
static int FUNC_0(AVFormatContext *VAR_0) { MvContext *mv = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; AVStream *ast = NULL, *vst = NULL; int VAR_1, VAR_2; avio_skip(pb, 4); VAR_1 = avio_rb16(pb); if (VAR_1 == 2) { uint64_t timestamp; int VAR_3; avio_skip(pb, 22); ast = avformat_new_stream(VAR_0, NULL); if (!ast) return AVERROR(ENOMEM); vst = avformat_new_stream(VAR_0, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->time_base = (AVRational){1, 15}; vst->nb_frames = avio_rb32(pb); VAR_3 = avio_rb32(pb); switch (VAR_3) { case 1: vst->codec->codec_id = AV_CODEC_ID_MVC1; break; case 2: vst->codec->pix_fmt = AV_PIX_FMT_ARGB; vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO; break; default: av_log_ask_for_sample(VAR_0, "unknown video compression %VAR_2\n", VAR_3); break; } vst->codec->codec_tag = 0; vst->codec->width = avio_rb32(pb); vst->codec->height = avio_rb32(pb); avio_skip(pb, 12); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->nb_frames = vst->nb_frames; ast->codec->sample_rate = avio_rb32(pb); avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate); ast->codec->channels = avio_rb32(pb); ast->codec->channel_layout = (ast->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; VAR_3 = avio_rb32(pb); if (VAR_3 == AUDIO_FORMAT_SIGNED) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { av_log_ask_for_sample(VAR_0, "unknown audio compression (format %VAR_2)\n", VAR_3); } avio_skip(pb, 12); var_read_metadata(VAR_0, "title", 0x80); var_read_metadata(VAR_0, "comment", 0x100); avio_skip(pb, 0x80); timestamp = 0; for (VAR_2 = 0; VAR_2 < vst->nb_frames; VAR_2++) { uint32_t pos = avio_rb32(pb); uint32_t asize = avio_rb32(pb); uint32_t vsize = avio_rb32(pb); avio_skip(pb, 8); av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME); av_add_index_entry(vst, pos + asize, VAR_2, vsize, 0, AVINDEX_KEYFRAME); timestamp += asize / (ast->codec->channels * 2); } } else if (!VAR_1 && avio_rb16(pb) == 3) { avio_skip(pb, 4); read_table(VAR_0, NULL, parse_global_var); if (mv->nb_audio_tracks > 1) { av_log_ask_for_sample(VAR_0, "multiple audio streams\n"); return AVERROR_PATCHWELCOME; } else if (mv->nb_audio_tracks) { ast = avformat_new_stream(VAR_0, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; read_table(VAR_0, ast, parse_audio_var); if (ast->codec->codec_tag == 100 && ast->codec->codec_id == AUDIO_FORMAT_SIGNED && ast->codec->bits_per_coded_sample == 16) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { av_log_ask_for_sample(VAR_0, "unknown audio compression %VAR_2 (format %VAR_2, width %VAR_2)\n", ast->codec->codec_tag, ast->codec->codec_id, ast->codec->bits_per_coded_sample); ast->codec->codec_id = AV_CODEC_ID_NONE; } ast->codec->codec_tag = 0; } if (mv->nb_video_tracks > 1) { av_log_ask_for_sample(VAR_0, "multiple video streams\n"); return AVERROR_PATCHWELCOME; } else if (mv->nb_video_tracks) { vst = avformat_new_stream(VAR_0, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; read_table(VAR_0, vst, parse_video_var); } if (mv->nb_audio_tracks) read_index(pb, ast); if (mv->nb_video_tracks) read_index(pb, vst); } else { av_log_ask_for_sample(VAR_0, "unknown VAR_1 %VAR_2\n", VAR_1); return AVERROR_PATCHWELCOME; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "MvContext *mv = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "AVStream *ast = NULL, *vst = NULL;", "int VAR_1, VAR_2;", "avio_skip(pb, 4);", "VAR_1 = avio_rb16(pb);", "if (VAR_1 == 2) {", "uint64_t timestamp;", "int VAR_3;", "avio_skip(pb, 22);", "ast = avformat_new_stream(VAR_0, NULL);", "if (!ast)\nreturn AVERROR(ENOMEM);", "vst = avformat_new_stream(VAR_0, NULL);", "if (!vst)\nreturn AVERROR(ENOMEM);", "vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "vst->time_base = (AVRational){1, 15};", "vst->nb_frames = avio_rb32(pb);", "VAR_3 = avio_rb32(pb);", "switch (VAR_3) {", "case 1:\nvst->codec->codec_id = AV_CODEC_ID_MVC1;", "break;", "case 2:\nvst->codec->pix_fmt = AV_PIX_FMT_ARGB;", "vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;", "break;", "default:\nav_log_ask_for_sample(VAR_0, \"unknown video compression %VAR_2\\n\", VAR_3);", "break;", "}", "vst->codec->codec_tag = 0;", "vst->codec->width = avio_rb32(pb);", "vst->codec->height = avio_rb32(pb);", "avio_skip(pb, 12);", "ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "ast->nb_frames = vst->nb_frames;", "ast->codec->sample_rate = avio_rb32(pb);", "avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate);", "ast->codec->channels = avio_rb32(pb);", "ast->codec->channel_layout = (ast->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;", "VAR_3 = avio_rb32(pb);", "if (VAR_3 == AUDIO_FORMAT_SIGNED) {", "ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE;", "} else {", "av_log_ask_for_sample(VAR_0, \"unknown audio compression (format %VAR_2)\\n\", VAR_3);", "}", "avio_skip(pb, 12);", "var_read_metadata(VAR_0, \"title\", 0x80);", "var_read_metadata(VAR_0, \"comment\", 0x100);", "avio_skip(pb, 0x80);", "timestamp = 0;", "for (VAR_2 = 0; VAR_2 < vst->nb_frames; VAR_2++) {", "uint32_t pos = avio_rb32(pb);", "uint32_t asize = avio_rb32(pb);", "uint32_t vsize = avio_rb32(pb);", "avio_skip(pb, 8);", "av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);", "av_add_index_entry(vst, pos + asize, VAR_2, vsize, 0, AVINDEX_KEYFRAME);", "timestamp += asize / (ast->codec->channels * 2);", "}", "} else if (!VAR_1 && avio_rb16(pb) == 3) {", "avio_skip(pb, 4);", "read_table(VAR_0, NULL, parse_global_var);", "if (mv->nb_audio_tracks > 1) {", "av_log_ask_for_sample(VAR_0, \"multiple audio streams\\n\");", "return AVERROR_PATCHWELCOME;", "} else if (mv->nb_audio_tracks) {", "ast = avformat_new_stream(VAR_0, NULL);", "if (!ast)\nreturn AVERROR(ENOMEM);", "ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "read_table(VAR_0, ast, parse_audio_var);", "if (ast->codec->codec_tag == 100 && ast->codec->codec_id == AUDIO_FORMAT_SIGNED && ast->codec->bits_per_coded_sample == 16) {", "ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE;", "} else {", "av_log_ask_for_sample(VAR_0, \"unknown audio compression %VAR_2 (format %VAR_2, width %VAR_2)\\n\",\nast->codec->codec_tag, ast->codec->codec_id, ast->codec->bits_per_coded_sample);", "ast->codec->codec_id = AV_CODEC_ID_NONE;", "}", "ast->codec->codec_tag = 0;", "}", "if (mv->nb_video_tracks > 1) {", "av_log_ask_for_sample(VAR_0, \"multiple video streams\\n\");", "return AVERROR_PATCHWELCOME;", "} else if (mv->nb_video_tracks) {", "vst = avformat_new_stream(VAR_0, NULL);", "if (!vst)\nreturn AVERROR(ENOMEM);", "vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "read_table(VAR_0, vst, parse_video_var);", "}", "if (mv->nb_audio_tracks)\nread_index(pb, ast);", "if (mv->nb_video_tracks)\nread_index(pb, vst);", "} else {", "av_log_ask_for_sample(VAR_0, \"unknown VAR_1 %VAR_2\\n\", VAR_1);", "return AVERROR_PATCHWELCOME;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 35 ], [ 37, 39 ], [ 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 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219, 221 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ] ]
4,047
void qsb_free(QEMUSizedBuffer *qsb) { size_t i; if (!qsb) { return; } for (i = 0; i < qsb->n_iov; i++) { g_free(qsb->iov[i].iov_base); } g_free(qsb->iov); g_free(qsb); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
void qsb_free(QEMUSizedBuffer *qsb) { size_t i; if (!qsb) { return; } for (i = 0; i < qsb->n_iov; i++) { g_free(qsb->iov[i].iov_base); } g_free(qsb->iov); g_free(qsb); }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUSizedBuffer *VAR_0) { size_t i; if (!VAR_0) { return; } for (i = 0; i < VAR_0->n_iov; i++) { g_free(VAR_0->iov[i].iov_base); } g_free(VAR_0->iov); g_free(VAR_0); }
[ "void FUNC_0(QEMUSizedBuffer *VAR_0)\n{", "size_t i;", "if (!VAR_0) {", "return;", "}", "for (i = 0; i < VAR_0->n_iov; i++) {", "g_free(VAR_0->iov[i].iov_base);", "}", "g_free(VAR_0->iov);", "g_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
4,048
static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MPADecodeContext *s = avctx->priv_data; uint32_t header; int out_size; OUT_INT *out_samples = data; if(buf_size < HEADER_SIZE) return -1; header = AV_RB32(buf); if(ff_mpa_check_header(header) < 0){ av_log(avctx, AV_LOG_ERROR, "Header missing\n"); return -1; } if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { /* free format: prepare to compute frame size */ s->frame_size = -1; return -1; } /* update codec info */ avctx->channels = s->nb_channels; avctx->bit_rate = s->bit_rate; avctx->sub_id = s->layer; if(*data_size < 1152*avctx->channels*sizeof(OUT_INT)) return -1; if(s->frame_size<=0 || s->frame_size > buf_size){ av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); return -1; }else if(s->frame_size < buf_size){ av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n"); buf_size= s->frame_size; } out_size = mp_decode_frame(s, out_samples, buf, buf_size); if(out_size>=0){ *data_size = out_size; avctx->sample_rate = s->sample_rate; //FIXME maybe move the other codec info stuff from above here too }else av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed s->frame_size = 0; return buf_size; }
true
FFmpeg
45a014d75efd043aa432b87869f898e552cbbb75
static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MPADecodeContext *s = avctx->priv_data; uint32_t header; int out_size; OUT_INT *out_samples = data; if(buf_size < HEADER_SIZE) return -1; header = AV_RB32(buf); if(ff_mpa_check_header(header) < 0){ av_log(avctx, AV_LOG_ERROR, "Header missing\n"); return -1; } if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { s->frame_size = -1; return -1; } avctx->channels = s->nb_channels; avctx->bit_rate = s->bit_rate; avctx->sub_id = s->layer; if(*data_size < 1152*avctx->channels*sizeof(OUT_INT)) return -1; if(s->frame_size<=0 || s->frame_size > buf_size){ av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); return -1; }else if(s->frame_size < buf_size){ av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n"); buf_size= s->frame_size; } out_size = mp_decode_frame(s, out_samples, buf, buf_size); if(out_size>=0){ *data_size = out_size; avctx->sample_rate = s->sample_rate; }else av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); s->frame_size = 0; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; MPADecodeContext *s = VAR_0->priv_data; uint32_t header; int VAR_6; OUT_INT *out_samples = VAR_1; if(VAR_5 < HEADER_SIZE) return -1; header = AV_RB32(VAR_4); if(ff_mpa_check_header(header) < 0){ av_log(VAR_0, AV_LOG_ERROR, "Header missing\n"); return -1; } if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { s->frame_size = -1; return -1; } VAR_0->channels = s->nb_channels; VAR_0->bit_rate = s->bit_rate; VAR_0->sub_id = s->layer; if(*VAR_2 < 1152*VAR_0->channels*sizeof(OUT_INT)) return -1; if(s->frame_size<=0 || s->frame_size > VAR_5){ av_log(VAR_0, AV_LOG_ERROR, "incomplete frame\n"); return -1; }else if(s->frame_size < VAR_5){ av_log(VAR_0, AV_LOG_ERROR, "incorrect frame size\n"); VAR_5= s->frame_size; } VAR_6 = mp_decode_frame(s, out_samples, VAR_4, VAR_5); if(VAR_6>=0){ *VAR_2 = VAR_6; VAR_0->sample_rate = s->sample_rate; }else av_log(VAR_0, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); s->frame_size = 0; return VAR_5; }
[ "static int FUNC_0(AVCodecContext * VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MPADecodeContext *s = VAR_0->priv_data;", "uint32_t header;", "int VAR_6;", "OUT_INT *out_samples = VAR_1;", "if(VAR_5 < HEADER_SIZE)\nreturn -1;", "header = AV_RB32(VAR_4);", "if(ff_mpa_check_header(header) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"Header missing\\n\");", "return -1;", "}", "if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {", "s->frame_size = -1;", "return -1;", "}", "VAR_0->channels = s->nb_channels;", "VAR_0->bit_rate = s->bit_rate;", "VAR_0->sub_id = s->layer;", "if(*VAR_2 < 1152*VAR_0->channels*sizeof(OUT_INT))\nreturn -1;", "if(s->frame_size<=0 || s->frame_size > VAR_5){", "av_log(VAR_0, AV_LOG_ERROR, \"incomplete frame\\n\");", "return -1;", "}else if(s->frame_size < VAR_5){", "av_log(VAR_0, AV_LOG_ERROR, \"incorrect frame size\\n\");", "VAR_5= s->frame_size;", "}", "VAR_6 = mp_decode_frame(s, out_samples, VAR_4, VAR_5);", "if(VAR_6>=0){", "*VAR_2 = VAR_6;", "VAR_0->sample_rate = s->sample_rate;", "}else", "av_log(VAR_0, AV_LOG_DEBUG, \"Error while decoding MPEG audio frame.\\n\");", "s->frame_size = 0;", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 102 ] ]
4,049
static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory, hwaddr base, qemu_irq irq, omap_clk clk) { struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) g_malloc0(sizeof(struct omap_32khz_timer_s)); s->timer.irq = irq; s->timer.clk = clk; s->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &s->timer); omap_os_timer_reset(s); omap_timer_clk_setup(&s->timer); memory_region_init_io(&s->iomem, NULL, &omap_os_timer_ops, s, "omap-os-timer", 0x800); memory_region_add_subregion(memory, base, &s->iomem); return s; }
true
qemu
b45c03f585ea9bb1af76c73e82195418c294919d
static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory, hwaddr base, qemu_irq irq, omap_clk clk) { struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *) g_malloc0(sizeof(struct omap_32khz_timer_s)); s->timer.irq = irq; s->timer.clk = clk; s->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &s->timer); omap_os_timer_reset(s); omap_timer_clk_setup(&s->timer); memory_region_init_io(&s->iomem, NULL, &omap_os_timer_ops, s, "omap-os-timer", 0x800); memory_region_add_subregion(memory, base, &s->iomem); return s; }
{ "code": [ " struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *)", " g_malloc0(sizeof(struct omap_32khz_timer_s));" ], "line_no": [ 9, 11 ] }
static struct omap_32khz_timer_s *FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1, qemu_irq VAR_2, omap_clk VAR_3) { struct omap_32khz_timer_s *VAR_4 = (struct omap_32khz_timer_s *) g_malloc0(sizeof(struct omap_32khz_timer_s)); VAR_4->timer.VAR_2 = VAR_2; VAR_4->timer.VAR_3 = VAR_3; VAR_4->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &VAR_4->timer); omap_os_timer_reset(VAR_4); omap_timer_clk_setup(&VAR_4->timer); memory_region_init_io(&VAR_4->iomem, NULL, &omap_os_timer_ops, VAR_4, "omap-os-timer", 0x800); memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem); return VAR_4; }
[ "static struct omap_32khz_timer_s *FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nqemu_irq VAR_2, omap_clk VAR_3)\n{", "struct omap_32khz_timer_s *VAR_4 = (struct omap_32khz_timer_s *)\ng_malloc0(sizeof(struct omap_32khz_timer_s));", "VAR_4->timer.VAR_2 = VAR_2;", "VAR_4->timer.VAR_3 = VAR_3;", "VAR_4->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &VAR_4->timer);", "omap_os_timer_reset(VAR_4);", "omap_timer_clk_setup(&VAR_4->timer);", "memory_region_init_io(&VAR_4->iomem, NULL, &omap_os_timer_ops, VAR_4,\n\"omap-os-timer\", 0x800);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem);", "return VAR_4;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ] ]
4,050
static bool check_irqchip_in_kernel(void) { if (kvm_irqchip_in_kernel()) { return true; } error_report("pci-assign: error: requires KVM with in-kernel irqchip " "enabled"); return false; }
true
qemu
665f119fbad97c05c2603673ac6b2dcbf0d0e9e1
static bool check_irqchip_in_kernel(void) { if (kvm_irqchip_in_kernel()) { return true; } error_report("pci-assign: error: requires KVM with in-kernel irqchip " "enabled"); return false; }
{ "code": [ "static bool check_irqchip_in_kernel(void)", " return true;", " error_report(\"pci-assign: error: requires KVM with in-kernel irqchip \"", " \"enabled\");", " return false;" ], "line_no": [ 1, 7, 11, 13, 15 ] }
static bool FUNC_0(void) { if (kvm_irqchip_in_kernel()) { return true; } error_report("pci-assign: error: requires KVM with in-kernel irqchip " "enabled"); return false; }
[ "static bool FUNC_0(void)\n{", "if (kvm_irqchip_in_kernel()) {", "return true;", "}", "error_report(\"pci-assign: error: requires KVM with in-kernel irqchip \"\n\"enabled\");", "return false;", "}" ]
[ 1, 0, 1, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
4,051
static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num){ RateControlContext *rcc= &s->rc_context; AVCodecContext *a= s->avctx; double q, bits; const int pict_type= rce->new_pict_type; const double mb_num= s->mb_num; int i; double const_values[]={ M_PI, M_E, rce->i_tex_bits*rce->qscale, rce->p_tex_bits*rce->qscale, (rce->i_tex_bits + rce->p_tex_bits)*(double)rce->qscale, rce->mv_bits/mb_num, rce->pict_type == B_TYPE ? (rce->f_code + rce->b_code)*0.5 : rce->f_code, rce->i_count/mb_num, rce->mc_mb_var_sum/mb_num, rce->mb_var_sum/mb_num, rce->pict_type == I_TYPE, rce->pict_type == P_TYPE, rce->pict_type == B_TYPE, rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type], a->qcompress, /* rcc->last_qscale_for[I_TYPE], rcc->last_qscale_for[P_TYPE], rcc->last_qscale_for[B_TYPE], rcc->next_non_b_qscale,*/ rcc->i_cplx_sum[I_TYPE] / (double)rcc->frame_count[I_TYPE], rcc->i_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE], rcc->p_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE], rcc->p_cplx_sum[B_TYPE] / (double)rcc->frame_count[B_TYPE], (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], 0 }; bits= ff_parse_eval(rcc->rc_eq_eval, const_values, rce); if (isnan(bits)) { av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq); return -1; } rcc->pass1_rc_eq_output_sum+= bits; bits*=rate_factor; if(bits<0.0) bits=0.0; bits+= 1.0; //avoid 1/0 issues /* user override */ for(i=0; i<s->avctx->rc_override_count; i++){ RcOverride *rco= s->avctx->rc_override; if(rco[i].start_frame > frame_num) continue; if(rco[i].end_frame < frame_num) continue; if(rco[i].qscale) bits= qp2bits(rce, rco[i].qscale); //FIXME move at end to really force it? else bits*= rco[i].quality_factor; } q= bits2qp(rce, bits); /* I/B difference */ if (pict_type==I_TYPE && s->avctx->i_quant_factor<0.0) q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset; else if(pict_type==B_TYPE && s->avctx->b_quant_factor<0.0) q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset; return q; }
true
FFmpeg
2711cb28f46463760f0326d806fe5ef9551ade2c
static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num){ RateControlContext *rcc= &s->rc_context; AVCodecContext *a= s->avctx; double q, bits; const int pict_type= rce->new_pict_type; const double mb_num= s->mb_num; int i; double const_values[]={ M_PI, M_E, rce->i_tex_bits*rce->qscale, rce->p_tex_bits*rce->qscale, (rce->i_tex_bits + rce->p_tex_bits)*(double)rce->qscale, rce->mv_bits/mb_num, rce->pict_type == B_TYPE ? (rce->f_code + rce->b_code)*0.5 : rce->f_code, rce->i_count/mb_num, rce->mc_mb_var_sum/mb_num, rce->mb_var_sum/mb_num, rce->pict_type == I_TYPE, rce->pict_type == P_TYPE, rce->pict_type == B_TYPE, rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type], a->qcompress, rcc->i_cplx_sum[I_TYPE] / (double)rcc->frame_count[I_TYPE], rcc->i_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE], rcc->p_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE], rcc->p_cplx_sum[B_TYPE] / (double)rcc->frame_count[B_TYPE], (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], 0 }; bits= ff_parse_eval(rcc->rc_eq_eval, const_values, rce); if (isnan(bits)) { av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq); return -1; } rcc->pass1_rc_eq_output_sum+= bits; bits*=rate_factor; if(bits<0.0) bits=0.0; bits+= 1.0; for(i=0; i<s->avctx->rc_override_count; i++){ RcOverride *rco= s->avctx->rc_override; if(rco[i].start_frame > frame_num) continue; if(rco[i].end_frame < frame_num) continue; if(rco[i].qscale) bits= qp2bits(rce, rco[i].qscale); else bits*= rco[i].quality_factor; } q= bits2qp(rce, bits); if (pict_type==I_TYPE && s->avctx->i_quant_factor<0.0) q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset; else if(pict_type==B_TYPE && s->avctx->b_quant_factor<0.0) q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset; return q; }
{ "code": [], "line_no": [] }
static double FUNC_0(MpegEncContext *VAR_0, RateControlEntry *VAR_1, double VAR_2, int VAR_3){ RateControlContext *rcc= &VAR_0->rc_context; AVCodecContext *a= VAR_0->avctx; double VAR_4, VAR_5; const int VAR_6= VAR_1->new_pict_type; const double VAR_7= VAR_0->VAR_7; int VAR_8; double VAR_9[]={ M_PI, M_E, VAR_1->i_tex_bits*VAR_1->qscale, VAR_1->p_tex_bits*VAR_1->qscale, (VAR_1->i_tex_bits + VAR_1->p_tex_bits)*(double)VAR_1->qscale, VAR_1->mv_bits/VAR_7, VAR_1->VAR_6 == B_TYPE ? (VAR_1->f_code + VAR_1->b_code)*0.5 : VAR_1->f_code, VAR_1->i_count/VAR_7, VAR_1->mc_mb_var_sum/VAR_7, VAR_1->mb_var_sum/VAR_7, VAR_1->VAR_6 == I_TYPE, VAR_1->VAR_6 == P_TYPE, VAR_1->VAR_6 == B_TYPE, rcc->qscale_sum[VAR_6] / (double)rcc->frame_count[VAR_6], a->qcompress, rcc->i_cplx_sum[I_TYPE] / (double)rcc->frame_count[I_TYPE], rcc->i_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE], rcc->p_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE], rcc->p_cplx_sum[B_TYPE] / (double)rcc->frame_count[B_TYPE], (rcc->i_cplx_sum[VAR_6] + rcc->p_cplx_sum[VAR_6]) / (double)rcc->frame_count[VAR_6], 0 }; VAR_5= ff_parse_eval(rcc->rc_eq_eval, VAR_9, VAR_1); if (isnan(VAR_5)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%VAR_0\"\n", VAR_0->avctx->rc_eq); return -1; } rcc->pass1_rc_eq_output_sum+= VAR_5; VAR_5*=VAR_2; if(VAR_5<0.0) VAR_5=0.0; VAR_5+= 1.0; for(VAR_8=0; VAR_8<VAR_0->avctx->rc_override_count; VAR_8++){ RcOverride *rco= VAR_0->avctx->rc_override; if(rco[VAR_8].start_frame > VAR_3) continue; if(rco[VAR_8].end_frame < VAR_3) continue; if(rco[VAR_8].qscale) VAR_5= qp2bits(VAR_1, rco[VAR_8].qscale); else VAR_5*= rco[VAR_8].quality_factor; } VAR_4= bits2qp(VAR_1, VAR_5); if (VAR_6==I_TYPE && VAR_0->avctx->i_quant_factor<0.0) VAR_4= -VAR_4*VAR_0->avctx->i_quant_factor + VAR_0->avctx->i_quant_offset; else if(VAR_6==B_TYPE && VAR_0->avctx->b_quant_factor<0.0) VAR_4= -VAR_4*VAR_0->avctx->b_quant_factor + VAR_0->avctx->b_quant_offset; return VAR_4; }
[ "static double FUNC_0(MpegEncContext *VAR_0, RateControlEntry *VAR_1, double VAR_2, int VAR_3){", "RateControlContext *rcc= &VAR_0->rc_context;", "AVCodecContext *a= VAR_0->avctx;", "double VAR_4, VAR_5;", "const int VAR_6= VAR_1->new_pict_type;", "const double VAR_7= VAR_0->VAR_7;", "int VAR_8;", "double VAR_9[]={", "M_PI,\nM_E,\nVAR_1->i_tex_bits*VAR_1->qscale,\nVAR_1->p_tex_bits*VAR_1->qscale,\n(VAR_1->i_tex_bits + VAR_1->p_tex_bits)*(double)VAR_1->qscale,\nVAR_1->mv_bits/VAR_7,\nVAR_1->VAR_6 == B_TYPE ? (VAR_1->f_code + VAR_1->b_code)*0.5 : VAR_1->f_code,\nVAR_1->i_count/VAR_7,\nVAR_1->mc_mb_var_sum/VAR_7,\nVAR_1->mb_var_sum/VAR_7,\nVAR_1->VAR_6 == I_TYPE,\nVAR_1->VAR_6 == P_TYPE,\nVAR_1->VAR_6 == B_TYPE,\nrcc->qscale_sum[VAR_6] / (double)rcc->frame_count[VAR_6],\na->qcompress,\nrcc->i_cplx_sum[I_TYPE] / (double)rcc->frame_count[I_TYPE],\nrcc->i_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE],\nrcc->p_cplx_sum[P_TYPE] / (double)rcc->frame_count[P_TYPE],\nrcc->p_cplx_sum[B_TYPE] / (double)rcc->frame_count[B_TYPE],\n(rcc->i_cplx_sum[VAR_6] + rcc->p_cplx_sum[VAR_6]) / (double)rcc->frame_count[VAR_6],\n0\n};", "VAR_5= ff_parse_eval(rcc->rc_eq_eval, VAR_9, VAR_1);", "if (isnan(VAR_5)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error evaluating rc_eq \\\"%VAR_0\\\"\\n\", VAR_0->avctx->rc_eq);", "return -1;", "}", "rcc->pass1_rc_eq_output_sum+= VAR_5;", "VAR_5*=VAR_2;", "if(VAR_5<0.0) VAR_5=0.0;", "VAR_5+= 1.0;", "for(VAR_8=0; VAR_8<VAR_0->avctx->rc_override_count; VAR_8++){", "RcOverride *rco= VAR_0->avctx->rc_override;", "if(rco[VAR_8].start_frame > VAR_3) continue;", "if(rco[VAR_8].end_frame < VAR_3) continue;", "if(rco[VAR_8].qscale)\nVAR_5= qp2bits(VAR_1, rco[VAR_8].qscale);", "else\nVAR_5*= rco[VAR_8].quality_factor;", "}", "VAR_4= bits2qp(VAR_1, VAR_5);", "if (VAR_6==I_TYPE && VAR_0->avctx->i_quant_factor<0.0)\nVAR_4= -VAR_4*VAR_0->avctx->i_quant_factor + VAR_0->avctx->i_quant_offset;", "else if(VAR_6==B_TYPE && VAR_0->avctx->b_quant_factor<0.0)\nVAR_4= -VAR_4*VAR_0->avctx->b_quant_factor + VAR_0->avctx->b_quant_offset;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 57, 59, 61, 63, 65, 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 119 ], [ 125, 127 ], [ 129, 131 ], [ 136 ], [ 138 ] ]
4,052
static int hpet_start_timer(struct qemu_alarm_timer *t) { struct hpet_info info; int r, fd; fd = open("/dev/hpet", O_RDONLY); if (fd < 0) return -1; /* Set frequency */ r = ioctl(fd, HPET_IRQFREQ, RTC_FREQ); if (r < 0) { fprintf(stderr, "Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal\n" "error, but for better emulation accuracy type:\n" "'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.\n"); goto fail; } /* Check capabilities */ r = ioctl(fd, HPET_INFO, &info); if (r < 0) goto fail; /* Enable periodic mode */ r = ioctl(fd, HPET_EPI, 0); if (info.hi_flags && (r < 0)) goto fail; /* Enable interrupt */ r = ioctl(fd, HPET_IE_ON, 0); if (r < 0) goto fail; enable_sigio_timer(fd); t->priv = (void *)(long)fd; return 0; fail: close(fd); return -1; }
true
qemu
40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4
static int hpet_start_timer(struct qemu_alarm_timer *t) { struct hpet_info info; int r, fd; fd = open("/dev/hpet", O_RDONLY); if (fd < 0) return -1; r = ioctl(fd, HPET_IRQFREQ, RTC_FREQ); if (r < 0) { fprintf(stderr, "Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal\n" "error, but for better emulation accuracy type:\n" "'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.\n"); goto fail; } r = ioctl(fd, HPET_INFO, &info); if (r < 0) goto fail; r = ioctl(fd, HPET_EPI, 0); if (info.hi_flags && (r < 0)) goto fail; r = ioctl(fd, HPET_IE_ON, 0); if (r < 0) goto fail; enable_sigio_timer(fd); t->priv = (void *)(long)fd; return 0; fail: close(fd); return -1; }
{ "code": [ " fd = open(\"/dev/hpet\", O_RDONLY);" ], "line_no": [ 11 ] }
static int FUNC_0(struct qemu_alarm_timer *VAR_0) { struct hpet_info VAR_1; int VAR_2, VAR_3; VAR_3 = open("/dev/hpet", O_RDONLY); if (VAR_3 < 0) return -1; VAR_2 = ioctl(VAR_3, HPET_IRQFREQ, RTC_FREQ); if (VAR_2 < 0) { fprintf(stderr, "Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal\n" "error, but for better emulation accuracy type:\n" "'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.\n"); goto fail; } VAR_2 = ioctl(VAR_3, HPET_INFO, &VAR_1); if (VAR_2 < 0) goto fail; VAR_2 = ioctl(VAR_3, HPET_EPI, 0); if (VAR_1.hi_flags && (VAR_2 < 0)) goto fail; VAR_2 = ioctl(VAR_3, HPET_IE_ON, 0); if (VAR_2 < 0) goto fail; enable_sigio_timer(VAR_3); VAR_0->priv = (void *)(long)VAR_3; return 0; fail: close(VAR_3); return -1; }
[ "static int FUNC_0(struct qemu_alarm_timer *VAR_0)\n{", "struct hpet_info VAR_1;", "int VAR_2, VAR_3;", "VAR_3 = open(\"/dev/hpet\", O_RDONLY);", "if (VAR_3 < 0)\nreturn -1;", "VAR_2 = ioctl(VAR_3, HPET_IRQFREQ, RTC_FREQ);", "if (VAR_2 < 0) {", "fprintf(stderr, \"Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal\\n\"\n\"error, but for better emulation accuracy type:\\n\"\n\"'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.\\n\");", "goto fail;", "}", "VAR_2 = ioctl(VAR_3, HPET_INFO, &VAR_1);", "if (VAR_2 < 0)\ngoto fail;", "VAR_2 = ioctl(VAR_3, HPET_EPI, 0);", "if (VAR_1.hi_flags && (VAR_2 < 0))\ngoto fail;", "VAR_2 = ioctl(VAR_3, HPET_IE_ON, 0);", "if (VAR_2 < 0)\ngoto fail;", "enable_sigio_timer(VAR_3);", "VAR_0->priv = (void *)(long)VAR_3;", "return 0;", "fail:\nclose(VAR_3);", "return -1;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41, 43 ], [ 49 ], [ 51, 53 ], [ 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ] ]
4,053
static void cmd_read_cd(IDEState *s, uint8_t* buf) { int nb_sectors, lba, transfer_request; nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8]; lba = ube32_to_cpu(buf + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(s); return; } transfer_request = buf[9]; switch(transfer_request & 0xf8) { case 0x00: /* nothing */ ide_atapi_cmd_ok(s); break; case 0x10: /* normal read */ ide_atapi_cmd_read(s, lba, nb_sectors, 2048); break; case 0xf8: /* read all data */ ide_atapi_cmd_read(s, lba, nb_sectors, 2352); break; default: ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET); break; } }
true
qemu
e7bd708ec85e40fd51569bb90c52d6613ffd8f45
static void cmd_read_cd(IDEState *s, uint8_t* buf) { int nb_sectors, lba, transfer_request; nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8]; lba = ube32_to_cpu(buf + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(s); return; } transfer_request = buf[9]; switch(transfer_request & 0xf8) { case 0x00: ide_atapi_cmd_ok(s); break; case 0x10: ide_atapi_cmd_read(s, lba, nb_sectors, 2048); break; case 0xf8: ide_atapi_cmd_read(s, lba, nb_sectors, 2352); break; default: ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET); break; } }
{ "code": [ " transfer_request = buf[9];", " switch(transfer_request & 0xf8) {", " case 0x00:", " break;" ], "line_no": [ 25, 27, 29, 35 ] }
static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1) { int VAR_2, VAR_3, VAR_4; VAR_2 = (VAR_1[6] << 16) | (VAR_1[7] << 8) | VAR_1[8]; VAR_3 = ube32_to_cpu(VAR_1 + 2); if (VAR_2 == 0) { ide_atapi_cmd_ok(VAR_0); return; } VAR_4 = VAR_1[9]; switch(VAR_4 & 0xf8) { case 0x00: ide_atapi_cmd_ok(VAR_0); break; case 0x10: ide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2048); break; case 0xf8: ide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2352); break; default: ide_atapi_cmd_error(VAR_0, ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET); break; } }
[ "static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "VAR_2 = (VAR_1[6] << 16) | (VAR_1[7] << 8) | VAR_1[8];", "VAR_3 = ube32_to_cpu(VAR_1 + 2);", "if (VAR_2 == 0) {", "ide_atapi_cmd_ok(VAR_0);", "return;", "}", "VAR_4 = VAR_1[9];", "switch(VAR_4 & 0xf8) {", "case 0x00:\nide_atapi_cmd_ok(VAR_0);", "break;", "case 0x10:\nide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2048);", "break;", "case 0xf8:\nide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2352);", "break;", "default:\nide_atapi_cmd_error(VAR_0, ILLEGAL_REQUEST,\nASC_INV_FIELD_IN_CMD_PACKET);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 33 ], [ 35 ], [ 37, 41 ], [ 43 ], [ 45, 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ] ]
4,054
static const char *srt_to_ass(AVCodecContext *avctx, char *out, char *out_end, const char *in, int x1, int y1, int x2, int y2) { char c, *param, buffer[128], tmp[128]; int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0; SrtStack stack[16]; stack[0].tag[0] = 0; strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); if (x1 >= 0 && y1 >= 0) { if (x2 >= 0 && y2 >= 0 && (x2 != x1 || y2 != y1)) out += snprintf(out, out_end-out, "{\\an1}{\\move(%d,%d,%d,%d)}", x1, y1, x2, y2); else out += snprintf(out, out_end-out, "{\\an1}{\\pos(%d,%d)}", x1, y1); } for (; out < out_end && !end && *in; in++) { switch (*in) { case '\r': break; case '\n': if (line_start) { end = 1; break; } while (out[-1] == ' ') out--; out += snprintf(out, out_end-out, "\\N"); line_start = 1; break; case ' ': if (!line_start) *out++ = *in; break; case '{': /* skip all {\xxx} substrings except for {\an%d} and all microdvd like styles such as {Y:xxx} */ an += sscanf(in, "{\\an%*1u}%c", &c) == 1; if ((an != 1 && sscanf(in, "{\\%*[^}]}%n%c", &len, &c) > 0) || sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n%c", &len, &c) > 0) { in += len - 1; } else *out++ = *in; break; case '<': tag_close = in[1] == '/'; if (sscanf(in+tag_close+1, "%127[^>]>%n%c", buffer, &len,&c) >= 2) { if ((param = strchr(buffer, ' '))) *param++ = 0; if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || ( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, buffer))) { int i, j, unknown = 0; in += len + tag_close; if (!tag_close) memset(stack+sptr, 0, sizeof(*stack)); if (!strcmp(buffer, "font")) { if (tag_close) { for (i=PARAM_NUMBER-1; i>=0; i--) if (stack[sptr-1].param[i][0]) for (j=sptr-2; j>=0; j--) if (stack[j].param[i][0]) { out += snprintf(out, out_end-out, stack[j].param[i]); break; } } else { while (param) { if (!strncmp(param, "size=", 5)) { unsigned font_size; param += 5 + (param[5] == '"'); if (sscanf(param, "%u", &font_size) == 1) { snprintf(stack[sptr].param[PARAM_SIZE], sizeof(stack[0].param[PARAM_SIZE]), "{\\fs%u}", font_size); } } else if (!strncmp(param, "color=", 6)) { param += 6 + (param[6] == '"'); snprintf(stack[sptr].param[PARAM_COLOR], sizeof(stack[0].param[PARAM_COLOR]), "{\\c&H%X&}", html_color_parse(avctx, param)); } else if (!strncmp(param, "face=", 5)) { param += 5 + (param[5] == '"'); len = strcspn(param, param[-1] == '"' ? "\"" :" "); av_strlcpy(tmp, param, FFMIN(sizeof(tmp), len+1)); param += len; snprintf(stack[sptr].param[PARAM_FACE], sizeof(stack[0].param[PARAM_FACE]), "{\\fn%s}", tmp); } if ((param = strchr(param, ' '))) param++; } for (i=0; i<PARAM_NUMBER; i++) if (stack[sptr].param[i][0]) out += snprintf(out, out_end-out, stack[sptr].param[i]); } } else if (!buffer[1] && strspn(buffer, "bisu") == 1) { out += snprintf(out, out_end-out, "{\\%c%d}", buffer[0], !tag_close); } else { unknown = 1; snprintf(tmp, sizeof(tmp), "</%s>", buffer); } if (tag_close) { sptr--; } else if (unknown && !strstr(in, tmp)) { in -= len + tag_close; *out++ = *in; } else av_strlcpy(stack[sptr++].tag, buffer, sizeof(stack[0].tag)); break; } } default: *out++ = *in; break; } if (*in != ' ' && *in != '\r' && *in != '\n') line_start = 0; } out = FFMIN(out, out_end-3); while (!strncmp(out-2, "\\N", 2)) out -= 2; while (out[-1] == ' ') out--; out += snprintf(out, out_end-out, "\r\n"); return in; }
true
FFmpeg
aaa1173de775b9b865a714abcc270816d2f59dff
static const char *srt_to_ass(AVCodecContext *avctx, char *out, char *out_end, const char *in, int x1, int y1, int x2, int y2) { char c, *param, buffer[128], tmp[128]; int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0; SrtStack stack[16]; stack[0].tag[0] = 0; strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); if (x1 >= 0 && y1 >= 0) { if (x2 >= 0 && y2 >= 0 && (x2 != x1 || y2 != y1)) out += snprintf(out, out_end-out, "{\\an1}{\\move(%d,%d,%d,%d)}", x1, y1, x2, y2); else out += snprintf(out, out_end-out, "{\\an1}{\\pos(%d,%d)}", x1, y1); } for (; out < out_end && !end && *in; in++) { switch (*in) { case '\r': break; case '\n': if (line_start) { end = 1; break; } while (out[-1] == ' ') out--; out += snprintf(out, out_end-out, "\\N"); line_start = 1; break; case ' ': if (!line_start) *out++ = *in; break; case '{': an += sscanf(in, "{\\an%*1u}%c", &c) == 1; if ((an != 1 && sscanf(in, "{\\%*[^}]}%n%c", &len, &c) > 0) || sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n%c", &len, &c) > 0) { in += len - 1; } else *out++ = *in; break; case '<': tag_close = in[1] == '/'; if (sscanf(in+tag_close+1, "%127[^>]>%n%c", buffer, &len,&c) >= 2) { if ((param = strchr(buffer, ' '))) *param++ = 0; if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || ( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, buffer))) { int i, j, unknown = 0; in += len + tag_close; if (!tag_close) memset(stack+sptr, 0, sizeof(*stack)); if (!strcmp(buffer, "font")) { if (tag_close) { for (i=PARAM_NUMBER-1; i>=0; i--) if (stack[sptr-1].param[i][0]) for (j=sptr-2; j>=0; j--) if (stack[j].param[i][0]) { out += snprintf(out, out_end-out, stack[j].param[i]); break; } } else { while (param) { if (!strncmp(param, "size=", 5)) { unsigned font_size; param += 5 + (param[5] == '"'); if (sscanf(param, "%u", &font_size) == 1) { snprintf(stack[sptr].param[PARAM_SIZE], sizeof(stack[0].param[PARAM_SIZE]), "{\\fs%u}", font_size); } } else if (!strncmp(param, "color=", 6)) { param += 6 + (param[6] == '"'); snprintf(stack[sptr].param[PARAM_COLOR], sizeof(stack[0].param[PARAM_COLOR]), "{\\c&H%X&}", html_color_parse(avctx, param)); } else if (!strncmp(param, "face=", 5)) { param += 5 + (param[5] == '"'); len = strcspn(param, param[-1] == '"' ? "\"" :" "); av_strlcpy(tmp, param, FFMIN(sizeof(tmp), len+1)); param += len; snprintf(stack[sptr].param[PARAM_FACE], sizeof(stack[0].param[PARAM_FACE]), "{\\fn%s}", tmp); } if ((param = strchr(param, ' '))) param++; } for (i=0; i<PARAM_NUMBER; i++) if (stack[sptr].param[i][0]) out += snprintf(out, out_end-out, stack[sptr].param[i]); } } else if (!buffer[1] && strspn(buffer, "bisu") == 1) { out += snprintf(out, out_end-out, "{\\%c%d}", buffer[0], !tag_close); } else { unknown = 1; snprintf(tmp, sizeof(tmp), "</%s>", buffer); } if (tag_close) { sptr--; } else if (unknown && !strstr(in, tmp)) { in -= len + tag_close; *out++ = *in; } else av_strlcpy(stack[sptr++].tag, buffer, sizeof(stack[0].tag)); break; } } default: *out++ = *in; break; } if (*in != ' ' && *in != '\r' && *in != '\n') line_start = 0; } out = FFMIN(out, out_end-3); while (!strncmp(out-2, "\\N", 2)) out -= 2; while (out[-1] == ' ') out--; out += snprintf(out, out_end-out, "\r\n"); return in; }
{ "code": [ " stack[j].param[i]);", " stack[sptr].param[i]);" ], "line_no": [ 131, 203 ] }
static const char *FUNC_0(AVCodecContext *VAR_0, char *VAR_1, char *VAR_2, const char *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { char VAR_8, *VAR_9, VAR_10[128], VAR_11[128]; int VAR_12, VAR_13, VAR_14 = 1, VAR_15 = 1, VAR_16 = 0, VAR_17 = 0; SrtStack stack[16]; stack[0].tag[0] = 0; strcpy(stack[0].VAR_9[PARAM_SIZE], "{\\fs}"); strcpy(stack[0].VAR_9[PARAM_COLOR], "{\\VAR_8}"); strcpy(stack[0].VAR_9[PARAM_FACE], "{\\fn}"); if (VAR_4 >= 0 && VAR_5 >= 0) { if (VAR_6 >= 0 && VAR_7 >= 0 && (VAR_6 != VAR_4 || VAR_7 != VAR_5)) VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, "{\\an1}{\\move(%d,%d,%d,%d)}", VAR_4, VAR_5, VAR_6, VAR_7); else VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, "{\\an1}{\\pos(%d,%d)}", VAR_4, VAR_5); } for (; VAR_1 < VAR_2 && !VAR_17 && *VAR_3; VAR_3++) { switch (*VAR_3) { case '\r': break; case '\n': if (VAR_15) { VAR_17 = 1; break; } while (VAR_1[-1] == ' ') VAR_1--; VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, "\\N"); VAR_15 = 1; break; case ' ': if (!VAR_15) *VAR_1++ = *VAR_3; break; case '{': VAR_16 += sscanf(VAR_3, "{\\VAR_16%*1u}%VAR_8", &VAR_8) == 1; if ((VAR_16 != 1 && sscanf(VAR_3, "{\\%*[^}]}%n%VAR_8", &VAR_12, &VAR_8) > 0) || sscanf(VAR_3, "{%*1[CcFfoPSsYy]:%*[^}]}%n%VAR_8", &VAR_12, &VAR_8) > 0) { VAR_3 += VAR_12 - 1; } else *VAR_1++ = *VAR_3; break; case '<': VAR_13 = VAR_3[1] == '/'; if (sscanf(VAR_3+VAR_13+1, "%127[^>]>%n%VAR_8", VAR_10, &VAR_12,&VAR_8) >= 2) { if ((VAR_9 = strchr(VAR_10, ' '))) *VAR_9++ = 0; if ((!VAR_13 && VAR_14 < FF_ARRAY_ELEMS(stack)) || ( VAR_13 && VAR_14 > 0 && !strcmp(stack[VAR_14-1].tag, VAR_10))) { int VAR_18, VAR_19, VAR_20 = 0; VAR_3 += VAR_12 + VAR_13; if (!VAR_13) memset(stack+VAR_14, 0, sizeof(*stack)); if (!strcmp(VAR_10, "font")) { if (VAR_13) { for (VAR_18=PARAM_NUMBER-1; VAR_18>=0; VAR_18--) if (stack[VAR_14-1].VAR_9[VAR_18][0]) for (VAR_19=VAR_14-2; VAR_19>=0; VAR_19--) if (stack[VAR_19].VAR_9[VAR_18][0]) { VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, stack[VAR_19].VAR_9[VAR_18]); break; } } else { while (VAR_9) { if (!strncmp(VAR_9, "size=", 5)) { unsigned VAR_21; VAR_9 += 5 + (VAR_9[5] == '"'); if (sscanf(VAR_9, "%u", &VAR_21) == 1) { snprintf(stack[VAR_14].VAR_9[PARAM_SIZE], sizeof(stack[0].VAR_9[PARAM_SIZE]), "{\\fs%u}", VAR_21); } } else if (!strncmp(VAR_9, "color=", 6)) { VAR_9 += 6 + (VAR_9[6] == '"'); snprintf(stack[VAR_14].VAR_9[PARAM_COLOR], sizeof(stack[0].VAR_9[PARAM_COLOR]), "{\\VAR_8&H%X&}", html_color_parse(VAR_0, VAR_9)); } else if (!strncmp(VAR_9, "face=", 5)) { VAR_9 += 5 + (VAR_9[5] == '"'); VAR_12 = strcspn(VAR_9, VAR_9[-1] == '"' ? "\"" :" "); av_strlcpy(VAR_11, VAR_9, FFMIN(sizeof(VAR_11), VAR_12+1)); VAR_9 += VAR_12; snprintf(stack[VAR_14].VAR_9[PARAM_FACE], sizeof(stack[0].VAR_9[PARAM_FACE]), "{\\fn%s}", VAR_11); } if ((VAR_9 = strchr(VAR_9, ' '))) VAR_9++; } for (VAR_18=0; VAR_18<PARAM_NUMBER; VAR_18++) if (stack[VAR_14].VAR_9[VAR_18][0]) VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, stack[VAR_14].VAR_9[VAR_18]); } } else if (!VAR_10[1] && strspn(VAR_10, "bisu") == 1) { VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, "{\\%VAR_8%d}", VAR_10[0], !VAR_13); } else { VAR_20 = 1; snprintf(VAR_11, sizeof(VAR_11), "</%s>", VAR_10); } if (VAR_13) { VAR_14--; } else if (VAR_20 && !strstr(VAR_3, VAR_11)) { VAR_3 -= VAR_12 + VAR_13; *VAR_1++ = *VAR_3; } else av_strlcpy(stack[VAR_14++].tag, VAR_10, sizeof(stack[0].tag)); break; } } default: *VAR_1++ = *VAR_3; break; } if (*VAR_3 != ' ' && *VAR_3 != '\r' && *VAR_3 != '\n') VAR_15 = 0; } VAR_1 = FFMIN(VAR_1, VAR_2-3); while (!strncmp(VAR_1-2, "\\N", 2)) VAR_1 -= 2; while (VAR_1[-1] == ' ') VAR_1--; VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, "\r\n"); return VAR_3; }
[ "static const char *FUNC_0(AVCodecContext *VAR_0, char *VAR_1, char *VAR_2,\nconst char *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7)\n{", "char VAR_8, *VAR_9, VAR_10[128], VAR_11[128];", "int VAR_12, VAR_13, VAR_14 = 1, VAR_15 = 1, VAR_16 = 0, VAR_17 = 0;", "SrtStack stack[16];", "stack[0].tag[0] = 0;", "strcpy(stack[0].VAR_9[PARAM_SIZE], \"{\\\\fs}\");", "strcpy(stack[0].VAR_9[PARAM_COLOR], \"{\\\\VAR_8}\");", "strcpy(stack[0].VAR_9[PARAM_FACE], \"{\\\\fn}\");", "if (VAR_4 >= 0 && VAR_5 >= 0) {", "if (VAR_6 >= 0 && VAR_7 >= 0 && (VAR_6 != VAR_4 || VAR_7 != VAR_5))\nVAR_1 += snprintf(VAR_1, VAR_2-VAR_1,\n\"{\\\\an1}{\\\\move(%d,%d,%d,%d)}\", VAR_4, VAR_5, VAR_6, VAR_7);", "else\nVAR_1 += snprintf(VAR_1, VAR_2-VAR_1, \"{\\\\an1}{\\\\pos(%d,%d)}\", VAR_4, VAR_5);", "}", "for (; VAR_1 < VAR_2 && !VAR_17 && *VAR_3; VAR_3++) {", "switch (*VAR_3) {", "case '\\r':\nbreak;", "case '\\n':\nif (VAR_15) {", "VAR_17 = 1;", "break;", "}", "while (VAR_1[-1] == ' ')\nVAR_1--;", "VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, \"\\\\N\");", "VAR_15 = 1;", "break;", "case ' ':\nif (!VAR_15)\n*VAR_1++ = *VAR_3;", "break;", "case '{':", "VAR_16 += sscanf(VAR_3, \"{\\\\VAR_16%*1u}%VAR_8\", &VAR_8) == 1;", "if ((VAR_16 != 1 && sscanf(VAR_3, \"{\\\\%*[^}]}%n%VAR_8\", &VAR_12, &VAR_8) > 0) ||", "sscanf(VAR_3, \"{%*1[CcFfoPSsYy]:%*[^}]}%n%VAR_8\", &VAR_12, &VAR_8) > 0) {", "VAR_3 += VAR_12 - 1;", "} else", "*VAR_1++ = *VAR_3;", "break;", "case '<':\nVAR_13 = VAR_3[1] == '/';", "if (sscanf(VAR_3+VAR_13+1, \"%127[^>]>%n%VAR_8\", VAR_10, &VAR_12,&VAR_8) >= 2) {", "if ((VAR_9 = strchr(VAR_10, ' ')))\n*VAR_9++ = 0;", "if ((!VAR_13 && VAR_14 < FF_ARRAY_ELEMS(stack)) ||\n( VAR_13 && VAR_14 > 0 && !strcmp(stack[VAR_14-1].tag, VAR_10))) {", "int VAR_18, VAR_19, VAR_20 = 0;", "VAR_3 += VAR_12 + VAR_13;", "if (!VAR_13)\nmemset(stack+VAR_14, 0, sizeof(*stack));", "if (!strcmp(VAR_10, \"font\")) {", "if (VAR_13) {", "for (VAR_18=PARAM_NUMBER-1; VAR_18>=0; VAR_18--)", "if (stack[VAR_14-1].VAR_9[VAR_18][0])\nfor (VAR_19=VAR_14-2; VAR_19>=0; VAR_19--)", "if (stack[VAR_19].VAR_9[VAR_18][0]) {", "VAR_1 += snprintf(VAR_1, VAR_2-VAR_1,\nstack[VAR_19].VAR_9[VAR_18]);", "break;", "}", "} else {", "while (VAR_9) {", "if (!strncmp(VAR_9, \"size=\", 5)) {", "unsigned VAR_21;", "VAR_9 += 5 + (VAR_9[5] == '\"');", "if (sscanf(VAR_9, \"%u\", &VAR_21) == 1) {", "snprintf(stack[VAR_14].VAR_9[PARAM_SIZE],\nsizeof(stack[0].VAR_9[PARAM_SIZE]),\n\"{\\\\fs%u}\", VAR_21);", "}", "} else if (!strncmp(VAR_9, \"color=\", 6)) {", "VAR_9 += 6 + (VAR_9[6] == '\"');", "snprintf(stack[VAR_14].VAR_9[PARAM_COLOR],\nsizeof(stack[0].VAR_9[PARAM_COLOR]),\n\"{\\\\VAR_8&H%X&}\",", "html_color_parse(VAR_0, VAR_9));", "} else if (!strncmp(VAR_9, \"face=\", 5)) {", "VAR_9 += 5 + (VAR_9[5] == '\"');", "VAR_12 = strcspn(VAR_9,\nVAR_9[-1] == '\"' ? \"\\\"\" :\" \");", "av_strlcpy(VAR_11, VAR_9,\nFFMIN(sizeof(VAR_11), VAR_12+1));", "VAR_9 += VAR_12;", "snprintf(stack[VAR_14].VAR_9[PARAM_FACE],\nsizeof(stack[0].VAR_9[PARAM_FACE]),\n\"{\\\\fn%s}\", VAR_11);", "}", "if ((VAR_9 = strchr(VAR_9, ' ')))\nVAR_9++;", "}", "for (VAR_18=0; VAR_18<PARAM_NUMBER; VAR_18++)", "if (stack[VAR_14].VAR_9[VAR_18][0])\nVAR_1 += snprintf(VAR_1, VAR_2-VAR_1,\nstack[VAR_14].VAR_9[VAR_18]);", "}", "} else if (!VAR_10[1] && strspn(VAR_10, \"bisu\") == 1) {", "VAR_1 += snprintf(VAR_1, VAR_2-VAR_1,\n\"{\\\\%VAR_8%d}\", VAR_10[0], !VAR_13);", "} else {", "VAR_20 = 1;", "snprintf(VAR_11, sizeof(VAR_11), \"</%s>\", VAR_10);", "}", "if (VAR_13) {", "VAR_14--;", "} else if (VAR_20 && !strstr(VAR_3, VAR_11)) {", "VAR_3 -= VAR_12 + VAR_13;", "*VAR_1++ = *VAR_3;", "} else", "av_strlcpy(stack[VAR_14++].tag, VAR_10,\nsizeof(stack[0].tag));", "break;", "}", "}", "default:\n*VAR_1++ = *VAR_3;", "break;", "}", "if (*VAR_3 != ' ' && *VAR_3 != '\\r' && *VAR_3 != '\\n')\nVAR_15 = 0;", "}", "VAR_1 = FFMIN(VAR_1, VAR_2-3);", "while (!strncmp(VAR_1-2, \"\\\\N\", 2))\nVAR_1 -= 2;", "while (VAR_1[-1] == ' ')\nVAR_1--;", "VAR_1 += snprintf(VAR_1, VAR_2-VAR_1, \"\\r\\n\");", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 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 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 259 ], [ 261, 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ] ]
4,055
void tcg_prologue_init(TCGContext *s) { /* init global prologue and epilogue */ s->code_buf = s->code_gen_prologue; s->code_ptr = s->code_buf; tcg_target_qemu_prologue(s); flush_icache_range((tcg_target_ulong)s->code_buf, (tcg_target_ulong)s->code_ptr);
true
qemu
d6b64b2b606fe0fe5f2208e84ff7a28445de666a
void tcg_prologue_init(TCGContext *s) { s->code_buf = s->code_gen_prologue; s->code_ptr = s->code_buf; tcg_target_qemu_prologue(s); flush_icache_range((tcg_target_ulong)s->code_buf, (tcg_target_ulong)s->code_ptr);
{ "code": [], "line_no": [] }
void FUNC_0(TCGContext *VAR_0) { VAR_0->code_buf = VAR_0->code_gen_prologue; VAR_0->code_ptr = VAR_0->code_buf; tcg_target_qemu_prologue(VAR_0); flush_icache_range((tcg_target_ulong)VAR_0->code_buf, (tcg_target_ulong)VAR_0->code_ptr);
[ "void FUNC_0(TCGContext *VAR_0)\n{", "VAR_0->code_buf = VAR_0->code_gen_prologue;", "VAR_0->code_ptr = VAR_0->code_buf;", "tcg_target_qemu_prologue(VAR_0);", "flush_icache_range((tcg_target_ulong)VAR_0->code_buf,\n(tcg_target_ulong)VAR_0->code_ptr);" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 4 ], [ 5 ], [ 6 ], [ 7, 8 ] ]
4,056
static int decode_slice(AVCodecContext *c, void *arg) { FFV1Context *fs = *(void **)arg; FFV1Context *f = fs->avctx->priv_data; int width, height, x, y, ret; const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR) ? (c->bits_per_raw_sample > 8) + 1 : 4; AVFrame *const p = f->cur; if (f->version > 2) { if (decode_slice_header(f, fs) < 0) { fs->slice_damaged = 1; return AVERROR_INVALIDDATA; } } if ((ret = ffv1_init_slice_state(f, fs)) < 0) return ret; if (f->cur->key_frame) ffv1_clear_slice_state(f, fs); width = fs->slice_width; height = fs->slice_height; x = fs->slice_x; y = fs->slice_y; if (!fs->ac) { if (f->version == 3 && f->minor_version > 1 || f->version > 3) get_rac(&fs->c, (uint8_t[]) { 129 }); fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0; init_get_bits(&fs->gb, fs->c.bytestream_start + fs->ac_byte_count, (fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count) * 8); } av_assert1(width && height); if (f->colorspace == 0) { const int chroma_width = -((-width) >> f->chroma_h_shift); const int chroma_height = -((-height) >> f->chroma_v_shift); const int cx = x >> f->chroma_h_shift; const int cy = y >> f->chroma_v_shift; decode_plane(fs, p->data[0] + ps * x + y * p->linesize[0], width, height, p->linesize[0], 0); if (f->chroma_planes) { decode_plane(fs, p->data[1] + ps * cx + cy * p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); decode_plane(fs, p->data[2] + ps * cx + cy * p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1); } if (fs->transparency) decode_plane(fs, p->data[3] + ps * x + y * p->linesize[3], width, height, p->linesize[3], 2); } else { uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0], p->data[1] + ps * x + y * p->linesize[1], p->data[2] + ps * x + y * p->linesize[2] }; decode_rgb_frame(fs, planes, width, height, p->linesize); } if (fs->ac && f->version > 2) { int v; get_rac(&fs->c, (uint8_t[]) { 129 }); v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5 * f->ec; if (v) { av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v); fs->slice_damaged = 1; } } emms_c(); return 0; }
false
FFmpeg
4bb1070c154e49d35805fbcdac9c9e92f702ef96
static int decode_slice(AVCodecContext *c, void *arg) { FFV1Context *fs = *(void **)arg; FFV1Context *f = fs->avctx->priv_data; int width, height, x, y, ret; const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR) ? (c->bits_per_raw_sample > 8) + 1 : 4; AVFrame *const p = f->cur; if (f->version > 2) { if (decode_slice_header(f, fs) < 0) { fs->slice_damaged = 1; return AVERROR_INVALIDDATA; } } if ((ret = ffv1_init_slice_state(f, fs)) < 0) return ret; if (f->cur->key_frame) ffv1_clear_slice_state(f, fs); width = fs->slice_width; height = fs->slice_height; x = fs->slice_x; y = fs->slice_y; if (!fs->ac) { if (f->version == 3 && f->minor_version > 1 || f->version > 3) get_rac(&fs->c, (uint8_t[]) { 129 }); fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0; init_get_bits(&fs->gb, fs->c.bytestream_start + fs->ac_byte_count, (fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count) * 8); } av_assert1(width && height); if (f->colorspace == 0) { const int chroma_width = -((-width) >> f->chroma_h_shift); const int chroma_height = -((-height) >> f->chroma_v_shift); const int cx = x >> f->chroma_h_shift; const int cy = y >> f->chroma_v_shift; decode_plane(fs, p->data[0] + ps * x + y * p->linesize[0], width, height, p->linesize[0], 0); if (f->chroma_planes) { decode_plane(fs, p->data[1] + ps * cx + cy * p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); decode_plane(fs, p->data[2] + ps * cx + cy * p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1); } if (fs->transparency) decode_plane(fs, p->data[3] + ps * x + y * p->linesize[3], width, height, p->linesize[3], 2); } else { uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0], p->data[1] + ps * x + y * p->linesize[1], p->data[2] + ps * x + y * p->linesize[2] }; decode_rgb_frame(fs, planes, width, height, p->linesize); } if (fs->ac && f->version > 2) { int v; get_rac(&fs->c, (uint8_t[]) { 129 }); v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5 * f->ec; if (v) { av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v); fs->slice_damaged = 1; } } emms_c(); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1) { FFV1Context *fs = *(void **)VAR_1; FFV1Context *f = fs->avctx->priv_data; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; const int VAR_7 = (av_pix_fmt_desc_get(VAR_0->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR) ? (VAR_0->bits_per_raw_sample > 8) + 1 : 4; AVFrame *const p = f->cur; if (f->version > 2) { if (decode_slice_header(f, fs) < 0) { fs->slice_damaged = 1; return AVERROR_INVALIDDATA; } } if ((VAR_6 = ffv1_init_slice_state(f, fs)) < 0) return VAR_6; if (f->cur->key_frame) ffv1_clear_slice_state(f, fs); VAR_2 = fs->slice_width; VAR_3 = fs->slice_height; VAR_4 = fs->slice_x; VAR_5 = fs->slice_y; if (!fs->ac) { if (f->version == 3 && f->minor_version > 1 || f->version > 3) get_rac(&fs->VAR_0, (uint8_t[]) { 129 }); fs->ac_byte_count = f->version > 2 || (!VAR_4 && !VAR_5) ? fs->VAR_0.bytestream - fs->VAR_0.bytestream_start - 1 : 0; init_get_bits(&fs->gb, fs->VAR_0.bytestream_start + fs->ac_byte_count, (fs->VAR_0.bytestream_end - fs->VAR_0.bytestream_start - fs->ac_byte_count) * 8); } av_assert1(VAR_2 && VAR_3); if (f->colorspace == 0) { const int VAR_8 = -((-VAR_2) >> f->chroma_h_shift); const int VAR_9 = -((-VAR_3) >> f->chroma_v_shift); const int VAR_10 = VAR_4 >> f->chroma_h_shift; const int VAR_11 = VAR_5 >> f->chroma_v_shift; decode_plane(fs, p->data[0] + VAR_7 * VAR_4 + VAR_5 * p->linesize[0], VAR_2, VAR_3, p->linesize[0], 0); if (f->chroma_planes) { decode_plane(fs, p->data[1] + VAR_7 * VAR_10 + VAR_11 * p->linesize[1], VAR_8, VAR_9, p->linesize[1], 1); decode_plane(fs, p->data[2] + VAR_7 * VAR_10 + VAR_11 * p->linesize[2], VAR_8, VAR_9, p->linesize[2], 1); } if (fs->transparency) decode_plane(fs, p->data[3] + VAR_7 * VAR_4 + VAR_5 * p->linesize[3], VAR_2, VAR_3, p->linesize[3], 2); } else { uint8_t *planes[3] = { p->data[0] + VAR_7 * VAR_4 + VAR_5 * p->linesize[0], p->data[1] + VAR_7 * VAR_4 + VAR_5 * p->linesize[1], p->data[2] + VAR_7 * VAR_4 + VAR_5 * p->linesize[2] }; decode_rgb_frame(fs, planes, VAR_2, VAR_3, p->linesize); } if (fs->ac && f->version > 2) { int VAR_12; get_rac(&fs->VAR_0, (uint8_t[]) { 129 }); VAR_12 = fs->VAR_0.bytestream_end - fs->VAR_0.bytestream - 2 - 5 * f->ec; if (VAR_12) { av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", VAR_12); fs->slice_damaged = 1; } } emms_c(); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1)\n{", "FFV1Context *fs = *(void **)VAR_1;", "FFV1Context *f = fs->avctx->priv_data;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "const int VAR_7 = (av_pix_fmt_desc_get(VAR_0->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR)\n? (VAR_0->bits_per_raw_sample > 8) + 1\n: 4;", "AVFrame *const p = f->cur;", "if (f->version > 2) {", "if (decode_slice_header(f, fs) < 0) {", "fs->slice_damaged = 1;", "return AVERROR_INVALIDDATA;", "}", "}", "if ((VAR_6 = ffv1_init_slice_state(f, fs)) < 0)\nreturn VAR_6;", "if (f->cur->key_frame)\nffv1_clear_slice_state(f, fs);", "VAR_2 = fs->slice_width;", "VAR_3 = fs->slice_height;", "VAR_4 = fs->slice_x;", "VAR_5 = fs->slice_y;", "if (!fs->ac) {", "if (f->version == 3 && f->minor_version > 1 || f->version > 3)\nget_rac(&fs->VAR_0, (uint8_t[]) { 129 });", "fs->ac_byte_count = f->version > 2 || (!VAR_4 && !VAR_5) ? fs->VAR_0.bytestream - fs->VAR_0.bytestream_start - 1 : 0;", "init_get_bits(&fs->gb, fs->VAR_0.bytestream_start + fs->ac_byte_count,\n(fs->VAR_0.bytestream_end - fs->VAR_0.bytestream_start -\nfs->ac_byte_count) * 8);", "}", "av_assert1(VAR_2 && VAR_3);", "if (f->colorspace == 0) {", "const int VAR_8 = -((-VAR_2) >> f->chroma_h_shift);", "const int VAR_9 = -((-VAR_3) >> f->chroma_v_shift);", "const int VAR_10 = VAR_4 >> f->chroma_h_shift;", "const int VAR_11 = VAR_5 >> f->chroma_v_shift;", "decode_plane(fs, p->data[0] + VAR_7 * VAR_4 + VAR_5 * p->linesize[0], VAR_2,\nVAR_3, p->linesize[0],\n0);", "if (f->chroma_planes) {", "decode_plane(fs, p->data[1] + VAR_7 * VAR_10 + VAR_11 * p->linesize[1],\nVAR_8, VAR_9, p->linesize[1],\n1);", "decode_plane(fs, p->data[2] + VAR_7 * VAR_10 + VAR_11 * p->linesize[2],\nVAR_8, VAR_9, p->linesize[2],\n1);", "}", "if (fs->transparency)\ndecode_plane(fs, p->data[3] + VAR_7 * VAR_4 + VAR_5 * p->linesize[3], VAR_2,\nVAR_3, p->linesize[3],\n2);", "} else {", "uint8_t *planes[3] = { p->data[0] + VAR_7 * VAR_4 + VAR_5 * p->linesize[0],", "p->data[1] + VAR_7 * VAR_4 + VAR_5 * p->linesize[1],\np->data[2] + VAR_7 * VAR_4 + VAR_5 * p->linesize[2] };", "decode_rgb_frame(fs, planes, VAR_2, VAR_3, p->linesize);", "}", "if (fs->ac && f->version > 2) {", "int VAR_12;", "get_rac(&fs->VAR_0, (uint8_t[]) { 129 });", "VAR_12 = fs->VAR_0.bytestream_end - fs->VAR_0.bytestream - 2 - 5 * f->ec;", "if (VAR_12) {", "av_log(f->avctx, AV_LOG_ERROR, \"bytestream end mismatching by %d\\n\",\nVAR_12);", "fs->slice_damaged = 1;", "}", "}", "emms_c();", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 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 ], [ 147 ], [ 151 ], [ 153 ] ]
4,057
int text_console_init(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; TextConsole *s; unsigned width; unsigned height; chr = g_malloc0(sizeof(CharDriverState)); if (n_text_consoles == 128) { fprintf(stderr, "Too many text consoles\n"); exit(1); } text_consoles[n_text_consoles] = chr; n_text_consoles++; width = qemu_opt_get_number(opts, "width", 0); if (width == 0) width = qemu_opt_get_number(opts, "cols", 0) * FONT_WIDTH; height = qemu_opt_get_number(opts, "height", 0); if (height == 0) height = qemu_opt_get_number(opts, "rows", 0) * FONT_HEIGHT; if (width == 0 || height == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); } if (!s) { g_free(chr); return -EBUSY; } s->chr = chr; s->g_width = width; s->g_height = height; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; *_chr = chr; return 0; }
true
qemu
1f51470d044852592922f91000e741c381582cdc
int text_console_init(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; TextConsole *s; unsigned width; unsigned height; chr = g_malloc0(sizeof(CharDriverState)); if (n_text_consoles == 128) { fprintf(stderr, "Too many text consoles\n"); exit(1); } text_consoles[n_text_consoles] = chr; n_text_consoles++; width = qemu_opt_get_number(opts, "width", 0); if (width == 0) width = qemu_opt_get_number(opts, "cols", 0) * FONT_WIDTH; height = qemu_opt_get_number(opts, "height", 0); if (height == 0) height = qemu_opt_get_number(opts, "rows", 0) * FONT_HEIGHT; if (width == 0 || height == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); } if (!s) { g_free(chr); return -EBUSY; } s->chr = chr; s->g_width = width; s->g_height = height; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; *_chr = chr; return 0; }
{ "code": [ "int text_console_init(QemuOpts *opts, CharDriverState **_chr)", " return -EBUSY;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return 0;", " return 0;", " return 0;", " return -EBUSY;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;" ], "line_no": [ 1, 65, 83, 85, 83, 85, 83, 85, 85, 85, 85, 65, 83, 85, 83, 85, 83, 85, 83, 85, 83, 85, 83, 85, 83, 85, 85, 83, 85, 83, 85, 83, 85, 83, 85 ] }
int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1) { CharDriverState *chr; TextConsole *s; unsigned VAR_2; unsigned VAR_3; chr = g_malloc0(sizeof(CharDriverState)); if (n_text_consoles == 128) { fprintf(stderr, "Too many text consoles\n"); exit(1); } text_consoles[n_text_consoles] = chr; n_text_consoles++; VAR_2 = qemu_opt_get_number(VAR_0, "VAR_2", 0); if (VAR_2 == 0) VAR_2 = qemu_opt_get_number(VAR_0, "cols", 0) * FONT_WIDTH; VAR_3 = qemu_opt_get_number(VAR_0, "VAR_3", 0); if (VAR_3 == 0) VAR_3 = qemu_opt_get_number(VAR_0, "rows", 0) * FONT_HEIGHT; if (VAR_2 == 0 || VAR_3 == 0) { s = new_console(NULL, TEXT_CONSOLE); } else { s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE); } if (!s) { g_free(chr); return -EBUSY; } s->chr = chr; s->g_width = VAR_2; s->g_height = VAR_3; chr->opaque = s; chr->chr_set_echo = text_console_set_echo; *VAR_1 = chr; return 0; }
[ "int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)\n{", "CharDriverState *chr;", "TextConsole *s;", "unsigned VAR_2;", "unsigned VAR_3;", "chr = g_malloc0(sizeof(CharDriverState));", "if (n_text_consoles == 128) {", "fprintf(stderr, \"Too many text consoles\\n\");", "exit(1);", "}", "text_consoles[n_text_consoles] = chr;", "n_text_consoles++;", "VAR_2 = qemu_opt_get_number(VAR_0, \"VAR_2\", 0);", "if (VAR_2 == 0)\nVAR_2 = qemu_opt_get_number(VAR_0, \"cols\", 0) * FONT_WIDTH;", "VAR_3 = qemu_opt_get_number(VAR_0, \"VAR_3\", 0);", "if (VAR_3 == 0)\nVAR_3 = qemu_opt_get_number(VAR_0, \"rows\", 0) * FONT_HEIGHT;", "if (VAR_2 == 0 || VAR_3 == 0) {", "s = new_console(NULL, TEXT_CONSOLE);", "} else {", "s = new_console(NULL, TEXT_CONSOLE_FIXED_SIZE);", "}", "if (!s) {", "g_free(chr);", "return -EBUSY;", "}", "s->chr = chr;", "s->g_width = VAR_2;", "s->g_height = VAR_3;", "chr->opaque = s;", "chr->chr_set_echo = text_console_set_echo;", "*VAR_1 = chr;", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ] ]
4,058
_eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags, size_t rthdr_offset, struct ip6_ext_hdr *ext_hdr, struct in6_address *dst_addr) { struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr; if ((rthdr->rtype == 2) && (rthdr->len == sizeof(struct in6_address) / 8) && (rthdr->segleft == 1)) { size_t input_size = iov_size(pkt, pkt_frags); size_t bytes_read; if (input_size < rthdr_offset + sizeof(*ext_hdr)) { return false; } bytes_read = iov_to_buf(pkt, pkt_frags, rthdr_offset + sizeof(*ext_hdr), dst_addr, sizeof(*dst_addr)); return bytes_read == sizeof(dst_addr); } return false; }
true
qemu
b2caa3b82edca29ccb5e7d6311ffcf841b9b7786
_eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags, size_t rthdr_offset, struct ip6_ext_hdr *ext_hdr, struct in6_address *dst_addr) { struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr; if ((rthdr->rtype == 2) && (rthdr->len == sizeof(struct in6_address) / 8) && (rthdr->segleft == 1)) { size_t input_size = iov_size(pkt, pkt_frags); size_t bytes_read; if (input_size < rthdr_offset + sizeof(*ext_hdr)) { return false; } bytes_read = iov_to_buf(pkt, pkt_frags, rthdr_offset + sizeof(*ext_hdr), dst_addr, sizeof(*dst_addr)); return bytes_read == sizeof(dst_addr); } return false; }
{ "code": [ " return bytes_read == sizeof(dst_addr);" ], "line_no": [ 45 ] }
FUNC_0(const struct iovec *VAR_0, int VAR_1, size_t VAR_2, struct ip6_ext_hdr *VAR_3, struct in6_address *VAR_4) { struct ip6_ext_hdr_routing *VAR_5 = (struct ip6_ext_hdr_routing *) VAR_3; if ((VAR_5->rtype == 2) && (VAR_5->len == sizeof(struct in6_address) / 8) && (VAR_5->segleft == 1)) { size_t input_size = iov_size(VAR_0, VAR_1); size_t bytes_read; if (input_size < VAR_2 + sizeof(*VAR_3)) { return false; } bytes_read = iov_to_buf(VAR_0, VAR_1, VAR_2 + sizeof(*VAR_3), VAR_4, sizeof(*VAR_4)); return bytes_read == sizeof(VAR_4); } return false; }
[ "FUNC_0(const struct iovec *VAR_0, int VAR_1,\nsize_t VAR_2,\nstruct ip6_ext_hdr *VAR_3,\nstruct in6_address *VAR_4)\n{", "struct ip6_ext_hdr_routing *VAR_5 = (struct ip6_ext_hdr_routing *) VAR_3;", "if ((VAR_5->rtype == 2) &&\n(VAR_5->len == sizeof(struct in6_address) / 8) &&\n(VAR_5->segleft == 1)) {", "size_t input_size = iov_size(VAR_0, VAR_1);", "size_t bytes_read;", "if (input_size < VAR_2 + sizeof(*VAR_3)) {", "return false;", "}", "bytes_read = iov_to_buf(VAR_0, VAR_1,\nVAR_2 + sizeof(*VAR_3),\nVAR_4, sizeof(*VAR_4));", "return bytes_read == sizeof(VAR_4);", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15, 17, 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
4,059
USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep, uint64_t id) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); USBPacket *p; while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) { if (p->id == id) { return p; } } return NULL; }
true
qemu
6735d433729f80fab80c0a1f70ae131398645613
USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep, uint64_t id) { struct USBEndpoint *uep = usb_ep_get(dev, pid, ep); USBPacket *p; while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) { if (p->id == id) { return p; } } return NULL; }
{ "code": [ " while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) {" ], "line_no": [ 13 ] }
USBPacket *FUNC_0(USBDevice *dev, int pid, int ep, uint64_t id) { struct USBEndpoint *VAR_0 = usb_ep_get(dev, pid, ep); USBPacket *p; while ((p = QTAILQ_FIRST(&VAR_0->queue)) != NULL) { if (p->id == id) { return p; } } return NULL; }
[ "USBPacket *FUNC_0(USBDevice *dev, int pid, int ep,\nuint64_t id)\n{", "struct USBEndpoint *VAR_0 = usb_ep_get(dev, pid, ep);", "USBPacket *p;", "while ((p = QTAILQ_FIRST(&VAR_0->queue)) != NULL) {", "if (p->id == id) {", "return p;", "}", "}", "return NULL;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
4,060
void pci_bridge_exitfn(PCIDevice *pci_dev) { PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev); assert(QLIST_EMPTY(&s->sec_bus.child)); QLIST_REMOVE(&s->sec_bus, sibling); pci_bridge_region_cleanup(s); memory_region_destroy(&s->address_space_mem); memory_region_destroy(&s->address_space_io); /* qbus_free() is called automatically by qdev_free() */ }
true
qemu
523a59f596a3e62f5a28eb171adba35e71310040
void pci_bridge_exitfn(PCIDevice *pci_dev) { PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev); assert(QLIST_EMPTY(&s->sec_bus.child)); QLIST_REMOVE(&s->sec_bus, sibling); pci_bridge_region_cleanup(s); memory_region_destroy(&s->address_space_mem); memory_region_destroy(&s->address_space_io); }
{ "code": [ " pci_bridge_region_cleanup(s);" ], "line_no": [ 11 ] }
void FUNC_0(PCIDevice *VAR_0) { PCIBridge *s = DO_UPCAST(PCIBridge, dev, VAR_0); assert(QLIST_EMPTY(&s->sec_bus.child)); QLIST_REMOVE(&s->sec_bus, sibling); pci_bridge_region_cleanup(s); memory_region_destroy(&s->address_space_mem); memory_region_destroy(&s->address_space_io); }
[ "void FUNC_0(PCIDevice *VAR_0)\n{", "PCIBridge *s = DO_UPCAST(PCIBridge, dev, VAR_0);", "assert(QLIST_EMPTY(&s->sec_bus.child));", "QLIST_REMOVE(&s->sec_bus, sibling);", "pci_bridge_region_cleanup(s);", "memory_region_destroy(&s->address_space_mem);", "memory_region_destroy(&s->address_space_io);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ] ]
4,063
static void superh_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc); scc->parent_realize = dc->realize; dc->realize = superh_cpu_realizefn; scc->parent_reset = cc->reset; cc->reset = superh_cpu_reset; cc->class_by_name = superh_cpu_class_by_name; cc->has_work = superh_cpu_has_work; cc->do_interrupt = superh_cpu_do_interrupt; cc->cpu_exec_interrupt = superh_cpu_exec_interrupt; cc->dump_state = superh_cpu_dump_state; cc->set_pc = superh_cpu_set_pc; cc->synchronize_from_tb = superh_cpu_synchronize_from_tb; cc->gdb_read_register = superh_cpu_gdb_read_register; cc->gdb_write_register = superh_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = superh_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; #endif cc->disas_set_info = superh_cpu_disas_set_info; cc->gdb_num_core_regs = 59; dc->vmsd = &vmstate_sh_cpu; /* * Reason: superh_cpu_initfn() calls cpu_exec_init(), which saves * the object in cpus -> dangling pointer after final * object_unref(). */ dc->cannot_destroy_with_object_finalize_yet = true; }
true
qemu
ce5b1bbf624b977a55ff7f85bb3871682d03baff
static void superh_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc); scc->parent_realize = dc->realize; dc->realize = superh_cpu_realizefn; scc->parent_reset = cc->reset; cc->reset = superh_cpu_reset; cc->class_by_name = superh_cpu_class_by_name; cc->has_work = superh_cpu_has_work; cc->do_interrupt = superh_cpu_do_interrupt; cc->cpu_exec_interrupt = superh_cpu_exec_interrupt; cc->dump_state = superh_cpu_dump_state; cc->set_pc = superh_cpu_set_pc; cc->synchronize_from_tb = superh_cpu_synchronize_from_tb; cc->gdb_read_register = superh_cpu_gdb_read_register; cc->gdb_write_register = superh_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = superh_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; #endif cc->disas_set_info = superh_cpu_disas_set_info; cc->gdb_num_core_regs = 59; dc->vmsd = &vmstate_sh_cpu; dc->cannot_destroy_with_object_finalize_yet = true; }
{ "code": [ " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;", " dc->cannot_destroy_with_object_finalize_yet = true;" ], "line_no": [ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); CPUClass *cc = CPU_CLASS(VAR_0); SuperHCPUClass *scc = SUPERH_CPU_CLASS(VAR_0); scc->parent_realize = dc->realize; dc->realize = superh_cpu_realizefn; scc->parent_reset = cc->reset; cc->reset = superh_cpu_reset; cc->class_by_name = superh_cpu_class_by_name; cc->has_work = superh_cpu_has_work; cc->do_interrupt = superh_cpu_do_interrupt; cc->cpu_exec_interrupt = superh_cpu_exec_interrupt; cc->dump_state = superh_cpu_dump_state; cc->set_pc = superh_cpu_set_pc; cc->synchronize_from_tb = superh_cpu_synchronize_from_tb; cc->gdb_read_register = superh_cpu_gdb_read_register; cc->gdb_write_register = superh_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = superh_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; #endif cc->disas_set_info = superh_cpu_disas_set_info; cc->gdb_num_core_regs = 59; dc->vmsd = &vmstate_sh_cpu; dc->cannot_destroy_with_object_finalize_yet = true; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "CPUClass *cc = CPU_CLASS(VAR_0);", "SuperHCPUClass *scc = SUPERH_CPU_CLASS(VAR_0);", "scc->parent_realize = dc->realize;", "dc->realize = superh_cpu_realizefn;", "scc->parent_reset = cc->reset;", "cc->reset = superh_cpu_reset;", "cc->class_by_name = superh_cpu_class_by_name;", "cc->has_work = superh_cpu_has_work;", "cc->do_interrupt = superh_cpu_do_interrupt;", "cc->cpu_exec_interrupt = superh_cpu_exec_interrupt;", "cc->dump_state = superh_cpu_dump_state;", "cc->set_pc = superh_cpu_set_pc;", "cc->synchronize_from_tb = superh_cpu_synchronize_from_tb;", "cc->gdb_read_register = superh_cpu_gdb_read_register;", "cc->gdb_write_register = superh_cpu_gdb_write_register;", "#ifdef CONFIG_USER_ONLY\ncc->handle_mmu_fault = superh_cpu_handle_mmu_fault;", "#else\ncc->get_phys_page_debug = superh_cpu_get_phys_page_debug;", "#endif\ncc->disas_set_info = superh_cpu_disas_set_info;", "cc->gdb_num_core_regs = 59;", "dc->vmsd = &vmstate_sh_cpu;", "dc->cannot_destroy_with_object_finalize_yet = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51, 53 ], [ 57 ], [ 61 ], [ 75 ], [ 77 ] ]
4,065
uint64_t HELPER(neon_abdl_u32)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, uint16_t); DO_ABD(tmp, a >> 16, b >> 16, uint16_t); return result | (tmp << 32); }
true
qemu
4d9ad7f793605abd9806fc932b3e04e028894565
uint64_t HELPER(neon_abdl_u32)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, uint16_t); DO_ABD(tmp, a >> 16, b >> 16, uint16_t); return result | (tmp << 32); }
{ "code": [ " DO_ABD(result, a, b, uint16_t);", " DO_ABD(tmp, a >> 16, b >> 16, uint16_t);" ], "line_no": [ 9, 11 ] }
uint64_t FUNC_0(neon_abdl_u32)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, uint16_t); DO_ABD(tmp, a >> 16, b >> 16, uint16_t); return result | (tmp << 32); }
[ "uint64_t FUNC_0(neon_abdl_u32)(uint32_t a, uint32_t b)\n{", "uint64_t tmp;", "uint64_t result;", "DO_ABD(result, a, b, uint16_t);", "DO_ABD(tmp, a >> 16, b >> 16, uint16_t);", "return result | (tmp << 32);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
4,066
void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){ int i, j, pos, ch; int taps = s->dither.ns_taps; float S = s->dither.ns_scale; float S_1 = s->dither.ns_scale_1; av_assert2((taps&3) != 2); av_assert2((taps&3) != 3 || s->dither.ns_coeffs[taps] == 0); for (ch=0; ch<srcs->ch_count; ch++) { const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos; const DELEM *src = (const DELEM*)srcs->ch[ch]; DELEM *dst = (DELEM*)dsts->ch[ch]; float *ns_errors = s->dither.ns_errors[ch]; const float *ns_coeffs = s->dither.ns_coeffs; pos = s->dither.ns_pos; for (i=0; i<count; i++) { double d1, d = src[i]*S_1; for(j=0; j<taps-2; j+=4) { d -= ns_coeffs[j ] * ns_errors[pos + j ] +ns_coeffs[j + 1] * ns_errors[pos + j + 1] +ns_coeffs[j + 2] * ns_errors[pos + j + 2] +ns_coeffs[j + 3] * ns_errors[pos + j + 3]; } if(j < taps) d -= ns_coeffs[j] * ns_errors[pos + j]; pos = pos ? pos - 1 : taps - 1; d1 = rint(d + noise[i]); ns_errors[pos + taps] = ns_errors[pos] = d1 - d; d1 *= S; CLIP(d1); dst[i] = d1; } } s->dither.ns_pos = pos; }
true
FFmpeg
cc4a41727e29a52a181e3d1c1a398f1da40969c3
void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){ int i, j, pos, ch; int taps = s->dither.ns_taps; float S = s->dither.ns_scale; float S_1 = s->dither.ns_scale_1; av_assert2((taps&3) != 2); av_assert2((taps&3) != 3 || s->dither.ns_coeffs[taps] == 0); for (ch=0; ch<srcs->ch_count; ch++) { const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos; const DELEM *src = (const DELEM*)srcs->ch[ch]; DELEM *dst = (DELEM*)dsts->ch[ch]; float *ns_errors = s->dither.ns_errors[ch]; const float *ns_coeffs = s->dither.ns_coeffs; pos = s->dither.ns_pos; for (i=0; i<count; i++) { double d1, d = src[i]*S_1; for(j=0; j<taps-2; j+=4) { d -= ns_coeffs[j ] * ns_errors[pos + j ] +ns_coeffs[j + 1] * ns_errors[pos + j + 1] +ns_coeffs[j + 2] * ns_errors[pos + j + 2] +ns_coeffs[j + 3] * ns_errors[pos + j + 3]; } if(j < taps) d -= ns_coeffs[j] * ns_errors[pos + j]; pos = pos ? pos - 1 : taps - 1; d1 = rint(d + noise[i]); ns_errors[pos + taps] = ns_errors[pos] = d1 - d; d1 *= S; CLIP(d1); dst[i] = d1; } } s->dither.ns_pos = pos; }
{ "code": [ " int i, j, pos, ch;" ], "line_no": [ 3 ] }
void FUNC_0(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){ int VAR_0, VAR_1, VAR_2, VAR_3; int VAR_4 = s->dither.ns_taps; float VAR_5 = s->dither.ns_scale; float VAR_6 = s->dither.ns_scale_1; av_assert2((VAR_4&3) != 2); av_assert2((VAR_4&3) != 3 || s->dither.ns_coeffs[VAR_4] == 0); for (VAR_3=0; VAR_3<srcs->ch_count; VAR_3++) { const float *noise = ((const float *)noises->VAR_3[VAR_3]) + s->dither.noise_pos; const DELEM *src = (const DELEM*)srcs->VAR_3[VAR_3]; DELEM *dst = (DELEM*)dsts->VAR_3[VAR_3]; float *ns_errors = s->dither.ns_errors[VAR_3]; const float *ns_coeffs = s->dither.ns_coeffs; VAR_2 = s->dither.ns_pos; for (VAR_0=0; VAR_0<count; VAR_0++) { double d1, d = src[VAR_0]*VAR_6; for(VAR_1=0; VAR_1<VAR_4-2; VAR_1+=4) { d -= ns_coeffs[VAR_1 ] * ns_errors[VAR_2 + VAR_1 ] +ns_coeffs[VAR_1 + 1] * ns_errors[VAR_2 + VAR_1 + 1] +ns_coeffs[VAR_1 + 2] * ns_errors[VAR_2 + VAR_1 + 2] +ns_coeffs[VAR_1 + 3] * ns_errors[VAR_2 + VAR_1 + 3]; } if(VAR_1 < VAR_4) d -= ns_coeffs[VAR_1] * ns_errors[VAR_2 + VAR_1]; VAR_2 = VAR_2 ? VAR_2 - 1 : VAR_4 - 1; d1 = rint(d + noise[VAR_0]); ns_errors[VAR_2 + VAR_4] = ns_errors[VAR_2] = d1 - d; d1 *= VAR_5; CLIP(d1); dst[VAR_0] = d1; } } s->dither.ns_pos = VAR_2; }
[ "void FUNC_0(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){", "int VAR_0, VAR_1, VAR_2, VAR_3;", "int VAR_4 = s->dither.ns_taps;", "float VAR_5 = s->dither.ns_scale;", "float VAR_6 = s->dither.ns_scale_1;", "av_assert2((VAR_4&3) != 2);", "av_assert2((VAR_4&3) != 3 || s->dither.ns_coeffs[VAR_4] == 0);", "for (VAR_3=0; VAR_3<srcs->ch_count; VAR_3++) {", "const float *noise = ((const float *)noises->VAR_3[VAR_3]) + s->dither.noise_pos;", "const DELEM *src = (const DELEM*)srcs->VAR_3[VAR_3];", "DELEM *dst = (DELEM*)dsts->VAR_3[VAR_3];", "float *ns_errors = s->dither.ns_errors[VAR_3];", "const float *ns_coeffs = s->dither.ns_coeffs;", "VAR_2 = s->dither.ns_pos;", "for (VAR_0=0; VAR_0<count; VAR_0++) {", "double d1, d = src[VAR_0]*VAR_6;", "for(VAR_1=0; VAR_1<VAR_4-2; VAR_1+=4) {", "d -= ns_coeffs[VAR_1 ] * ns_errors[VAR_2 + VAR_1 ]\n+ns_coeffs[VAR_1 + 1] * ns_errors[VAR_2 + VAR_1 + 1]\n+ns_coeffs[VAR_1 + 2] * ns_errors[VAR_2 + VAR_1 + 2]\n+ns_coeffs[VAR_1 + 3] * ns_errors[VAR_2 + VAR_1 + 3];", "}", "if(VAR_1 < VAR_4)\nd -= ns_coeffs[VAR_1] * ns_errors[VAR_2 + VAR_1];", "VAR_2 = VAR_2 ? VAR_2 - 1 : VAR_4 - 1;", "d1 = rint(d + noise[VAR_0]);", "ns_errors[VAR_2 + VAR_4] = ns_errors[VAR_2] = d1 - d;", "d1 *= VAR_5;", "CLIP(d1);", "dst[VAR_0] = d1;", "}", "}", "s->dither.ns_pos = VAR_2;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 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 ] ]
4,067
static int64_t expr_unary(Monitor *mon) { int64_t n; char *p; int ret; switch(*pch) { case '+': next(); n = expr_unary(mon); break; case '-': next(); n = -expr_unary(mon); break; case '~': next(); n = ~expr_unary(mon); break; case '(': next(); n = expr_sum(mon); if (*pch != ')') { expr_error(mon, "')' expected"); } next(); break; case '\'': pch++; if (*pch == '\0') expr_error(mon, "character constant expected"); n = *pch; pch++; if (*pch != '\'') expr_error(mon, "missing terminating \' character"); next(); break; case '$': { char buf[128], *q; target_long reg=0; pch++; q = buf; while ((*pch >= 'a' && *pch <= 'z') || (*pch >= 'A' && *pch <= 'Z') || (*pch >= '0' && *pch <= '9') || *pch == '_' || *pch == '.') { if ((q - buf) < sizeof(buf) - 1) *q++ = *pch; pch++; } while (qemu_isspace(*pch)) pch++; *q = 0; ret = get_monitor_def(&reg, buf); if (ret == -1) expr_error(mon, "unknown register"); else if (ret == -2) expr_error(mon, "no cpu defined"); n = reg; } break; case '\0': expr_error(mon, "unexpected end of expression"); n = 0; break; default: #if TARGET_PHYS_ADDR_BITS > 32 n = strtoull(pch, &p, 0); #else n = strtoul(pch, &p, 0); #endif if (pch == p) { expr_error(mon, "invalid char in expression"); } pch = p; while (qemu_isspace(*pch)) pch++; break; } return n; }
true
qemu
09b9418c6d085a0728372aa760ebd10128a020b1
static int64_t expr_unary(Monitor *mon) { int64_t n; char *p; int ret; switch(*pch) { case '+': next(); n = expr_unary(mon); break; case '-': next(); n = -expr_unary(mon); break; case '~': next(); n = ~expr_unary(mon); break; case '(': next(); n = expr_sum(mon); if (*pch != ')') { expr_error(mon, "')' expected"); } next(); break; case '\'': pch++; if (*pch == '\0') expr_error(mon, "character constant expected"); n = *pch; pch++; if (*pch != '\'') expr_error(mon, "missing terminating \' character"); next(); break; case '$': { char buf[128], *q; target_long reg=0; pch++; q = buf; while ((*pch >= 'a' && *pch <= 'z') || (*pch >= 'A' && *pch <= 'Z') || (*pch >= '0' && *pch <= '9') || *pch == '_' || *pch == '.') { if ((q - buf) < sizeof(buf) - 1) *q++ = *pch; pch++; } while (qemu_isspace(*pch)) pch++; *q = 0; ret = get_monitor_def(&reg, buf); if (ret == -1) expr_error(mon, "unknown register"); else if (ret == -2) expr_error(mon, "no cpu defined"); n = reg; } break; case '\0': expr_error(mon, "unexpected end of expression"); n = 0; break; default: #if TARGET_PHYS_ADDR_BITS > 32 n = strtoull(pch, &p, 0); #else n = strtoul(pch, &p, 0); #endif if (pch == p) { expr_error(mon, "invalid char in expression"); } pch = p; while (qemu_isspace(*pch)) pch++; break; } return n; }
{ "code": [ " if (ret == -1)", " else if (ret == -2)", " expr_error(mon, \"no cpu defined\");" ], "line_no": [ 113, 117, 119 ] }
static int64_t FUNC_0(Monitor *mon) { int64_t n; char *VAR_0; int VAR_1; switch(*pch) { case '+': next(); n = FUNC_0(mon); break; case '-': next(); n = -FUNC_0(mon); break; case '~': next(); n = ~FUNC_0(mon); break; case '(': next(); n = expr_sum(mon); if (*pch != ')') { expr_error(mon, "')' expected"); } next(); break; case '\'': pch++; if (*pch == '\0') expr_error(mon, "character constant expected"); n = *pch; pch++; if (*pch != '\'') expr_error(mon, "missing terminating \' character"); next(); break; case '$': { char VAR_2[128], *VAR_3; target_long reg=0; pch++; VAR_3 = VAR_2; while ((*pch >= 'a' && *pch <= 'z') || (*pch >= 'A' && *pch <= 'Z') || (*pch >= '0' && *pch <= '9') || *pch == '_' || *pch == '.') { if ((VAR_3 - VAR_2) < sizeof(VAR_2) - 1) *VAR_3++ = *pch; pch++; } while (qemu_isspace(*pch)) pch++; *VAR_3 = 0; VAR_1 = get_monitor_def(&reg, VAR_2); if (VAR_1 == -1) expr_error(mon, "unknown register"); else if (VAR_1 == -2) expr_error(mon, "no cpu defined"); n = reg; } break; case '\0': expr_error(mon, "unexpected end of expression"); n = 0; break; default: #if TARGET_PHYS_ADDR_BITS > 32 n = strtoull(pch, &VAR_0, 0); #else n = strtoul(pch, &VAR_0, 0); #endif if (pch == VAR_0) { expr_error(mon, "invalid char in expression"); } pch = VAR_0; while (qemu_isspace(*pch)) pch++; break; } return n; }
[ "static int64_t FUNC_0(Monitor *mon)\n{", "int64_t n;", "char *VAR_0;", "int VAR_1;", "switch(*pch) {", "case '+':\nnext();", "n = FUNC_0(mon);", "break;", "case '-':\nnext();", "n = -FUNC_0(mon);", "break;", "case '~':\nnext();", "n = ~FUNC_0(mon);", "break;", "case '(':\nnext();", "n = expr_sum(mon);", "if (*pch != ')') {", "expr_error(mon, \"')' expected\");", "}", "next();", "break;", "case '\\'':\npch++;", "if (*pch == '\\0')\nexpr_error(mon, \"character constant expected\");", "n = *pch;", "pch++;", "if (*pch != '\\'')\nexpr_error(mon, \"missing terminating \\' character\");", "next();", "break;", "case '$':\n{", "char VAR_2[128], *VAR_3;", "target_long reg=0;", "pch++;", "VAR_3 = VAR_2;", "while ((*pch >= 'a' && *pch <= 'z') ||\n(*pch >= 'A' && *pch <= 'Z') ||\n(*pch >= '0' && *pch <= '9') ||\n*pch == '_' || *pch == '.') {", "if ((VAR_3 - VAR_2) < sizeof(VAR_2) - 1)\n*VAR_3++ = *pch;", "pch++;", "}", "while (qemu_isspace(*pch))\npch++;", "*VAR_3 = 0;", "VAR_1 = get_monitor_def(&reg, VAR_2);", "if (VAR_1 == -1)\nexpr_error(mon, \"unknown register\");", "else if (VAR_1 == -2)\nexpr_error(mon, \"no cpu defined\");", "n = reg;", "}", "break;", "case '\\0':\nexpr_error(mon, \"unexpected end of expression\");", "n = 0;", "break;", "default:\n#if TARGET_PHYS_ADDR_BITS > 32\nn = strtoull(pch, &VAR_0, 0);", "#else\nn = strtoul(pch, &VAR_0, 0);", "#endif\nif (pch == VAR_0) {", "expr_error(mon, \"invalid char in expression\");", "}", "pch = VAR_0;", "while (qemu_isspace(*pch))\npch++;", "break;", "}", "return n;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 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 ] ]
4,068
static av_cold void uninit(AVFilterContext *ctx) { DynamicAudioNormalizerContext *s = ctx->priv; int c; av_freep(&s->prev_amplification_factor); av_freep(&s->dc_correction_value); av_freep(&s->compress_threshold); av_freep(&s->fade_factors[0]); av_freep(&s->fade_factors[1]); for (c = 0; c < s->channels; c++) { cqueue_free(s->gain_history_original[c]); cqueue_free(s->gain_history_minimum[c]); cqueue_free(s->gain_history_smoothed[c]); } av_freep(&s->gain_history_original); av_freep(&s->gain_history_minimum); av_freep(&s->gain_history_smoothed); av_freep(&s->weights); ff_bufqueue_discard_all(&s->queue); }
true
FFmpeg
70df51112ccc8d281cdb96141f20b3fd8a5b11f8
static av_cold void uninit(AVFilterContext *ctx) { DynamicAudioNormalizerContext *s = ctx->priv; int c; av_freep(&s->prev_amplification_factor); av_freep(&s->dc_correction_value); av_freep(&s->compress_threshold); av_freep(&s->fade_factors[0]); av_freep(&s->fade_factors[1]); for (c = 0; c < s->channels; c++) { cqueue_free(s->gain_history_original[c]); cqueue_free(s->gain_history_minimum[c]); cqueue_free(s->gain_history_smoothed[c]); } av_freep(&s->gain_history_original); av_freep(&s->gain_history_minimum); av_freep(&s->gain_history_smoothed); av_freep(&s->weights); ff_bufqueue_discard_all(&s->queue); }
{ "code": [ " cqueue_free(s->gain_history_original[c]);", " cqueue_free(s->gain_history_minimum[c]);", " cqueue_free(s->gain_history_smoothed[c]);" ], "line_no": [ 25, 27, 29 ] }
static av_cold void FUNC_0(AVFilterContext *ctx) { DynamicAudioNormalizerContext *s = ctx->priv; int VAR_0; av_freep(&s->prev_amplification_factor); av_freep(&s->dc_correction_value); av_freep(&s->compress_threshold); av_freep(&s->fade_factors[0]); av_freep(&s->fade_factors[1]); for (VAR_0 = 0; VAR_0 < s->channels; VAR_0++) { cqueue_free(s->gain_history_original[VAR_0]); cqueue_free(s->gain_history_minimum[VAR_0]); cqueue_free(s->gain_history_smoothed[VAR_0]); } av_freep(&s->gain_history_original); av_freep(&s->gain_history_minimum); av_freep(&s->gain_history_smoothed); av_freep(&s->weights); ff_bufqueue_discard_all(&s->queue); }
[ "static av_cold void FUNC_0(AVFilterContext *ctx)\n{", "DynamicAudioNormalizerContext *s = ctx->priv;", "int VAR_0;", "av_freep(&s->prev_amplification_factor);", "av_freep(&s->dc_correction_value);", "av_freep(&s->compress_threshold);", "av_freep(&s->fade_factors[0]);", "av_freep(&s->fade_factors[1]);", "for (VAR_0 = 0; VAR_0 < s->channels; VAR_0++) {", "cqueue_free(s->gain_history_original[VAR_0]);", "cqueue_free(s->gain_history_minimum[VAR_0]);", "cqueue_free(s->gain_history_smoothed[VAR_0]);", "}", "av_freep(&s->gain_history_original);", "av_freep(&s->gain_history_minimum);", "av_freep(&s->gain_history_smoothed);", "av_freep(&s->weights);", "ff_bufqueue_discard_all(&s->queue);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ] ]
4,069
static int RENAME(dct_quantize)(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow) { x86_reg last_non_zero_p1; int level=0, q; //=0 is because gcc says uninitialized ... const uint16_t *qmat, *bias; LOCAL_ALIGNED_16(int16_t, temp_block, [64]); av_assert2((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly? //s->fdct (block); RENAMEl(ff_fdct) (block); //cannot be anything else ... if(s->dct_error_sum) s->denoise_dct(s, block); if (s->mb_intra) { int dummy; if (n < 4){ q = s->y_dc_scale; bias = s->q_intra_matrix16[qscale][1]; qmat = s->q_intra_matrix16[qscale][0]; }else{ q = s->c_dc_scale; bias = s->q_chroma_intra_matrix16[qscale][1]; qmat = s->q_chroma_intra_matrix16[qscale][0]; } /* note: block[0] is assumed to be positive */ if (!s->h263_aic) { __asm__ volatile ( "mul %%ecx \n\t" : "=d" (level), "=a"(dummy) : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1]) ); } else /* For AIC we skip quant/dequant of INTRADC */ level = (block[0] + 4)>>3; block[0]=0; //avoid fake overflow // temp_block[0] = (block[0] + (q >> 1)) / q; last_non_zero_p1 = 1; } else { last_non_zero_p1 = 0; bias = s->q_inter_matrix16[qscale][1]; qmat = s->q_inter_matrix16[qscale][0]; } if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){ __asm__ volatile( "movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1 SPREADW(MM"3") "pxor "MM"7, "MM"7 \n\t" // 0 "pxor "MM"4, "MM"4 \n\t" // 0 MOVQ" (%2), "MM"5 \n\t" // qmat[0] "pxor "MM"6, "MM"6 \n\t" "psubw (%3), "MM"6 \n\t" // -bias[0] "mov $-128, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" // block[i] SAVE_SIGN(MM"1", MM"0") // ABS(block[i]) "psubusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0] "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16 "por "MM"0, "MM"4 \n\t" RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) MOVQ" "MM"0, (%5, %%"REG_a") \n\t" "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00 MOVQ" (%4, %%"REG_a"), "MM"1 \n\t" MOVQ" "MM"7, (%1, %%"REG_a") \n\t" // 0 "pandn "MM"1, "MM"0 \n\t" PMAXW(MM"0", MM"3") "add $"MMREG_WIDTH", %%"REG_a" \n\t" " js 1b \n\t" PMAX(MM"3", MM"0") "movd "MM"3, %%"REG_a" \n\t" "movzbl %%al, %%eax \n\t" // last_non_zero_p1 : "+a" (last_non_zero_p1) : "r" (block+64), "r" (qmat), "r" (bias), "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); }else{ // FMT_H263 __asm__ volatile( "movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1 SPREADW(MM"3") "pxor "MM"7, "MM"7 \n\t" // 0 "pxor "MM"4, "MM"4 \n\t" // 0 "mov $-128, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" // block[i] SAVE_SIGN(MM"1", MM"0") // ABS(block[i]) MOVQ" (%3, %%"REG_a"), "MM"6 \n\t" // bias[0] "paddusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0] MOVQ" (%2, %%"REG_a"), "MM"5 \n\t" // qmat[i] "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16 "por "MM"0, "MM"4 \n\t" RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) MOVQ" "MM"0, (%5, %%"REG_a") \n\t" "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00 MOVQ" (%4, %%"REG_a"), "MM"1 \n\t" MOVQ" "MM"7, (%1, %%"REG_a") \n\t" // 0 "pandn "MM"1, "MM"0 \n\t" PMAXW(MM"0", MM"3") "add $"MMREG_WIDTH", %%"REG_a" \n\t" " js 1b \n\t" PMAX(MM"3", MM"0") "movd "MM"3, %%"REG_a" \n\t" "movzbl %%al, %%eax \n\t" // last_non_zero_p1 : "+a" (last_non_zero_p1) : "r" (block+64), "r" (qmat+64), "r" (bias+64), "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); } __asm__ volatile( "movd %1, "MM"1 \n\t" // max_qcoeff SPREADW(MM"1") "psubusw "MM"1, "MM"4 \n\t" "packuswb "MM"4, "MM"4 \n\t" #if COMPILE_TEMPLATE_SSE2 "packuswb "MM"4, "MM"4 \n\t" #endif "movd "MM"4, %0 \n\t" // *overflow : "=g" (*overflow) : "g" (s->max_qcoeff) ); if(s->mb_intra) block[0]= level; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(last_non_zero_p1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: return last_non_zero_p1 - 1; }
true
FFmpeg
c25d2cd20b7643ea2c864dea9f25eef322cf3fb2
static int RENAME(dct_quantize)(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow) { x86_reg last_non_zero_p1; int level=0, q; const uint16_t *qmat, *bias; LOCAL_ALIGNED_16(int16_t, temp_block, [64]); av_assert2((7&(int)(&temp_block[0])) == 0); RENAMEl(ff_fdct) (block); if(s->dct_error_sum) s->denoise_dct(s, block); if (s->mb_intra) { int dummy; if (n < 4){ q = s->y_dc_scale; bias = s->q_intra_matrix16[qscale][1]; qmat = s->q_intra_matrix16[qscale][0]; }else{ q = s->c_dc_scale; bias = s->q_chroma_intra_matrix16[qscale][1]; qmat = s->q_chroma_intra_matrix16[qscale][0]; } if (!s->h263_aic) { __asm__ volatile ( "mul %%ecx \n\t" : "=d" (level), "=a"(dummy) : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1]) ); } else level = (block[0] + 4)>>3; block[0]=0; last_non_zero_p1 = 1; } else { last_non_zero_p1 = 0; bias = s->q_inter_matrix16[qscale][1]; qmat = s->q_inter_matrix16[qscale][0]; } if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){ __asm__ volatile( "movd %%"REG_a", "MM"3 \n\t" SPREADW(MM"3") "pxor "MM"7, "MM"7 \n\t" "pxor "MM"4, "MM"4 \n\t" MOVQ" (%2), "MM"5 \n\t" "pxor "MM"6, "MM"6 \n\t" "psubw (%3), "MM"6 \n\t" "mov $-128, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" SAVE_SIGN(MM"1", MM"0") "psubusw "MM"6, "MM"0 \n\t" + bias[0] "pmulhw "MM"5, "MM"0 \n\t" "por "MM"0, "MM"4 \n\t" RESTORE_SIGN(MM"1", MM"0") MOVQ" "MM"0, (%5, %%"REG_a") \n\t" "pcmpeqw "MM"7, "MM"0 \n\t" MOVQ" (%4, %%"REG_a"), "MM"1 \n\t" MOVQ" "MM"7, (%1, %%"REG_a") \n\t" "pandn "MM"1, "MM"0 \n\t" PMAXW(MM"0", MM"3") "add $"MMREG_WIDTH", %%"REG_a" \n\t" " js 1b \n\t" PMAX(MM"3", MM"0") "movd "MM"3, %%"REG_a" \n\t" "movzbl %%al, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (qmat), "r" (bias), "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); }else{ __asm__ volatile( "movd %%"REG_a", "MM"3 \n\t" SPREADW(MM"3") "pxor "MM"7, "MM"7 \n\t" "pxor "MM"4, "MM"4 \n\t" "mov $-128, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" SAVE_SIGN(MM"1", MM"0") MOVQ" (%3, %%"REG_a"), "MM"6 \n\t" "paddusw "MM"6, "MM"0 \n\t" + bias[0] MOVQ" (%2, %%"REG_a"), "MM"5 \n\t" "pmulhw "MM"5, "MM"0 \n\t" "por "MM"0, "MM"4 \n\t" RESTORE_SIGN(MM"1", MM"0") MOVQ" "MM"0, (%5, %%"REG_a") \n\t" "pcmpeqw "MM"7, "MM"0 \n\t" MOVQ" (%4, %%"REG_a"), "MM"1 \n\t" MOVQ" "MM"7, (%1, %%"REG_a") \n\t" "pandn "MM"1, "MM"0 \n\t" PMAXW(MM"0", MM"3") "add $"MMREG_WIDTH", %%"REG_a" \n\t" " js 1b \n\t" PMAX(MM"3", MM"0") "movd "MM"3, %%"REG_a" \n\t" "movzbl %%al, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (qmat+64), "r" (bias+64), "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); } __asm__ volatile( "movd %1, "MM"1 \n\t" SPREADW(MM"1") "psubusw "MM"1, "MM"4 \n\t" "packuswb "MM"4, "MM"4 \n\t" #if COMPILE_TEMPLATE_SSE2 "packuswb "MM"4, "MM"4 \n\t" #endif "movd "MM"4, %0 \n\t" : "=g" (*overflow) : "g" (s->max_qcoeff) ); if(s->mb_intra) block[0]= level; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(last_non_zero_p1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: return last_non_zero_p1 - 1; }
{ "code": [ " \"packuswb \"MM\"4, \"MM\"4 \\n\\t\"" ], "line_no": [ 247 ] }
static int FUNC_0(dct_quantize)(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow) { x86_reg last_non_zero_p1; int VAR_0=0, VAR_1; const uint16_t *VAR_2, *bias; LOCAL_ALIGNED_16(int16_t, temp_block, [64]); av_assert2((7&(int)(&temp_block[0])) == 0); RENAMEl(ff_fdct) (block); if(s->dct_error_sum) s->denoise_dct(s, block); if (s->mb_intra) { int VAR_3; if (n < 4){ VAR_1 = s->y_dc_scale; bias = s->q_intra_matrix16[qscale][1]; VAR_2 = s->q_intra_matrix16[qscale][0]; }else{ VAR_1 = s->c_dc_scale; bias = s->q_chroma_intra_matrix16[qscale][1]; VAR_2 = s->q_chroma_intra_matrix16[qscale][0]; } if (!s->h263_aic) { __asm__ volatile ( "mul %%ecx \n\t" : "=d" (VAR_0), "=a"(VAR_3) : "a" ((block[0]>>2) + VAR_1), "c" (ff_inverse[VAR_1<<1]) ); } else VAR_0 = (block[0] + 4)>>3; block[0]=0; last_non_zero_p1 = 1; } else { last_non_zero_p1 = 0; bias = s->q_inter_matrix16[qscale][1]; VAR_2 = s->q_inter_matrix16[qscale][0]; } if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){ __asm__ volatile( "movd %%"REG_a", "MM"3 \n\t" SPREADW(MM"3") "pxor "MM"7, "MM"7 \n\t" "pxor "MM"4, "MM"4 \n\t" MOVQ" (%2), "MM"5 \n\t" "pxor "MM"6, "MM"6 \n\t" "psubw (%3), "MM"6 \n\t" "mov $-128, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" SAVE_SIGN(MM"1", MM"0") "psubusw "MM"6, "MM"0 \n\t" + bias[0] "pmulhw "MM"5, "MM"0 \n\t" "por "MM"0, "MM"4 \n\t" RESTORE_SIGN(MM"1", MM"0") MOVQ" "MM"0, (%5, %%"REG_a") \n\t" "pcmpeqw "MM"7, "MM"0 \n\t" MOVQ" (%4, %%"REG_a"), "MM"1 \n\t" MOVQ" "MM"7, (%1, %%"REG_a") \n\t" "pandn "MM"1, "MM"0 \n\t" PMAXW(MM"0", MM"3") "add $"MMREG_WIDTH", %%"REG_a" \n\t" " js 1b \n\t" PMAX(MM"3", MM"0") "movd "MM"3, %%"REG_a" \n\t" "movzbl %%al, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (VAR_2), "r" (bias), "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); }else{ __asm__ volatile( "movd %%"REG_a", "MM"3 \n\t" SPREADW(MM"3") "pxor "MM"7, "MM"7 \n\t" "pxor "MM"4, "MM"4 \n\t" "mov $-128, %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" SAVE_SIGN(MM"1", MM"0") MOVQ" (%3, %%"REG_a"), "MM"6 \n\t" "paddusw "MM"6, "MM"0 \n\t" + bias[0] MOVQ" (%2, %%"REG_a"), "MM"5 \n\t" "pmulhw "MM"5, "MM"0 \n\t" "por "MM"0, "MM"4 \n\t" RESTORE_SIGN(MM"1", MM"0") MOVQ" "MM"0, (%5, %%"REG_a") \n\t" "pcmpeqw "MM"7, "MM"0 \n\t" MOVQ" (%4, %%"REG_a"), "MM"1 \n\t" MOVQ" "MM"7, (%1, %%"REG_a") \n\t" "pandn "MM"1, "MM"0 \n\t" PMAXW(MM"0", MM"3") "add $"MMREG_WIDTH", %%"REG_a" \n\t" " js 1b \n\t" PMAX(MM"3", MM"0") "movd "MM"3, %%"REG_a" \n\t" "movzbl %%al, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (VAR_2+64), "r" (bias+64), "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); } __asm__ volatile( "movd %1, "MM"1 \n\t" SPREADW(MM"1") "psubusw "MM"1, "MM"4 \n\t" "packuswb "MM"4, "MM"4 \n\t" #if COMPILE_TEMPLATE_SSE2 "packuswb "MM"4, "MM"4 \n\t" #endif "movd "MM"4, %0 \n\t" : "=g" (*overflow) : "g" (s->max_qcoeff) ); if(s->mb_intra) block[0]= VAR_0; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(last_non_zero_p1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: return last_non_zero_p1 - 1; }
[ "static int FUNC_0(dct_quantize)(MpegEncContext *s,\nint16_t *block, int n,\nint qscale, int *overflow)\n{", "x86_reg last_non_zero_p1;", "int VAR_0=0, VAR_1;", "const uint16_t *VAR_2, *bias;", "LOCAL_ALIGNED_16(int16_t, temp_block, [64]);", "av_assert2((7&(int)(&temp_block[0])) == 0);", "RENAMEl(ff_fdct) (block);", "if(s->dct_error_sum)\ns->denoise_dct(s, block);", "if (s->mb_intra) {", "int VAR_3;", "if (n < 4){", "VAR_1 = s->y_dc_scale;", "bias = s->q_intra_matrix16[qscale][1];", "VAR_2 = s->q_intra_matrix16[qscale][0];", "}else{", "VAR_1 = s->c_dc_scale;", "bias = s->q_chroma_intra_matrix16[qscale][1];", "VAR_2 = s->q_chroma_intra_matrix16[qscale][0];", "}", "if (!s->h263_aic) {", "__asm__ volatile (\n\"mul %%ecx \\n\\t\"\n: \"=d\" (VAR_0), \"=a\"(VAR_3)\n: \"a\" ((block[0]>>2) + VAR_1), \"c\" (ff_inverse[VAR_1<<1])\n);", "} else", "VAR_0 = (block[0] + 4)>>3;", "block[0]=0;", "last_non_zero_p1 = 1;", "} else {", "last_non_zero_p1 = 0;", "bias = s->q_inter_matrix16[qscale][1];", "VAR_2 = s->q_inter_matrix16[qscale][0];", "}", "if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){", "__asm__ volatile(\n\"movd %%\"REG_a\", \"MM\"3 \\n\\t\"\nSPREADW(MM\"3\")\n\"pxor \"MM\"7, \"MM\"7 \\n\\t\"\n\"pxor \"MM\"4, \"MM\"4 \\n\\t\"\nMOVQ\" (%2), \"MM\"5 \\n\\t\"\n\"pxor \"MM\"6, \"MM\"6 \\n\\t\"\n\"psubw (%3), \"MM\"6 \\n\\t\"\n\"mov $-128, %%\"REG_a\" \\n\\t\"\n\".p2align 4 \\n\\t\"\n\"1: \\n\\t\"\nMOVQ\" (%1, %%\"REG_a\"), \"MM\"0 \\n\\t\"\nSAVE_SIGN(MM\"1\", MM\"0\")\n\"psubusw \"MM\"6, \"MM\"0 \\n\\t\" + bias[0]\n\"pmulhw \"MM\"5, \"MM\"0 \\n\\t\"\n\"por \"MM\"0, \"MM\"4 \\n\\t\"\nRESTORE_SIGN(MM\"1\", MM\"0\")\nMOVQ\" \"MM\"0, (%5, %%\"REG_a\") \\n\\t\"\n\"pcmpeqw \"MM\"7, \"MM\"0 \\n\\t\"\nMOVQ\" (%4, %%\"REG_a\"), \"MM\"1 \\n\\t\"\nMOVQ\" \"MM\"7, (%1, %%\"REG_a\") \\n\\t\"\n\"pandn \"MM\"1, \"MM\"0 \\n\\t\"\nPMAXW(MM\"0\", MM\"3\")\n\"add $\"MMREG_WIDTH\", %%\"REG_a\" \\n\\t\"\n\" js 1b \\n\\t\"\nPMAX(MM\"3\", MM\"0\")\n\"movd \"MM\"3, %%\"REG_a\" \\n\\t\"\n\"movzbl %%al, %%eax \\n\\t\"\n: \"+a\" (last_non_zero_p1)\n: \"r\" (block+64), \"r\" (VAR_2), \"r\" (bias),\n\"r\" (inv_zigzag_direct16 + 64), \"r\" (temp_block + 64)\nXMM_CLOBBERS_ONLY(\"%xmm0\", \"%xmm1\", \"%xmm2\", \"%xmm3\",\n\"%xmm4\", \"%xmm5\", \"%xmm6\", \"%xmm7\")\n);", "}else{", "__asm__ volatile(\n\"movd %%\"REG_a\", \"MM\"3 \\n\\t\"\nSPREADW(MM\"3\")\n\"pxor \"MM\"7, \"MM\"7 \\n\\t\"\n\"pxor \"MM\"4, \"MM\"4 \\n\\t\"\n\"mov $-128, %%\"REG_a\" \\n\\t\"\n\".p2align 4 \\n\\t\"\n\"1: \\n\\t\"\nMOVQ\" (%1, %%\"REG_a\"), \"MM\"0 \\n\\t\"\nSAVE_SIGN(MM\"1\", MM\"0\")\nMOVQ\" (%3, %%\"REG_a\"), \"MM\"6 \\n\\t\"\n\"paddusw \"MM\"6, \"MM\"0 \\n\\t\" + bias[0]\nMOVQ\" (%2, %%\"REG_a\"), \"MM\"5 \\n\\t\"\n\"pmulhw \"MM\"5, \"MM\"0 \\n\\t\"\n\"por \"MM\"0, \"MM\"4 \\n\\t\"\nRESTORE_SIGN(MM\"1\", MM\"0\")\nMOVQ\" \"MM\"0, (%5, %%\"REG_a\") \\n\\t\"\n\"pcmpeqw \"MM\"7, \"MM\"0 \\n\\t\"\nMOVQ\" (%4, %%\"REG_a\"), \"MM\"1 \\n\\t\"\nMOVQ\" \"MM\"7, (%1, %%\"REG_a\") \\n\\t\"\n\"pandn \"MM\"1, \"MM\"0 \\n\\t\"\nPMAXW(MM\"0\", MM\"3\")\n\"add $\"MMREG_WIDTH\", %%\"REG_a\" \\n\\t\"\n\" js 1b \\n\\t\"\nPMAX(MM\"3\", MM\"0\")\n\"movd \"MM\"3, %%\"REG_a\" \\n\\t\"\n\"movzbl %%al, %%eax \\n\\t\"\n: \"+a\" (last_non_zero_p1)\n: \"r\" (block+64), \"r\" (VAR_2+64), \"r\" (bias+64),\n\"r\" (inv_zigzag_direct16 + 64), \"r\" (temp_block + 64)\nXMM_CLOBBERS_ONLY(\"%xmm0\", \"%xmm1\", \"%xmm2\", \"%xmm3\",\n\"%xmm4\", \"%xmm5\", \"%xmm6\", \"%xmm7\")\n);", "}", "__asm__ volatile(\n\"movd %1, \"MM\"1 \\n\\t\"\nSPREADW(MM\"1\")\n\"psubusw \"MM\"1, \"MM\"4 \\n\\t\"\n\"packuswb \"MM\"4, \"MM\"4 \\n\\t\"\n#if COMPILE_TEMPLATE_SSE2\n\"packuswb \"MM\"4, \"MM\"4 \\n\\t\"\n#endif\n\"movd \"MM\"4, %0 \\n\\t\"\n: \"=g\" (*overflow)\n: \"g\" (s->max_qcoeff)\n);", "if(s->mb_intra) block[0]= VAR_0;", "else block[0]= temp_block[0];", "if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){", "if(last_non_zero_p1 <= 1) goto end;", "block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];", "block[0x20] = temp_block[0x10];", "if(last_non_zero_p1 <= 4) goto end;", "block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];", "block[0x09] = temp_block[0x03];", "if(last_non_zero_p1 <= 7) goto end;", "block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];", "block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];", "if(last_non_zero_p1 <= 11) goto end;", "block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];", "block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];", "block[0x0C] = temp_block[0x05];", "if(last_non_zero_p1 <= 16) goto end;", "block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];", "block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];", "block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];", "block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];", "if(last_non_zero_p1 <= 24) goto end;", "block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];", "block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];", "block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];", "block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];", "if(last_non_zero_p1 <= 32) goto end;", "block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];", "block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];", "block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];", "block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];", "if(last_non_zero_p1 <= 40) goto end;", "block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];", "block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];", "block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];", "block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];", "if(last_non_zero_p1 <= 48) goto end;", "block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];", "block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];", "block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];", "block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];", "if(last_non_zero_p1 <= 56) goto end;", "block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];", "block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];", "block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];", "block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];", "}else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){", "if(last_non_zero_p1 <= 1) goto end;", "block[0x04] = temp_block[0x01];", "block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];", "if(last_non_zero_p1 <= 4) goto end;", "block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];", "block[0x05] = temp_block[0x03];", "if(last_non_zero_p1 <= 7) goto end;", "block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];", "block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];", "if(last_non_zero_p1 <= 11) goto end;", "block[0x1C] = temp_block[0x19];", "block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];", "block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];", "if(last_non_zero_p1 <= 16) goto end;", "block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];", "block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];", "block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];", "block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];", "if(last_non_zero_p1 <= 24) goto end;", "block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];", "block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];", "block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];", "block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];", "if(last_non_zero_p1 <= 32) goto end;", "block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];", "block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];", "block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];", "block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];", "if(last_non_zero_p1 <= 40) goto end;", "block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];", "block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];", "block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];", "block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];", "if(last_non_zero_p1 <= 48) goto end;", "block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];", "block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];", "block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];", "block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];", "if(last_non_zero_p1 <= 56) goto end;", "block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];", "block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];", "block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];", "block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];", "}else{", "if(last_non_zero_p1 <= 1) goto end;", "block[0x01] = temp_block[0x01];", "block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];", "if(last_non_zero_p1 <= 4) goto end;", "block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];", "block[0x03] = temp_block[0x03];", "if(last_non_zero_p1 <= 7) goto end;", "block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];", "block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];", "if(last_non_zero_p1 <= 11) goto end;", "block[0x19] = temp_block[0x19];", "block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];", "block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];", "if(last_non_zero_p1 <= 16) goto end;", "block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];", "block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];", "block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];", "block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];", "if(last_non_zero_p1 <= 24) goto end;", "block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];", "block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];", "block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];", "block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];", "if(last_non_zero_p1 <= 32) goto end;", "block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];", "block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];", "block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];", "block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];", "if(last_non_zero_p1 <= 40) goto end;", "block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];", "block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];", "block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];", "block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];", "if(last_non_zero_p1 <= 48) goto end;", "block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];", "block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];", "block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];", "block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];", "if(last_non_zero_p1 <= 56) goto end;", "block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];", "block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];", "block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];", "block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];", "}", "end:\nreturn last_non_zero_p1 - 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63, 65, 67, 69 ], [ 71 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 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, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235 ], [ 237 ], [ 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261 ], [ 265 ], [ 267 ], [ 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 ], [ 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 ] ]
4,073
static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFSequence *sequence = arg; switch(tag) { case 0x0202: sequence->duration = avio_rb64(pb); break; case 0x0201: avio_read(pb, sequence->data_definition_ul, 16); break; case 0x1001: sequence->structural_components_count = avio_rb32(pb); if (sequence->structural_components_count >= UINT_MAX / sizeof(UID)) return -1; sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } return 0; }
true
FFmpeg
fd34dbea58e097609ff09cf7dcc59f74930195d3
static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFSequence *sequence = arg; switch(tag) { case 0x0202: sequence->duration = avio_rb64(pb); break; case 0x0201: avio_read(pb, sequence->data_definition_ul, 16); break; case 0x1001: sequence->structural_components_count = avio_rb32(pb); if (sequence->structural_components_count >= UINT_MAX / sizeof(UID)) return -1; sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; avio_skip(pb, 4); avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } return 0; }
{ "code": [ "static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid)" ], "line_no": [ 1 ] }
static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4) { MXFSequence *sequence = VAR_0; switch(VAR_2) { case 0x0202: sequence->duration = avio_rb64(VAR_1); break; case 0x0201: avio_read(VAR_1, sequence->data_definition_ul, 16); break; case 0x1001: sequence->structural_components_count = avio_rb32(VAR_1); if (sequence->structural_components_count >= UINT_MAX / sizeof(UID)) return -1; sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; avio_skip(VAR_1, 4); avio_read(VAR_1, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } return 0; }
[ "static int FUNC_0(void *VAR_0, AVIOContext *VAR_1, int VAR_2, int VAR_3, UID VAR_4)\n{", "MXFSequence *sequence = VAR_0;", "switch(VAR_2) {", "case 0x0202:\nsequence->duration = avio_rb64(VAR_1);", "break;", "case 0x0201:\navio_read(VAR_1, sequence->data_definition_ul, 16);", "break;", "case 0x1001:\nsequence->structural_components_count = avio_rb32(VAR_1);", "if (sequence->structural_components_count >= UINT_MAX / sizeof(UID))\nreturn -1;", "sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));", "if (!sequence->structural_components_refs)\nreturn -1;", "avio_skip(VAR_1, 4);", "avio_read(VAR_1, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));", "break;", "}", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
4,074
World *world_alloc(Rocker *r, size_t sizeof_private, enum rocker_world_type type, WorldOps *ops) { World *w = g_malloc0(sizeof(World) + sizeof_private); if (w) { w->r = r; w->type = type; w->ops = ops; if (w->ops->init) { w->ops->init(w); } } return w; }
true
qemu
107e4b352cc309f9bd7588ef1a44549200620078
World *world_alloc(Rocker *r, size_t sizeof_private, enum rocker_world_type type, WorldOps *ops) { World *w = g_malloc0(sizeof(World) + sizeof_private); if (w) { w->r = r; w->type = type; w->ops = ops; if (w->ops->init) { w->ops->init(w); } } return w; }
{ "code": [ " if (w) {", " w->r = r;", " w->type = type;", " w->ops = ops;", " if (w->ops->init) {", " w->ops->init(w);" ], "line_no": [ 11, 13, 15, 17, 19, 21 ] }
World *FUNC_0(Rocker *r, size_t sizeof_private, enum rocker_world_type type, WorldOps *ops) { World *w = g_malloc0(sizeof(World) + sizeof_private); if (w) { w->r = r; w->type = type; w->ops = ops; if (w->ops->init) { w->ops->init(w); } } return w; }
[ "World *FUNC_0(Rocker *r, size_t sizeof_private,\nenum rocker_world_type type, WorldOps *ops)\n{", "World *w = g_malloc0(sizeof(World) + sizeof_private);", "if (w) {", "w->r = r;", "w->type = type;", "w->ops = ops;", "if (w->ops->init) {", "w->ops->init(w);", "}", "}", "return w;", "}" ]
[ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
4,075
void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt) { int frame_size; *pnum = 0; *pden = 0; switch(st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: if (st->avg_frame_rate.num) { *pnum = st->avg_frame_rate.den; *pden = st->avg_frame_rate.num; } else if(st->time_base.num*1000LL > st->time_base.den) { *pnum = st->time_base.num; *pden = st->time_base.den; }else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){ *pnum = st->codec->time_base.num; *pden = st->codec->time_base.den; if (pc && pc->repeat_pict) { *pnum = (*pnum) * (1 + pc->repeat_pict); } //If this codec can be interlaced or progressive then we need a parser to compute duration of a packet //Thus if we have no parser in such case leave duration undefined. if(st->codec->ticks_per_frame>1 && !pc){ *pnum = *pden = 0; } } break; case AVMEDIA_TYPE_AUDIO: frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0); if (frame_size <= 0 || st->codec->sample_rate <= 0) break; *pnum = frame_size; *pden = st->codec->sample_rate; break; default: break; } }
true
FFmpeg
7709ce029a7bc101b9ac1ceee607cda10dcb89dc
void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt) { int frame_size; *pnum = 0; *pden = 0; switch(st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: if (st->avg_frame_rate.num) { *pnum = st->avg_frame_rate.den; *pden = st->avg_frame_rate.num; } else if(st->time_base.num*1000LL > st->time_base.den) { *pnum = st->time_base.num; *pden = st->time_base.den; }else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){ *pnum = st->codec->time_base.num; *pden = st->codec->time_base.den; if (pc && pc->repeat_pict) { *pnum = (*pnum) * (1 + pc->repeat_pict); } if(st->codec->ticks_per_frame>1 && !pc){ *pnum = *pden = 0; } } break; case AVMEDIA_TYPE_AUDIO: frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0); if (frame_size <= 0 || st->codec->sample_rate <= 0) break; *pnum = frame_size; *pden = st->codec->sample_rate; break; default: break; } }
{ "code": [ " *pnum = (*pnum) * (1 + pc->repeat_pict);" ], "line_no": [ 39 ] }
void FUNC_0(int *VAR_0, int *VAR_1, AVStream *VAR_2, AVCodecParserContext *VAR_3, AVPacket *VAR_4) { int VAR_5; *VAR_0 = 0; *VAR_1 = 0; switch(VAR_2->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: if (VAR_2->avg_frame_rate.num) { *VAR_0 = VAR_2->avg_frame_rate.den; *VAR_1 = VAR_2->avg_frame_rate.num; } else if(VAR_2->time_base.num*1000LL > VAR_2->time_base.den) { *VAR_0 = VAR_2->time_base.num; *VAR_1 = VAR_2->time_base.den; }else if(VAR_2->codec->time_base.num*1000LL > VAR_2->codec->time_base.den){ *VAR_0 = VAR_2->codec->time_base.num; *VAR_1 = VAR_2->codec->time_base.den; if (VAR_3 && VAR_3->repeat_pict) { *VAR_0 = (*VAR_0) * (1 + VAR_3->repeat_pict); } if(VAR_2->codec->ticks_per_frame>1 && !VAR_3){ *VAR_0 = *VAR_1 = 0; } } break; case AVMEDIA_TYPE_AUDIO: VAR_5 = ff_get_audio_frame_size(VAR_2->codec, VAR_4->size, 0); if (VAR_5 <= 0 || VAR_2->codec->sample_rate <= 0) break; *VAR_0 = VAR_5; *VAR_1 = VAR_2->codec->sample_rate; break; default: break; } }
[ "void FUNC_0(int *VAR_0, int *VAR_1, AVStream *VAR_2,\nAVCodecParserContext *VAR_3, AVPacket *VAR_4)\n{", "int VAR_5;", "*VAR_0 = 0;", "*VAR_1 = 0;", "switch(VAR_2->codec->codec_type) {", "case AVMEDIA_TYPE_VIDEO:\nif (VAR_2->avg_frame_rate.num) {", "*VAR_0 = VAR_2->avg_frame_rate.den;", "*VAR_1 = VAR_2->avg_frame_rate.num;", "} else if(VAR_2->time_base.num*1000LL > VAR_2->time_base.den) {", "*VAR_0 = VAR_2->time_base.num;", "*VAR_1 = VAR_2->time_base.den;", "}else if(VAR_2->codec->time_base.num*1000LL > VAR_2->codec->time_base.den){", "*VAR_0 = VAR_2->codec->time_base.num;", "*VAR_1 = VAR_2->codec->time_base.den;", "if (VAR_3 && VAR_3->repeat_pict) {", "*VAR_0 = (*VAR_0) * (1 + VAR_3->repeat_pict);", "}", "if(VAR_2->codec->ticks_per_frame>1 && !VAR_3){", "*VAR_0 = *VAR_1 = 0;", "}", "}", "break;", "case AVMEDIA_TYPE_AUDIO:\nVAR_5 = ff_get_audio_frame_size(VAR_2->codec, VAR_4->size, 0);", "if (VAR_5 <= 0 || VAR_2->codec->sample_rate <= 0)\nbreak;", "*VAR_0 = VAR_5;", "*VAR_1 = VAR_2->codec->sample_rate;", "break;", "default:\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 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 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ] ]
4,077
static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { if(s->fcr & UART_FCR_FE) { ret = fifo8_is_full(&s->recv_fifo) ? 0 : fifo8_pop(&s->recv_fifo); if (s->recv_fifo.num == 0) { s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); } else { qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4); } s->timeout_ipending = 0; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); } serial_update_irq(s); if (!(s->mcr & UART_MCR_LOOP)) { /* in loopback mode, don't receive any data */ qemu_chr_accept_input(s->chr); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { ret = (s->divider >> 8) & 0xff; } else { ret = s->ier; } break; case 2: ret = s->iir; if ((ret & UART_IIR_ID) == UART_IIR_THRI) { s->thr_ipending = 0; serial_update_irq(s); } break; case 3: ret = s->lcr; break; case 4: ret = s->mcr; break; case 5: ret = s->lsr; /* Clear break and overrun interrupts */ if (s->lsr & (UART_LSR_BI|UART_LSR_OE)) { s->lsr &= ~(UART_LSR_BI|UART_LSR_OE); serial_update_irq(s); } break; case 6: if (s->mcr & UART_MCR_LOOP) { /* in loopback, the modem output pins are connected to the inputs */ ret = (s->mcr & 0x0c) << 4; ret |= (s->mcr & 0x02) << 3; ret |= (s->mcr & 0x01) << 5; } else { if (s->poll_msl >= 0) serial_update_msl(s); ret = s->msr; /* Clear delta bits & msr int after read, if they were set */ if (s->msr & UART_MSR_ANY_DELTA) { s->msr &= 0xF0; serial_update_irq(s); } } break; case 7: ret = s->scr; break; } DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret); return ret; }
true
qemu
b165b0d8e62bb65a02d7670d75ebb77a9280bde1
static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { if(s->fcr & UART_FCR_FE) { ret = fifo8_is_full(&s->recv_fifo) ? 0 : fifo8_pop(&s->recv_fifo); if (s->recv_fifo.num == 0) { s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); } else { qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4); } s->timeout_ipending = 0; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); } serial_update_irq(s); if (!(s->mcr & UART_MCR_LOOP)) { qemu_chr_accept_input(s->chr); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { ret = (s->divider >> 8) & 0xff; } else { ret = s->ier; } break; case 2: ret = s->iir; if ((ret & UART_IIR_ID) == UART_IIR_THRI) { s->thr_ipending = 0; serial_update_irq(s); } break; case 3: ret = s->lcr; break; case 4: ret = s->mcr; break; case 5: ret = s->lsr; if (s->lsr & (UART_LSR_BI|UART_LSR_OE)) { s->lsr &= ~(UART_LSR_BI|UART_LSR_OE); serial_update_irq(s); } break; case 6: if (s->mcr & UART_MCR_LOOP) { ret = (s->mcr & 0x0c) << 4; ret |= (s->mcr & 0x02) << 3; ret |= (s->mcr & 0x01) << 5; } else { if (s->poll_msl >= 0) serial_update_msl(s); ret = s->msr; if (s->msr & UART_MSR_ANY_DELTA) { s->msr &= 0xF0; serial_update_irq(s); } } break; case 7: ret = s->scr; break; } DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret); return ret; }
{ "code": [ " ret = fifo8_is_full(&s->recv_fifo) ?" ], "line_no": [ 27 ] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { if(s->fcr & UART_FCR_FE) { ret = fifo8_is_full(&s->recv_fifo) ? 0 : fifo8_pop(&s->recv_fifo); if (s->recv_fifo.num == 0) { s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); } else { qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4); } s->timeout_ipending = 0; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); } serial_update_irq(s); if (!(s->mcr & UART_MCR_LOOP)) { qemu_chr_accept_input(s->chr); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { ret = (s->divider >> 8) & 0xff; } else { ret = s->ier; } break; case 2: ret = s->iir; if ((ret & UART_IIR_ID) == UART_IIR_THRI) { s->thr_ipending = 0; serial_update_irq(s); } break; case 3: ret = s->lcr; break; case 4: ret = s->mcr; break; case 5: ret = s->lsr; if (s->lsr & (UART_LSR_BI|UART_LSR_OE)) { s->lsr &= ~(UART_LSR_BI|UART_LSR_OE); serial_update_irq(s); } break; case 6: if (s->mcr & UART_MCR_LOOP) { ret = (s->mcr & 0x0c) << 4; ret |= (s->mcr & 0x02) << 3; ret |= (s->mcr & 0x01) << 5; } else { if (s->poll_msl >= 0) serial_update_msl(s); ret = s->msr; if (s->msr & UART_MSR_ANY_DELTA) { s->msr &= 0xF0; serial_update_irq(s); } } break; case 7: ret = s->scr; break; } DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret); return ret; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size)\n{", "SerialState *s = opaque;", "uint32_t ret;", "addr &= 7;", "switch(addr) {", "default:\ncase 0:\nif (s->lcr & UART_LCR_DLAB) {", "ret = s->divider & 0xff;", "} else {", "if(s->fcr & UART_FCR_FE) {", "ret = fifo8_is_full(&s->recv_fifo) ?\n0 : fifo8_pop(&s->recv_fifo);", "if (s->recv_fifo.num == 0) {", "s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);", "} else {", "qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);", "}", "s->timeout_ipending = 0;", "} else {", "ret = s->rbr;", "s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);", "}", "serial_update_irq(s);", "if (!(s->mcr & UART_MCR_LOOP)) {", "qemu_chr_accept_input(s->chr);", "}", "}", "break;", "case 1:\nif (s->lcr & UART_LCR_DLAB) {", "ret = (s->divider >> 8) & 0xff;", "} else {", "ret = s->ier;", "}", "break;", "case 2:\nret = s->iir;", "if ((ret & UART_IIR_ID) == UART_IIR_THRI) {", "s->thr_ipending = 0;", "serial_update_irq(s);", "}", "break;", "case 3:\nret = s->lcr;", "break;", "case 4:\nret = s->mcr;", "break;", "case 5:\nret = s->lsr;", "if (s->lsr & (UART_LSR_BI|UART_LSR_OE)) {", "s->lsr &= ~(UART_LSR_BI|UART_LSR_OE);", "serial_update_irq(s);", "}", "break;", "case 6:\nif (s->mcr & UART_MCR_LOOP) {", "ret = (s->mcr & 0x0c) << 4;", "ret |= (s->mcr & 0x02) << 3;", "ret |= (s->mcr & 0x01) << 5;", "} else {", "if (s->poll_msl >= 0)\nserial_update_msl(s);", "ret = s->msr;", "if (s->msr & UART_MSR_ANY_DELTA) {", "s->msr &= 0xF0;", "serial_update_irq(s);", "}", "}", "break;", "case 7:\nret = s->scr;", "break;", "}", "DPRINTF(\"read addr=0x%\" HWADDR_PRIx \" val=0x%02x\\n\", addr, ret);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 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 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ] ]
4,078
create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) { size_t *sizes = g_new0(size_t, nr_iov); size_t count = 0; void *buf = NULL; void *p; int i; for (i = 0; i < nr_iov; i++) { char *arg = argv[i]; int64_t len; len = cvtnum(arg); if (len < 0) { print_cvtnum_err(len, arg); goto fail; } if (len > SIZE_MAX) { printf("Argument '%s' exceeds maximum size %llu\n", arg, (unsigned long long)SIZE_MAX); goto fail; } sizes[i] = len; count += len; } qemu_iovec_init(qiov, nr_iov); buf = p = qemu_io_alloc(blk, count, pattern); for (i = 0; i < nr_iov; i++) { qemu_iovec_add(qiov, p, sizes[i]); p += sizes[i]; } fail: g_free(sizes); return buf; }
true
qemu
3026c4688ca80d9c5cc1606368c4a1009a6f507d
create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) { size_t *sizes = g_new0(size_t, nr_iov); size_t count = 0; void *buf = NULL; void *p; int i; for (i = 0; i < nr_iov; i++) { char *arg = argv[i]; int64_t len; len = cvtnum(arg); if (len < 0) { print_cvtnum_err(len, arg); goto fail; } if (len > SIZE_MAX) { printf("Argument '%s' exceeds maximum size %llu\n", arg, (unsigned long long)SIZE_MAX); goto fail; } sizes[i] = len; count += len; } qemu_iovec_init(qiov, nr_iov); buf = p = qemu_io_alloc(blk, count, pattern); for (i = 0; i < nr_iov; i++) { qemu_iovec_add(qiov, p, sizes[i]); p += sizes[i]; } fail: g_free(sizes); return buf; }
{ "code": [ " if (len > SIZE_MAX) {", " printf(\"Argument '%s' exceeds maximum size %llu\\n\", arg,", " (unsigned long long)SIZE_MAX);" ], "line_no": [ 39, 41, 43 ] }
FUNC_0(BlockBackend *VAR_0, QEMUIOVector *VAR_1, char **VAR_2, int VAR_3, int VAR_4) { size_t *sizes = g_new0(size_t, VAR_3); size_t count = 0; void *VAR_5 = NULL; void *VAR_6; int VAR_7; for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) { char *VAR_8 = VAR_2[VAR_7]; int64_t len; len = cvtnum(VAR_8); if (len < 0) { print_cvtnum_err(len, VAR_8); goto fail; } if (len > SIZE_MAX) { printf("Argument '%s' exceeds maximum size %llu\n", VAR_8, (unsigned long long)SIZE_MAX); goto fail; } sizes[VAR_7] = len; count += len; } qemu_iovec_init(VAR_1, VAR_3); VAR_5 = VAR_6 = qemu_io_alloc(VAR_0, count, VAR_4); for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) { qemu_iovec_add(VAR_1, VAR_6, sizes[VAR_7]); VAR_6 += sizes[VAR_7]; } fail: g_free(sizes); return VAR_5; }
[ "FUNC_0(BlockBackend *VAR_0, QEMUIOVector *VAR_1, char **VAR_2, int VAR_3,\nint VAR_4)\n{", "size_t *sizes = g_new0(size_t, VAR_3);", "size_t count = 0;", "void *VAR_5 = NULL;", "void *VAR_6;", "int VAR_7;", "for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {", "char *VAR_8 = VAR_2[VAR_7];", "int64_t len;", "len = cvtnum(VAR_8);", "if (len < 0) {", "print_cvtnum_err(len, VAR_8);", "goto fail;", "}", "if (len > SIZE_MAX) {", "printf(\"Argument '%s' exceeds maximum size %llu\\n\", VAR_8,\n(unsigned long long)SIZE_MAX);", "goto fail;", "}", "sizes[VAR_7] = len;", "count += len;", "}", "qemu_iovec_init(VAR_1, VAR_3);", "VAR_5 = VAR_6 = qemu_io_alloc(VAR_0, count, VAR_4);", "for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {", "qemu_iovec_add(VAR_1, VAR_6, sizes[VAR_7]);", "VAR_6 += sizes[VAR_7];", "}", "fail:\ng_free(sizes);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ] ]
4,079
static bool main_loop_should_exit(void) { RunState r; if (qemu_debug_requested()) { vm_stop(RUN_STATE_DEBUG); } if (qemu_suspend_requested()) { qemu_system_suspend(); } if (qemu_shutdown_requested()) { qemu_kill_report(); monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(RUN_STATE_SHUTDOWN); } else { return true; } } if (qemu_reset_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_REPORT); resume_all_vcpus(); if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { runstate_set(RUN_STATE_PAUSED); } } if (qemu_wakeup_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_SILENT); resume_all_vcpus(); monitor_protocol_event(QEVENT_WAKEUP, NULL); } if (qemu_powerdown_requested()) { qemu_system_powerdown(); } if (qemu_vmstop_requested(&r)) { vm_stop(r); } return false; }
true
qemu
ede085b3fedfde36cb566968c4efcfbad4845af1
static bool main_loop_should_exit(void) { RunState r; if (qemu_debug_requested()) { vm_stop(RUN_STATE_DEBUG); } if (qemu_suspend_requested()) { qemu_system_suspend(); } if (qemu_shutdown_requested()) { qemu_kill_report(); monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(RUN_STATE_SHUTDOWN); } else { return true; } } if (qemu_reset_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_REPORT); resume_all_vcpus(); if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { runstate_set(RUN_STATE_PAUSED); } } if (qemu_wakeup_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_SILENT); resume_all_vcpus(); monitor_protocol_event(QEVENT_WAKEUP, NULL); } if (qemu_powerdown_requested()) { qemu_system_powerdown(); } if (qemu_vmstop_requested(&r)) { vm_stop(r); } return false; }
{ "code": [ " if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||", " runstate_check(RUN_STATE_SHUTDOWN)) {" ], "line_no": [ 47, 49 ] }
static bool FUNC_0(void) { RunState r; if (qemu_debug_requested()) { vm_stop(RUN_STATE_DEBUG); } if (qemu_suspend_requested()) { qemu_system_suspend(); } if (qemu_shutdown_requested()) { qemu_kill_report(); monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(RUN_STATE_SHUTDOWN); } else { return true; } } if (qemu_reset_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_REPORT); resume_all_vcpus(); if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { runstate_set(RUN_STATE_PAUSED); } } if (qemu_wakeup_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_SILENT); resume_all_vcpus(); monitor_protocol_event(QEVENT_WAKEUP, NULL); } if (qemu_powerdown_requested()) { qemu_system_powerdown(); } if (qemu_vmstop_requested(&r)) { vm_stop(r); } return false; }
[ "static bool FUNC_0(void)\n{", "RunState r;", "if (qemu_debug_requested()) {", "vm_stop(RUN_STATE_DEBUG);", "}", "if (qemu_suspend_requested()) {", "qemu_system_suspend();", "}", "if (qemu_shutdown_requested()) {", "qemu_kill_report();", "monitor_protocol_event(QEVENT_SHUTDOWN, NULL);", "if (no_shutdown) {", "vm_stop(RUN_STATE_SHUTDOWN);", "} else {", "return true;", "}", "}", "if (qemu_reset_requested()) {", "pause_all_vcpus();", "cpu_synchronize_all_states();", "qemu_system_reset(VMRESET_REPORT);", "resume_all_vcpus();", "if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||\nrunstate_check(RUN_STATE_SHUTDOWN)) {", "runstate_set(RUN_STATE_PAUSED);", "}", "}", "if (qemu_wakeup_requested()) {", "pause_all_vcpus();", "cpu_synchronize_all_states();", "qemu_system_reset(VMRESET_SILENT);", "resume_all_vcpus();", "monitor_protocol_event(QEVENT_WAKEUP, NULL);", "}", "if (qemu_powerdown_requested()) {", "qemu_system_powerdown();", "}", "if (qemu_vmstop_requested(&r)) {", "vm_stop(r);", "}", "return false;", "}" ]
[ 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 ], [ 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 ] ]
4,082
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) { AVStream *st; MOVStreamContext *sc; int j, pseudo_stream_id; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; for (pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) { //Parsing Sample description table enum CodecID id; int dref_id = 1; MOVAtom a = { AV_RL32("stsd") }; int64_t start_pos = avio_tell(pb); int size = avio_rb32(pb); /* size */ uint32_t format = avio_rl32(pb); /* data format */ if (size >= 16) { avio_rb32(pb); /* reserved */ avio_rb16(pb); /* reserved */ dref_id = avio_rb16(pb); } if (st->codec->codec_tag && st->codec->codec_tag != format && (c->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != c->fc->video_codec_id : st->codec->codec_tag != MKTAG('j','p','e','g')) ){ /* Multiple fourcc, we skip JPEG. This is not correct, we should * export it as a separate AVStream but this needs a few changes * in the MOV demuxer, patch welcome. */ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); avio_skip(pb, size - (avio_tell(pb) - start_pos)); continue; } /* we cannot demux concatenated h264 streams because of different extradata */ if (st->codec->codec_tag && st->codec->codec_tag == AV_RL32("avc1")) goto multiple_stsd; sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id; sc->dref_id= dref_id; st->codec->codec_tag = format; id = ff_codec_get_id(codec_movaudio_tags, format); if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8))) id = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF); if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && id > 0) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && /* do not overwrite codec type */ format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */ id = ff_codec_get_id(codec_movvideo_tags, format); if (id <= 0) id = ff_codec_get_id(ff_codec_bmp_tags, format); if (id > 0) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; else if (st->codec->codec_type == AVMEDIA_TYPE_DATA){ id = ff_codec_get_id(ff_codec_movsubtitle_tags, format); if (id > 0) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; } } av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec->codec_type); if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) { unsigned int color_depth, len; int color_greyscale; st->codec->codec_id = id; avio_rb16(pb); /* version */ avio_rb16(pb); /* revision level */ avio_rb32(pb); /* vendor */ avio_rb32(pb); /* temporal quality */ avio_rb32(pb); /* spatial quality */ st->codec->width = avio_rb16(pb); /* width */ st->codec->height = avio_rb16(pb); /* height */ avio_rb32(pb); /* horiz resolution */ avio_rb32(pb); /* vert resolution */ avio_rb32(pb); /* data size, always 0 */ avio_rb16(pb); /* frames per samples */ len = avio_r8(pb); /* codec name, pascal string */ if (len > 31) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) avio_skip(pb, 31 - len); /* codec_tag YV12 triggers an UV swap in rawdec.c */ if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */ st->codec->color_table_id = avio_rb16(pb); /* colortable id */ av_dlog(c->fc, "depth %d, ctab id %d\n", st->codec->bits_per_coded_sample, st->codec->color_table_id); /* figure out the palette situation */ color_depth = st->codec->bits_per_coded_sample & 0x1F; color_greyscale = st->codec->bits_per_coded_sample & 0x20; /* if the depth is 2, 4, or 8 bpp, file is palettized */ if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) { /* for palette traversal */ unsigned int color_start, color_count, color_end; unsigned char r, g, b; if (color_greyscale) { int color_index, color_dec; /* compute the greyscale palette */ st->codec->bits_per_coded_sample = color_depth; color_count = 1 << color_depth; color_index = 255; color_dec = 256 / (color_count - 1); for (j = 0; j < color_count; j++) { if (id == CODEC_ID_CINEPAK){ r = g = b = color_count - 1 - color_index; }else r = g = b = color_index; sc->palette[j] = (r << 16) | (g << 8) | (b); color_index -= color_dec; if (color_index < 0) color_index = 0; } } else if (st->codec->color_table_id) { const uint8_t *color_table; /* if flag bit 3 is set, use the default palette */ color_count = 1 << color_depth; if (color_depth == 2) color_table = ff_qt_default_palette_4; else if (color_depth == 4) color_table = ff_qt_default_palette_16; else color_table = ff_qt_default_palette_256; for (j = 0; j < color_count; j++) { r = color_table[j * 3 + 0]; g = color_table[j * 3 + 1]; b = color_table[j * 3 + 2]; sc->palette[j] = (r << 16) | (g << 8) | (b); } } else { /* load the palette from the file */ color_start = avio_rb32(pb); color_count = avio_rb16(pb); color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (j = color_start; j <= color_end; j++) { /* each R, G, or B component is 16 bits; * only use the top 8 bits; skip alpha bytes * up front */ avio_r8(pb); avio_r8(pb); r = avio_r8(pb); avio_r8(pb); g = avio_r8(pb); avio_r8(pb); b = avio_r8(pb); avio_r8(pb); sc->palette[j] = (r << 16) | (g << 8) | (b); } } } sc->has_palette = 1; } } else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int bits_per_sample, flags; uint16_t version = avio_rb16(pb); st->codec->codec_id = id; avio_rb16(pb); /* revision level */ avio_rb32(pb); /* vendor */ st->codec->channels = avio_rb16(pb); /* channel count */ av_dlog(c->fc, "audio channels %d\n", st->codec->channels); st->codec->bits_per_coded_sample = avio_rb16(pb); /* sample size */ sc->audio_cid = avio_rb16(pb); avio_rb16(pb); /* packet size = 0 */ st->codec->sample_rate = ((avio_rb32(pb) >> 16)); //Read QT version 1 fields. In version 0 these do not exist. av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom); if (!c->isom) { if (version==1) { sc->samples_per_frame = avio_rb32(pb); avio_rb32(pb); /* bytes per packet */ sc->bytes_per_frame = avio_rb32(pb); avio_rb32(pb); /* bytes per sample */ } else if (version==2) { avio_rb32(pb); /* sizeof struct only */ st->codec->sample_rate = av_int2double(avio_rb64(pb)); /* float 64 */ st->codec->channels = avio_rb32(pb); avio_rb32(pb); /* always 0x7F000000 */ st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */ flags = avio_rb32(pb); /* lpcm format specific flag */ sc->bytes_per_frame = avio_rb32(pb); /* bytes per audio packet if constant */ sc->samples_per_frame = avio_rb32(pb); /* lpcm frames per audio packet if constant */ if (format == MKTAG('l','p','c','m')) st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); } } switch (st->codec->codec_id) { case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: if (st->codec->bits_per_coded_sample == 16) st->codec->codec_id = CODEC_ID_PCM_S16BE; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: if (st->codec->bits_per_coded_sample == 8) st->codec->codec_id = CODEC_ID_PCM_S8; else if (st->codec->bits_per_coded_sample == 24) st->codec->codec_id = st->codec->codec_id == CODEC_ID_PCM_S16BE ? CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE; break; /* set values for old format before stsd version 1 appeared */ case CODEC_ID_MACE3: sc->samples_per_frame = 6; sc->bytes_per_frame = 2*st->codec->channels; break; case CODEC_ID_MACE6: sc->samples_per_frame = 6; sc->bytes_per_frame = 1*st->codec->channels; break; case CODEC_ID_ADPCM_IMA_QT: sc->samples_per_frame = 64; sc->bytes_per_frame = 34*st->codec->channels; break; case CODEC_ID_GSM: sc->samples_per_frame = 160; sc->bytes_per_frame = 33; break; default: break; } bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); if (bits_per_sample) { st->codec->bits_per_coded_sample = bits_per_sample; sc->sample_size = (bits_per_sample >> 3) * st->codec->channels; } } else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){ // ttxt stsd contains display flags, justification, background // color, fonts, and default styles, so fake an atom to read it MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) }; if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom mov_read_glbl(c, pb, fake_atom); st->codec->codec_id= id; st->codec->width = sc->width; st->codec->height = sc->height; } else { if (st->codec->codec_tag == MKTAG('t','m','c','d')) { int val; avio_rb32(pb); /* reserved */ val = avio_rb32(pb); /* flags */ if (val & 1) st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; avio_rb32(pb); avio_rb32(pb); st->codec->time_base.den = avio_r8(pb); st->codec->time_base.num = 1; } /* other codec type, just skip (rtp, mp4s, ...) */ avio_skip(pb, size - (avio_tell(pb) - start_pos)); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ a.size = size - (avio_tell(pb) - start_pos); if (a.size > 8) { if (mov_read_default(c, pb, a) < 0) } else if (a.size > 0) avio_skip(pb, a.size); } if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) st->codec->sample_rate= sc->time_scale; /* special codec parameters handling */ switch (st->codec->codec_id) { #if CONFIG_DV_DEMUXER case CODEC_ID_DVAUDIO: c->dv_fctx = avformat_alloc_context(); c->dv_demux = avpriv_dv_init_demux(c->dv_fctx); if (!c->dv_demux) { av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n"); } sc->dv_audio_container = 1; st->codec->codec_id = CODEC_ID_PCM_S16LE; break; #endif /* no ifdef since parameters are always those */ case CODEC_ID_QCELP: // force sample rate for qcelp when not stored in mov if (st->codec->codec_tag != MKTAG('Q','c','l','p')) st->codec->sample_rate = 8000; st->codec->frame_size= 160; st->codec->channels= 1; /* really needed */ break; case CODEC_ID_AMR_NB: st->codec->channels= 1; /* really needed */ /* force sample rate for amr, stsd in 3gp does not store sample rate */ st->codec->sample_rate = 8000; /* force frame_size, too, samples_per_frame isn't always set properly */ st->codec->frame_size = 160; break; case CODEC_ID_AMR_WB: st->codec->channels = 1; st->codec->sample_rate = 16000; st->codec->frame_size = 320; break; case CODEC_ID_MP2: case CODEC_ID_MP3: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; /* force type after stsd for m1a hdlr */ st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_GSM: case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_IMA_WAV: st->codec->frame_size = sc->samples_per_frame; st->codec->block_align = sc->bytes_per_frame; break; case CODEC_ID_ALAC: if (st->codec->extradata_size == 36) { st->codec->frame_size = AV_RB32(st->codec->extradata+12); st->codec->channels = AV_RB8 (st->codec->extradata+21); st->codec->sample_rate = AV_RB32(st->codec->extradata+32); } break; case CODEC_ID_AC3: st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_MPEG1VIDEO: st->need_parsing = AVSTREAM_PARSE_FULL; break; default: break; } return 0; }
true
FFmpeg
5f95c130a020ec8f6eb7ade8808f59dac5834410
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) { AVStream *st; MOVStreamContext *sc; int j, pseudo_stream_id; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; for (pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) { enum CodecID id; int dref_id = 1; MOVAtom a = { AV_RL32("stsd") }; int64_t start_pos = avio_tell(pb); int size = avio_rb32(pb); uint32_t format = avio_rl32(pb); if (size >= 16) { avio_rb32(pb); avio_rb16(pb); dref_id = avio_rb16(pb); } if (st->codec->codec_tag && st->codec->codec_tag != format && (c->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != c->fc->video_codec_id : st->codec->codec_tag != MKTAG('j','p','e','g')) ){ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); avio_skip(pb, size - (avio_tell(pb) - start_pos)); continue; } if (st->codec->codec_tag && st->codec->codec_tag == AV_RL32("avc1")) goto multiple_stsd; sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id; sc->dref_id= dref_id; st->codec->codec_tag = format; id = ff_codec_get_id(codec_movaudio_tags, format); if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8))) id = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF); if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && id > 0) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && format && format != MKTAG('m','p','4','s')) { id = ff_codec_get_id(codec_movvideo_tags, format); if (id <= 0) id = ff_codec_get_id(ff_codec_bmp_tags, format); if (id > 0) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; else if (st->codec->codec_type == AVMEDIA_TYPE_DATA){ id = ff_codec_get_id(ff_codec_movsubtitle_tags, format); if (id > 0) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; } } av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec->codec_type); if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) { unsigned int color_depth, len; int color_greyscale; st->codec->codec_id = id; avio_rb16(pb); avio_rb16(pb); avio_rb32(pb); avio_rb32(pb); avio_rb32(pb); st->codec->width = avio_rb16(pb); st->codec->height = avio_rb16(pb); avio_rb32(pb); avio_rb32(pb); avio_rb32(pb); avio_rb16(pb); len = avio_r8(pb); if (len > 31) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) avio_skip(pb, 31 - len); if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); st->codec->bits_per_coded_sample = avio_rb16(pb); st->codec->color_table_id = avio_rb16(pb); av_dlog(c->fc, "depth %d, ctab id %d\n", st->codec->bits_per_coded_sample, st->codec->color_table_id); color_depth = st->codec->bits_per_coded_sample & 0x1F; color_greyscale = st->codec->bits_per_coded_sample & 0x20; if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) { unsigned int color_start, color_count, color_end; unsigned char r, g, b; if (color_greyscale) { int color_index, color_dec; st->codec->bits_per_coded_sample = color_depth; color_count = 1 << color_depth; color_index = 255; color_dec = 256 / (color_count - 1); for (j = 0; j < color_count; j++) { if (id == CODEC_ID_CINEPAK){ r = g = b = color_count - 1 - color_index; }else r = g = b = color_index; sc->palette[j] = (r << 16) | (g << 8) | (b); color_index -= color_dec; if (color_index < 0) color_index = 0; } } else if (st->codec->color_table_id) { const uint8_t *color_table; color_count = 1 << color_depth; if (color_depth == 2) color_table = ff_qt_default_palette_4; else if (color_depth == 4) color_table = ff_qt_default_palette_16; else color_table = ff_qt_default_palette_256; for (j = 0; j < color_count; j++) { r = color_table[j * 3 + 0]; g = color_table[j * 3 + 1]; b = color_table[j * 3 + 2]; sc->palette[j] = (r << 16) | (g << 8) | (b); } } else { color_start = avio_rb32(pb); color_count = avio_rb16(pb); color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (j = color_start; j <= color_end; j++) { avio_r8(pb); avio_r8(pb); r = avio_r8(pb); avio_r8(pb); g = avio_r8(pb); avio_r8(pb); b = avio_r8(pb); avio_r8(pb); sc->palette[j] = (r << 16) | (g << 8) | (b); } } } sc->has_palette = 1; } } else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int bits_per_sample, flags; uint16_t version = avio_rb16(pb); st->codec->codec_id = id; avio_rb16(pb); avio_rb32(pb); st->codec->channels = avio_rb16(pb); av_dlog(c->fc, "audio channels %d\n", st->codec->channels); st->codec->bits_per_coded_sample = avio_rb16(pb); sc->audio_cid = avio_rb16(pb); avio_rb16(pb); st->codec->sample_rate = ((avio_rb32(pb) >> 16)); av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom); if (!c->isom) { if (version==1) { sc->samples_per_frame = avio_rb32(pb); avio_rb32(pb); sc->bytes_per_frame = avio_rb32(pb); avio_rb32(pb); } else if (version==2) { avio_rb32(pb); st->codec->sample_rate = av_int2double(avio_rb64(pb)); st->codec->channels = avio_rb32(pb); avio_rb32(pb); st->codec->bits_per_coded_sample = avio_rb32(pb); flags = avio_rb32(pb); sc->bytes_per_frame = avio_rb32(pb); sc->samples_per_frame = avio_rb32(pb); if (format == MKTAG('l','p','c','m')) st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); } } switch (st->codec->codec_id) { case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: if (st->codec->bits_per_coded_sample == 16) st->codec->codec_id = CODEC_ID_PCM_S16BE; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: if (st->codec->bits_per_coded_sample == 8) st->codec->codec_id = CODEC_ID_PCM_S8; else if (st->codec->bits_per_coded_sample == 24) st->codec->codec_id = st->codec->codec_id == CODEC_ID_PCM_S16BE ? CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE; break; case CODEC_ID_MACE3: sc->samples_per_frame = 6; sc->bytes_per_frame = 2*st->codec->channels; break; case CODEC_ID_MACE6: sc->samples_per_frame = 6; sc->bytes_per_frame = 1*st->codec->channels; break; case CODEC_ID_ADPCM_IMA_QT: sc->samples_per_frame = 64; sc->bytes_per_frame = 34*st->codec->channels; break; case CODEC_ID_GSM: sc->samples_per_frame = 160; sc->bytes_per_frame = 33; break; default: break; } bits_per_sample = av_get_bits_per_sample(st->codec->codec_id); if (bits_per_sample) { st->codec->bits_per_coded_sample = bits_per_sample; sc->sample_size = (bits_per_sample >> 3) * st->codec->channels; } } else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){ MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) }; if (format != AV_RL32("mp4s")) mov_read_glbl(c, pb, fake_atom); st->codec->codec_id= id; st->codec->width = sc->width; st->codec->height = sc->height; } else { if (st->codec->codec_tag == MKTAG('t','m','c','d')) { int val; avio_rb32(pb); val = avio_rb32(pb); if (val & 1) st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; avio_rb32(pb); avio_rb32(pb); st->codec->time_base.den = avio_r8(pb); st->codec->time_base.num = 1; } avio_skip(pb, size - (avio_tell(pb) - start_pos)); } a.size = size - (avio_tell(pb) - start_pos); if (a.size > 8) { if (mov_read_default(c, pb, a) < 0) } else if (a.size > 0) avio_skip(pb, a.size); } if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) st->codec->sample_rate= sc->time_scale; switch (st->codec->codec_id) { #if CONFIG_DV_DEMUXER case CODEC_ID_DVAUDIO: c->dv_fctx = avformat_alloc_context(); c->dv_demux = avpriv_dv_init_demux(c->dv_fctx); if (!c->dv_demux) { av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n"); } sc->dv_audio_container = 1; st->codec->codec_id = CODEC_ID_PCM_S16LE; break; #endif case CODEC_ID_QCELP: if (st->codec->codec_tag != MKTAG('Q','c','l','p')) st->codec->sample_rate = 8000; st->codec->frame_size= 160; st->codec->channels= 1; break; case CODEC_ID_AMR_NB: st->codec->channels= 1; st->codec->sample_rate = 8000; st->codec->frame_size = 160; break; case CODEC_ID_AMR_WB: st->codec->channels = 1; st->codec->sample_rate = 16000; st->codec->frame_size = 320; break; case CODEC_ID_MP2: case CODEC_ID_MP3: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_GSM: case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_IMA_WAV: st->codec->frame_size = sc->samples_per_frame; st->codec->block_align = sc->bytes_per_frame; break; case CODEC_ID_ALAC: if (st->codec->extradata_size == 36) { st->codec->frame_size = AV_RB32(st->codec->extradata+12); st->codec->channels = AV_RB8 (st->codec->extradata+21); st->codec->sample_rate = AV_RB32(st->codec->extradata+32); } break; case CODEC_ID_AC3: st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_MPEG1VIDEO: st->need_parsing = AVSTREAM_PARSE_FULL; break; default: break; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, int VAR_2) { AVStream *st; MOVStreamContext *sc; int VAR_3, VAR_4; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; for (VAR_4=0; VAR_4<VAR_2; VAR_4++) { enum CodecID VAR_5; int VAR_6 = 1; MOVAtom a = { AV_RL32("stsd") }; int64_t start_pos = avio_tell(VAR_1); int VAR_7 = avio_rb32(VAR_1); uint32_t format = avio_rl32(VAR_1); if (VAR_7 >= 16) { avio_rb32(VAR_1); avio_rb16(VAR_1); VAR_6 = avio_rb16(VAR_1); } if (st->codec->codec_tag && st->codec->codec_tag != format && (VAR_0->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != VAR_0->fc->video_codec_id : st->codec->codec_tag != MKTAG('VAR_3','p','e','VAR_15')) ){ multiple_stsd: av_log(VAR_0->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); avio_skip(VAR_1, VAR_7 - (avio_tell(VAR_1) - start_pos)); continue; } if (st->codec->codec_tag && st->codec->codec_tag == AV_RL32("avc1")) goto multiple_stsd; sc->VAR_4 = st->codec->codec_tag ? -1 : VAR_4; sc->VAR_6= VAR_6; st->codec->codec_tag = format; VAR_5 = ff_codec_get_id(codec_movaudio_tags, format); if (VAR_5<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8))) VAR_5 = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF); if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && VAR_5 > 0) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && format && format != MKTAG('m','p','4','s')) { VAR_5 = ff_codec_get_id(codec_movvideo_tags, format); if (VAR_5 <= 0) VAR_5 = ff_codec_get_id(ff_codec_bmp_tags, format); if (VAR_5 > 0) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; else if (st->codec->codec_type == AVMEDIA_TYPE_DATA){ VAR_5 = ff_codec_get_id(ff_codec_movsubtitle_tags, format); if (VAR_5 > 0) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; } } av_dlog(VAR_0->fc, "VAR_7=%d 4CC= %VAR_0%VAR_0%VAR_0%VAR_0 codec_type=%d\n", VAR_7, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec->codec_type); if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) { unsigned int VAR_8, VAR_9; int VAR_10; st->codec->codec_id = VAR_5; avio_rb16(VAR_1); avio_rb16(VAR_1); avio_rb32(VAR_1); avio_rb32(VAR_1); avio_rb32(VAR_1); st->codec->width = avio_rb16(VAR_1); st->codec->height = avio_rb16(VAR_1); avio_rb32(VAR_1); avio_rb32(VAR_1); avio_rb32(VAR_1); avio_rb16(VAR_1); VAR_9 = avio_r8(VAR_1); if (VAR_9 > 31) VAR_9 = 31; mov_read_mac_string(VAR_0, VAR_1, VAR_9, st->codec->codec_name, 32); if (VAR_9 < 31) avio_skip(VAR_1, 31 - VAR_9); if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); st->codec->bits_per_coded_sample = avio_rb16(VAR_1); st->codec->color_table_id = avio_rb16(VAR_1); av_dlog(VAR_0->fc, "depth %d, ctab VAR_5 %d\n", st->codec->bits_per_coded_sample, st->codec->color_table_id); VAR_8 = st->codec->bits_per_coded_sample & 0x1F; VAR_10 = st->codec->bits_per_coded_sample & 0x20; if ((VAR_8 == 2) || (VAR_8 == 4) || (VAR_8 == 8)) { unsigned int VAR_11, VAR_12, VAR_13; unsigned char VAR_14, VAR_15, VAR_16; if (VAR_10) { int VAR_17, VAR_18; st->codec->bits_per_coded_sample = VAR_8; VAR_12 = 1 << VAR_8; VAR_17 = 255; VAR_18 = 256 / (VAR_12 - 1); for (VAR_3 = 0; VAR_3 < VAR_12; VAR_3++) { if (VAR_5 == CODEC_ID_CINEPAK){ VAR_14 = VAR_15 = VAR_16 = VAR_12 - 1 - VAR_17; }else VAR_14 = VAR_15 = VAR_16 = VAR_17; sc->palette[VAR_3] = (VAR_14 << 16) | (VAR_15 << 8) | (VAR_16); VAR_17 -= VAR_18; if (VAR_17 < 0) VAR_17 = 0; } } else if (st->codec->color_table_id) { const uint8_t *VAR_19; VAR_12 = 1 << VAR_8; if (VAR_8 == 2) VAR_19 = ff_qt_default_palette_4; else if (VAR_8 == 4) VAR_19 = ff_qt_default_palette_16; else VAR_19 = ff_qt_default_palette_256; for (VAR_3 = 0; VAR_3 < VAR_12; VAR_3++) { VAR_14 = VAR_19[VAR_3 * 3 + 0]; VAR_15 = VAR_19[VAR_3 * 3 + 1]; VAR_16 = VAR_19[VAR_3 * 3 + 2]; sc->palette[VAR_3] = (VAR_14 << 16) | (VAR_15 << 8) | (VAR_16); } } else { VAR_11 = avio_rb32(VAR_1); VAR_12 = avio_rb16(VAR_1); VAR_13 = avio_rb16(VAR_1); if ((VAR_11 <= 255) && (VAR_13 <= 255)) { for (VAR_3 = VAR_11; VAR_3 <= VAR_13; VAR_3++) { avio_r8(VAR_1); avio_r8(VAR_1); VAR_14 = avio_r8(VAR_1); avio_r8(VAR_1); VAR_15 = avio_r8(VAR_1); avio_r8(VAR_1); VAR_16 = avio_r8(VAR_1); avio_r8(VAR_1); sc->palette[VAR_3] = (VAR_14 << 16) | (VAR_15 << 8) | (VAR_16); } } } sc->has_palette = 1; } } else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int VAR_20, VAR_21; uint16_t version = avio_rb16(VAR_1); st->codec->codec_id = VAR_5; avio_rb16(VAR_1); avio_rb32(VAR_1); st->codec->channels = avio_rb16(VAR_1); av_dlog(VAR_0->fc, "audio channels %d\n", st->codec->channels); st->codec->bits_per_coded_sample = avio_rb16(VAR_1); sc->audio_cid = avio_rb16(VAR_1); avio_rb16(VAR_1); st->codec->sample_rate = ((avio_rb32(VAR_1) >> 16)); av_dlog(VAR_0->fc, "version =%d, isom =%d\n",version,VAR_0->isom); if (!VAR_0->isom) { if (version==1) { sc->samples_per_frame = avio_rb32(VAR_1); avio_rb32(VAR_1); sc->bytes_per_frame = avio_rb32(VAR_1); avio_rb32(VAR_1); } else if (version==2) { avio_rb32(VAR_1); st->codec->sample_rate = av_int2double(avio_rb64(VAR_1)); st->codec->channels = avio_rb32(VAR_1); avio_rb32(VAR_1); st->codec->bits_per_coded_sample = avio_rb32(VAR_1); VAR_21 = avio_rb32(VAR_1); sc->bytes_per_frame = avio_rb32(VAR_1); sc->samples_per_frame = avio_rb32(VAR_1); if (format == MKTAG('l','p','VAR_0','m')) st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, VAR_21); } } switch (st->codec->codec_id) { case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: if (st->codec->bits_per_coded_sample == 16) st->codec->codec_id = CODEC_ID_PCM_S16BE; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: if (st->codec->bits_per_coded_sample == 8) st->codec->codec_id = CODEC_ID_PCM_S8; else if (st->codec->bits_per_coded_sample == 24) st->codec->codec_id = st->codec->codec_id == CODEC_ID_PCM_S16BE ? CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE; break; case CODEC_ID_MACE3: sc->samples_per_frame = 6; sc->bytes_per_frame = 2*st->codec->channels; break; case CODEC_ID_MACE6: sc->samples_per_frame = 6; sc->bytes_per_frame = 1*st->codec->channels; break; case CODEC_ID_ADPCM_IMA_QT: sc->samples_per_frame = 64; sc->bytes_per_frame = 34*st->codec->channels; break; case CODEC_ID_GSM: sc->samples_per_frame = 160; sc->bytes_per_frame = 33; break; default: break; } VAR_20 = av_get_bits_per_sample(st->codec->codec_id); if (VAR_20) { st->codec->bits_per_coded_sample = VAR_20; sc->sample_size = (VAR_20 >> 3) * st->codec->channels; } } else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){ MOVAtom fake_atom = { .VAR_7 = VAR_7 - (avio_tell(VAR_1) - start_pos) }; if (format != AV_RL32("mp4s")) mov_read_glbl(VAR_0, VAR_1, fake_atom); st->codec->codec_id= VAR_5; st->codec->width = sc->width; st->codec->height = sc->height; } else { if (st->codec->codec_tag == MKTAG('t','m','VAR_0','d')) { int VAR_22; avio_rb32(VAR_1); VAR_22 = avio_rb32(VAR_1); if (VAR_22 & 1) st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; avio_rb32(VAR_1); avio_rb32(VAR_1); st->codec->time_base.den = avio_r8(VAR_1); st->codec->time_base.num = 1; } avio_skip(VAR_1, VAR_7 - (avio_tell(VAR_1) - start_pos)); } a.VAR_7 = VAR_7 - (avio_tell(VAR_1) - start_pos); if (a.VAR_7 > 8) { if (mov_read_default(VAR_0, VAR_1, a) < 0) } else if (a.VAR_7 > 0) avio_skip(VAR_1, a.VAR_7); } if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) st->codec->sample_rate= sc->time_scale; switch (st->codec->codec_id) { #if CONFIG_DV_DEMUXER case CODEC_ID_DVAUDIO: VAR_0->dv_fctx = avformat_alloc_context(); VAR_0->dv_demux = avpriv_dv_init_demux(VAR_0->dv_fctx); if (!VAR_0->dv_demux) { av_log(VAR_0->fc, AV_LOG_ERROR, "dv demux context init error\n"); } sc->dv_audio_container = 1; st->codec->codec_id = CODEC_ID_PCM_S16LE; break; #endif case CODEC_ID_QCELP: if (st->codec->codec_tag != MKTAG('Q','VAR_0','l','p')) st->codec->sample_rate = 8000; st->codec->frame_size= 160; st->codec->channels= 1; break; case CODEC_ID_AMR_NB: st->codec->channels= 1; st->codec->sample_rate = 8000; st->codec->frame_size = 160; break; case CODEC_ID_AMR_WB: st->codec->channels = 1; st->codec->sample_rate = 16000; st->codec->frame_size = 320; break; case CODEC_ID_MP2: case CODEC_ID_MP3: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_GSM: case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_IMA_WAV: st->codec->frame_size = sc->samples_per_frame; st->codec->block_align = sc->bytes_per_frame; break; case CODEC_ID_ALAC: if (st->codec->extradata_size == 36) { st->codec->frame_size = AV_RB32(st->codec->extradata+12); st->codec->channels = AV_RB8 (st->codec->extradata+21); st->codec->sample_rate = AV_RB32(st->codec->extradata+32); } break; case CODEC_ID_AC3: st->need_parsing = AVSTREAM_PARSE_FULL; break; case CODEC_ID_MPEG1VIDEO: st->need_parsing = AVSTREAM_PARSE_FULL; break; default: break; } return 0; }
[ "int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, int VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "int VAR_3, VAR_4;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "for (VAR_4=0; VAR_4<VAR_2; VAR_4++) {", "enum CodecID VAR_5;", "int VAR_6 = 1;", "MOVAtom a = { AV_RL32(\"stsd\") };", "int64_t start_pos = avio_tell(VAR_1);", "int VAR_7 = avio_rb32(VAR_1);", "uint32_t format = avio_rl32(VAR_1);", "if (VAR_7 >= 16) {", "avio_rb32(VAR_1);", "avio_rb16(VAR_1);", "VAR_6 = avio_rb16(VAR_1);", "}", "if (st->codec->codec_tag &&\nst->codec->codec_tag != format &&\n(VAR_0->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != VAR_0->fc->video_codec_id\n: st->codec->codec_tag != MKTAG('VAR_3','p','e','VAR_15'))\n){", "multiple_stsd:\nav_log(VAR_0->fc, AV_LOG_WARNING, \"multiple fourcc not supported\\n\");", "avio_skip(VAR_1, VAR_7 - (avio_tell(VAR_1) - start_pos));", "continue;", "}", "if (st->codec->codec_tag && st->codec->codec_tag == AV_RL32(\"avc1\"))\ngoto multiple_stsd;", "sc->VAR_4 = st->codec->codec_tag ? -1 : VAR_4;", "sc->VAR_6= VAR_6;", "st->codec->codec_tag = format;", "VAR_5 = ff_codec_get_id(codec_movaudio_tags, format);", "if (VAR_5<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8)))\nVAR_5 = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF);", "if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && VAR_5 > 0) {", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "} else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO &&", "format && format != MKTAG('m','p','4','s')) {", "VAR_5 = ff_codec_get_id(codec_movvideo_tags, format);", "if (VAR_5 <= 0)\nVAR_5 = ff_codec_get_id(ff_codec_bmp_tags, format);", "if (VAR_5 > 0)\nst->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "else if (st->codec->codec_type == AVMEDIA_TYPE_DATA){", "VAR_5 = ff_codec_get_id(ff_codec_movsubtitle_tags, format);", "if (VAR_5 > 0)\nst->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;", "}", "}", "av_dlog(VAR_0->fc, \"VAR_7=%d 4CC= %VAR_0%VAR_0%VAR_0%VAR_0 codec_type=%d\\n\", VAR_7,\n(format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,\n(format >> 24) & 0xff, st->codec->codec_type);", "if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) {", "unsigned int VAR_8, VAR_9;", "int VAR_10;", "st->codec->codec_id = VAR_5;", "avio_rb16(VAR_1);", "avio_rb16(VAR_1);", "avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "st->codec->width = avio_rb16(VAR_1);", "st->codec->height = avio_rb16(VAR_1);", "avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "avio_rb16(VAR_1);", "VAR_9 = avio_r8(VAR_1);", "if (VAR_9 > 31)\nVAR_9 = 31;", "mov_read_mac_string(VAR_0, VAR_1, VAR_9, st->codec->codec_name, 32);", "if (VAR_9 < 31)\navio_skip(VAR_1, 31 - VAR_9);", "if (!memcmp(st->codec->codec_name, \"Planar Y'CbCr 8-bit 4:2:0\", 25))\nst->codec->codec_tag=MKTAG('I', '4', '2', '0');", "st->codec->bits_per_coded_sample = avio_rb16(VAR_1);", "st->codec->color_table_id = avio_rb16(VAR_1);", "av_dlog(VAR_0->fc, \"depth %d, ctab VAR_5 %d\\n\",\nst->codec->bits_per_coded_sample, st->codec->color_table_id);", "VAR_8 = st->codec->bits_per_coded_sample & 0x1F;", "VAR_10 = st->codec->bits_per_coded_sample & 0x20;", "if ((VAR_8 == 2) || (VAR_8 == 4) ||\n(VAR_8 == 8)) {", "unsigned int VAR_11, VAR_12, VAR_13;", "unsigned char VAR_14, VAR_15, VAR_16;", "if (VAR_10) {", "int VAR_17, VAR_18;", "st->codec->bits_per_coded_sample = VAR_8;", "VAR_12 = 1 << VAR_8;", "VAR_17 = 255;", "VAR_18 = 256 / (VAR_12 - 1);", "for (VAR_3 = 0; VAR_3 < VAR_12; VAR_3++) {", "if (VAR_5 == CODEC_ID_CINEPAK){", "VAR_14 = VAR_15 = VAR_16 = VAR_12 - 1 - VAR_17;", "}else", "VAR_14 = VAR_15 = VAR_16 = VAR_17;", "sc->palette[VAR_3] =\n(VAR_14 << 16) | (VAR_15 << 8) | (VAR_16);", "VAR_17 -= VAR_18;", "if (VAR_17 < 0)\nVAR_17 = 0;", "}", "} else if (st->codec->color_table_id) {", "const uint8_t *VAR_19;", "VAR_12 = 1 << VAR_8;", "if (VAR_8 == 2)\nVAR_19 = ff_qt_default_palette_4;", "else if (VAR_8 == 4)\nVAR_19 = ff_qt_default_palette_16;", "else\nVAR_19 = ff_qt_default_palette_256;", "for (VAR_3 = 0; VAR_3 < VAR_12; VAR_3++) {", "VAR_14 = VAR_19[VAR_3 * 3 + 0];", "VAR_15 = VAR_19[VAR_3 * 3 + 1];", "VAR_16 = VAR_19[VAR_3 * 3 + 2];", "sc->palette[VAR_3] =\n(VAR_14 << 16) | (VAR_15 << 8) | (VAR_16);", "}", "} else {", "VAR_11 = avio_rb32(VAR_1);", "VAR_12 = avio_rb16(VAR_1);", "VAR_13 = avio_rb16(VAR_1);", "if ((VAR_11 <= 255) &&\n(VAR_13 <= 255)) {", "for (VAR_3 = VAR_11; VAR_3 <= VAR_13; VAR_3++) {", "avio_r8(VAR_1);", "avio_r8(VAR_1);", "VAR_14 = avio_r8(VAR_1);", "avio_r8(VAR_1);", "VAR_15 = avio_r8(VAR_1);", "avio_r8(VAR_1);", "VAR_16 = avio_r8(VAR_1);", "avio_r8(VAR_1);", "sc->palette[VAR_3] =\n(VAR_14 << 16) | (VAR_15 << 8) | (VAR_16);", "}", "}", "}", "sc->has_palette = 1;", "}", "} else if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {", "int VAR_20, VAR_21;", "uint16_t version = avio_rb16(VAR_1);", "st->codec->codec_id = VAR_5;", "avio_rb16(VAR_1);", "avio_rb32(VAR_1);", "st->codec->channels = avio_rb16(VAR_1);", "av_dlog(VAR_0->fc, \"audio channels %d\\n\", st->codec->channels);", "st->codec->bits_per_coded_sample = avio_rb16(VAR_1);", "sc->audio_cid = avio_rb16(VAR_1);", "avio_rb16(VAR_1);", "st->codec->sample_rate = ((avio_rb32(VAR_1) >> 16));", "av_dlog(VAR_0->fc, \"version =%d, isom =%d\\n\",version,VAR_0->isom);", "if (!VAR_0->isom) {", "if (version==1) {", "sc->samples_per_frame = avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "sc->bytes_per_frame = avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "} else if (version==2) {", "avio_rb32(VAR_1);", "st->codec->sample_rate = av_int2double(avio_rb64(VAR_1));", "st->codec->channels = avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "st->codec->bits_per_coded_sample = avio_rb32(VAR_1);", "VAR_21 = avio_rb32(VAR_1);", "sc->bytes_per_frame = avio_rb32(VAR_1);", "sc->samples_per_frame = avio_rb32(VAR_1);", "if (format == MKTAG('l','p','VAR_0','m'))\nst->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, VAR_21);", "}", "}", "switch (st->codec->codec_id) {", "case CODEC_ID_PCM_S8:\ncase CODEC_ID_PCM_U8:\nif (st->codec->bits_per_coded_sample == 16)\nst->codec->codec_id = CODEC_ID_PCM_S16BE;", "break;", "case CODEC_ID_PCM_S16LE:\ncase CODEC_ID_PCM_S16BE:\nif (st->codec->bits_per_coded_sample == 8)\nst->codec->codec_id = CODEC_ID_PCM_S8;", "else if (st->codec->bits_per_coded_sample == 24)\nst->codec->codec_id =\nst->codec->codec_id == CODEC_ID_PCM_S16BE ?\nCODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE;", "break;", "case CODEC_ID_MACE3:\nsc->samples_per_frame = 6;", "sc->bytes_per_frame = 2*st->codec->channels;", "break;", "case CODEC_ID_MACE6:\nsc->samples_per_frame = 6;", "sc->bytes_per_frame = 1*st->codec->channels;", "break;", "case CODEC_ID_ADPCM_IMA_QT:\nsc->samples_per_frame = 64;", "sc->bytes_per_frame = 34*st->codec->channels;", "break;", "case CODEC_ID_GSM:\nsc->samples_per_frame = 160;", "sc->bytes_per_frame = 33;", "break;", "default:\nbreak;", "}", "VAR_20 = av_get_bits_per_sample(st->codec->codec_id);", "if (VAR_20) {", "st->codec->bits_per_coded_sample = VAR_20;", "sc->sample_size = (VAR_20 >> 3) * st->codec->channels;", "}", "} else if (st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){", "MOVAtom fake_atom = { .VAR_7 = VAR_7 - (avio_tell(VAR_1) - start_pos) };", "if (format != AV_RL32(\"mp4s\"))\nmov_read_glbl(VAR_0, VAR_1, fake_atom);", "st->codec->codec_id= VAR_5;", "st->codec->width = sc->width;", "st->codec->height = sc->height;", "} else {", "if (st->codec->codec_tag == MKTAG('t','m','VAR_0','d')) {", "int VAR_22;", "avio_rb32(VAR_1);", "VAR_22 = avio_rb32(VAR_1);", "if (VAR_22 & 1)\nst->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE;", "avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "st->codec->time_base.den = avio_r8(VAR_1);", "st->codec->time_base.num = 1;", "}", "avio_skip(VAR_1, VAR_7 - (avio_tell(VAR_1) - start_pos));", "}", "a.VAR_7 = VAR_7 - (avio_tell(VAR_1) - start_pos);", "if (a.VAR_7 > 8) {", "if (mov_read_default(VAR_0, VAR_1, a) < 0)\n} else if (a.VAR_7 > 0)", "avio_skip(VAR_1, a.VAR_7);", "}", "if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)\nst->codec->sample_rate= sc->time_scale;", "switch (st->codec->codec_id) {", "#if CONFIG_DV_DEMUXER\ncase CODEC_ID_DVAUDIO:\nVAR_0->dv_fctx = avformat_alloc_context();", "VAR_0->dv_demux = avpriv_dv_init_demux(VAR_0->dv_fctx);", "if (!VAR_0->dv_demux) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"dv demux context init error\\n\");", "}", "sc->dv_audio_container = 1;", "st->codec->codec_id = CODEC_ID_PCM_S16LE;", "break;", "#endif\ncase CODEC_ID_QCELP:\nif (st->codec->codec_tag != MKTAG('Q','VAR_0','l','p'))\nst->codec->sample_rate = 8000;", "st->codec->frame_size= 160;", "st->codec->channels= 1;", "break;", "case CODEC_ID_AMR_NB:\nst->codec->channels= 1;", "st->codec->sample_rate = 8000;", "st->codec->frame_size = 160;", "break;", "case CODEC_ID_AMR_WB:\nst->codec->channels = 1;", "st->codec->sample_rate = 16000;", "st->codec->frame_size = 320;", "break;", "case CODEC_ID_MP2:\ncase CODEC_ID_MP3:\nst->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->need_parsing = AVSTREAM_PARSE_FULL;", "break;", "case CODEC_ID_GSM:\ncase CODEC_ID_ADPCM_MS:\ncase CODEC_ID_ADPCM_IMA_WAV:\nst->codec->frame_size = sc->samples_per_frame;", "st->codec->block_align = sc->bytes_per_frame;", "break;", "case CODEC_ID_ALAC:\nif (st->codec->extradata_size == 36) {", "st->codec->frame_size = AV_RB32(st->codec->extradata+12);", "st->codec->channels = AV_RB8 (st->codec->extradata+21);", "st->codec->sample_rate = AV_RB32(st->codec->extradata+32);", "}", "break;", "case CODEC_ID_AC3:\nst->need_parsing = AVSTREAM_PARSE_FULL;", "break;", "case CODEC_ID_MPEG1VIDEO:\nst->need_parsing = AVSTREAM_PARSE_FULL;", "break;", "default:\nbreak;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 52 ], [ 56, 58, 60, 62, 64 ], [ 72, 74 ], [ 76 ], [ 78 ], [ 80 ], [ 84, 86 ], [ 88 ], [ 90 ], [ 94 ], [ 96 ], [ 98, 100 ], [ 104 ], [ 106 ], [ 108 ], [ 110 ], [ 112 ], [ 114, 116 ], [ 118, 120 ], [ 122 ], [ 124 ], [ 126, 128 ], [ 130 ], [ 132 ], [ 136, 138, 140 ], [ 144 ], [ 146 ], [ 148 ], [ 152 ], [ 154 ], [ 156 ], [ 158 ], [ 160 ], [ 162 ], [ 166 ], [ 168 ], [ 172 ], [ 174 ], [ 176 ], [ 178 ], [ 182 ], [ 184, 186 ], [ 188 ], [ 190, 192 ], [ 196, 198 ], [ 202 ], [ 204 ], [ 206, 208 ], [ 212 ], [ 214 ], [ 220, 222 ], [ 226 ], [ 228 ], [ 232 ], [ 234 ], [ 238 ], [ 240 ], [ 242 ], [ 244 ], [ 246 ], [ 248 ], [ 250 ], [ 252 ], [ 254 ], [ 256, 258 ], [ 260 ], [ 262, 264 ], [ 266 ], [ 268 ], [ 270 ], [ 274 ], [ 276, 278 ], [ 280, 282 ], [ 284, 286 ], [ 290 ], [ 292 ], [ 294 ], [ 296 ], [ 298, 300 ], [ 302 ], [ 304 ], [ 308 ], [ 310 ], [ 312 ], [ 314, 316 ], [ 318 ], [ 326 ], [ 328 ], [ 330 ], [ 332 ], [ 334 ], [ 336 ], [ 338 ], [ 340 ], [ 342, 344 ], [ 346 ], [ 348 ], [ 350 ], [ 352 ], [ 354 ], [ 356 ], [ 358 ], [ 360 ], [ 364 ], [ 366 ], [ 368 ], [ 372 ], [ 374 ], [ 376 ], [ 380 ], [ 382 ], [ 386 ], [ 392 ], [ 394 ], [ 396 ], [ 398 ], [ 400 ], [ 402 ], [ 404 ], [ 406 ], [ 408 ], [ 410 ], [ 412 ], [ 414 ], [ 416 ], [ 418 ], [ 420 ], [ 422 ], [ 424, 426 ], [ 428 ], [ 430 ], [ 434 ], [ 436, 438, 440, 442 ], [ 444 ], [ 446, 448, 450, 452 ], [ 454, 456, 458, 460 ], [ 462 ], [ 466, 468 ], [ 470 ], [ 472 ], [ 474, 476 ], [ 478 ], [ 480 ], [ 482, 484 ], [ 486 ], [ 488 ], [ 490, 492 ], [ 494 ], [ 496 ], [ 498, 500 ], [ 502 ], [ 506 ], [ 508 ], [ 510 ], [ 512 ], [ 514 ], [ 516 ], [ 522 ], [ 524, 526 ], [ 528 ], [ 530 ], [ 532 ], [ 534 ], [ 536 ], [ 538 ], [ 540 ], [ 542 ], [ 544, 546 ], [ 548 ], [ 550 ], [ 552 ], [ 554 ], [ 556 ], [ 560 ], [ 562 ], [ 566 ], [ 568 ], [ 570, 573 ], [ 575 ], [ 577 ], [ 581, 583 ], [ 589 ], [ 591, 593, 595 ], [ 597 ], [ 599 ], [ 601 ], [ 604 ], [ 606 ], [ 608 ], [ 610 ], [ 612, 616, 620, 622 ], [ 624 ], [ 626 ], [ 628 ], [ 630, 632 ], [ 636 ], [ 640 ], [ 642 ], [ 644, 646 ], [ 648 ], [ 650 ], [ 652 ], [ 654, 656, 658 ], [ 660 ], [ 662 ], [ 664, 666, 668, 670 ], [ 672 ], [ 674 ], [ 676, 678 ], [ 680 ], [ 682 ], [ 684 ], [ 686 ], [ 688 ], [ 690, 692 ], [ 694 ], [ 696, 698 ], [ 700 ], [ 702, 704 ], [ 706 ], [ 710 ], [ 712 ] ]
4,083
static void test_tco_max_timeout(void) { TestData d; const uint16_t ticks = 0xffff; uint32_t val; int ret; d.args = NULL; d.noreboot = true; test_init(&d); stop_tco(&d); clear_tco_status(&d); reset_on_second_timeout(false); set_tco_timeout(&d, ticks); load_tco(&d); start_tco(&d); clock_step(((ticks & TCO_TMR_MASK) - 1) * TCO_TICK_NSEC); val = qpci_io_readw(d.dev, d.tco_io_base + TCO_RLD); g_assert_cmpint(val & TCO_RLD_MASK, ==, 1); val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS); ret = val & TCO_TIMEOUT ? 1 : 0; g_assert(ret == 0); clock_step(TCO_TICK_NSEC); val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS); ret = val & TCO_TIMEOUT ? 1 : 0; g_assert(ret == 1); stop_tco(&d); qtest_end(); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void test_tco_max_timeout(void) { TestData d; const uint16_t ticks = 0xffff; uint32_t val; int ret; d.args = NULL; d.noreboot = true; test_init(&d); stop_tco(&d); clear_tco_status(&d); reset_on_second_timeout(false); set_tco_timeout(&d, ticks); load_tco(&d); start_tco(&d); clock_step(((ticks & TCO_TMR_MASK) - 1) * TCO_TICK_NSEC); val = qpci_io_readw(d.dev, d.tco_io_base + TCO_RLD); g_assert_cmpint(val & TCO_RLD_MASK, ==, 1); val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS); ret = val & TCO_TIMEOUT ? 1 : 0; g_assert(ret == 0); clock_step(TCO_TICK_NSEC); val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS); ret = val & TCO_TIMEOUT ? 1 : 0; g_assert(ret == 1); stop_tco(&d); qtest_end(); }
{ "code": [ " val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", " val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", " val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", " val = qpci_io_readw(d.dev, d.tco_io_base + TCO_RLD);", " val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", " val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", " val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);" ], "line_no": [ 43, 43, 43, 39, 43, 43, 43 ] }
static void FUNC_0(void) { TestData d; const uint16_t VAR_0 = 0xffff; uint32_t val; int VAR_1; d.args = NULL; d.noreboot = true; test_init(&d); stop_tco(&d); clear_tco_status(&d); reset_on_second_timeout(false); set_tco_timeout(&d, VAR_0); load_tco(&d); start_tco(&d); clock_step(((VAR_0 & TCO_TMR_MASK) - 1) * TCO_TICK_NSEC); val = qpci_io_readw(d.dev, d.tco_io_base + TCO_RLD); g_assert_cmpint(val & TCO_RLD_MASK, ==, 1); val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS); VAR_1 = val & TCO_TIMEOUT ? 1 : 0; g_assert(VAR_1 == 0); clock_step(TCO_TICK_NSEC); val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS); VAR_1 = val & TCO_TIMEOUT ? 1 : 0; g_assert(VAR_1 == 1); stop_tco(&d); qtest_end(); }
[ "static void FUNC_0(void)\n{", "TestData d;", "const uint16_t VAR_0 = 0xffff;", "uint32_t val;", "int VAR_1;", "d.args = NULL;", "d.noreboot = true;", "test_init(&d);", "stop_tco(&d);", "clear_tco_status(&d);", "reset_on_second_timeout(false);", "set_tco_timeout(&d, VAR_0);", "load_tco(&d);", "start_tco(&d);", "clock_step(((VAR_0 & TCO_TMR_MASK) - 1) * TCO_TICK_NSEC);", "val = qpci_io_readw(d.dev, d.tco_io_base + TCO_RLD);", "g_assert_cmpint(val & TCO_RLD_MASK, ==, 1);", "val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", "VAR_1 = val & TCO_TIMEOUT ? 1 : 0;", "g_assert(VAR_1 == 0);", "clock_step(TCO_TICK_NSEC);", "val = qpci_io_readw(d.dev, d.tco_io_base + TCO1_STS);", "VAR_1 = val & TCO_TIMEOUT ? 1 : 0;", "g_assert(VAR_1 == 1);", "stop_tco(&d);", "qtest_end();", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ] ]
4,084
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) /* * Write out 2 RGB pixels in the target pixel format. This function takes a * R/G/B LUT as generated by ff_yuv2rgb_c_init_tables(), which takes care of * things like endianness conversion and shifting. The caller takes care of * setting the correct offset in these tables from the chroma (U/V) values. * This function then uses the luminance (Y1/Y2) values to write out the * correct RGB values into the destination buffer. */ static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else /* 8/4-bit */ { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
true
FFmpeg
5ab6f0fe5abf8c5fccede33f7b68c9f3a3864e3a
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
{ "code": [ "yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2," ], "line_no": [ 29 ] }
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2, unsigned A1, unsigned A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
[ "YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE)\nYUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE)\nYUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE)\nYUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE)\nstatic av_always_inline void\nyuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2,\nunsigned A1, unsigned A2,\nconst void *_r, const void *_g, const void *_b, int y,\nenum PixelFormat target, int hasAlpha)\n{", "if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA ||\ntarget == PIX_FMT_ABGR || target == PIX_FMT_BGRA) {", "uint32_t *dest = (uint32_t *) _dest;", "const uint32_t *r = (const uint32_t *) _r;", "const uint32_t *g = (const uint32_t *) _g;", "const uint32_t *b = (const uint32_t *) _b;", "#if CONFIG_SMALL\nint sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0;", "dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);", "dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);", "#else\nif (hasAlpha) {", "int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24;", "dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh);", "dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh);", "} else {", "dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];", "dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];", "}", "#endif\n} else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) {", "uint8_t *dest = (uint8_t *) _dest;", "const uint8_t *r = (const uint8_t *) _r;", "const uint8_t *g = (const uint8_t *) _g;", "const uint8_t *b = (const uint8_t *) _b;", "#define r_b ((target == PIX_FMT_RGB24) ? r : b)\n#define b_r ((target == PIX_FMT_RGB24) ? b : r)\ndest[i * 6 + 0] = r_b[Y1];", "dest[i * 6 + 1] = g[Y1];", "dest[i * 6 + 2] = b_r[Y1];", "dest[i * 6 + 3] = r_b[Y2];", "dest[i * 6 + 4] = g[Y2];", "dest[i * 6 + 5] = b_r[Y2];", "#undef r_b\n#undef b_r\n} else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 ||", "target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 ||\ntarget == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) {", "uint16_t *dest = (uint16_t *) _dest;", "const uint16_t *r = (const uint16_t *) _r;", "const uint16_t *g = (const uint16_t *) _g;", "const uint16_t *b = (const uint16_t *) _b;", "int dr1, dg1, db1, dr2, dg2, db2;", "if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) {", "dr1 = dither_2x2_8[ y & 1 ][0];", "dg1 = dither_2x2_4[ y & 1 ][0];", "db1 = dither_2x2_8[(y & 1) ^ 1][0];", "dr2 = dither_2x2_8[ y & 1 ][1];", "dg2 = dither_2x2_4[ y & 1 ][1];", "db2 = dither_2x2_8[(y & 1) ^ 1][1];", "} else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) {", "dr1 = dither_2x2_8[ y & 1 ][0];", "dg1 = dither_2x2_8[ y & 1 ][1];", "db1 = dither_2x2_8[(y & 1) ^ 1][0];", "dr2 = dither_2x2_8[ y & 1 ][1];", "dg2 = dither_2x2_8[ y & 1 ][0];", "db2 = dither_2x2_8[(y & 1) ^ 1][1];", "} else {", "dr1 = dither_4x4_16[ y & 3 ][0];", "dg1 = dither_4x4_16[ y & 3 ][1];", "db1 = dither_4x4_16[(y & 3) ^ 3][0];", "dr2 = dither_4x4_16[ y & 3 ][1];", "dg2 = dither_4x4_16[ y & 3 ][0];", "db2 = dither_4x4_16[(y & 3) ^ 3][1];", "}", "dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];", "dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];", "} else {", "uint8_t *dest = (uint8_t *) _dest;", "const uint8_t *r = (const uint8_t *) _r;", "const uint8_t *g = (const uint8_t *) _g;", "const uint8_t *b = (const uint8_t *) _b;", "int dr1, dg1, db1, dr2, dg2, db2;", "if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) {", "const uint8_t * const d64 = dither_8x8_73[y & 7];", "const uint8_t * const d32 = dither_8x8_32[y & 7];", "dr1 = dg1 = d32[(i * 2 + 0) & 7];", "db1 = d64[(i * 2 + 0) & 7];", "dr2 = dg2 = d32[(i * 2 + 1) & 7];", "db2 = d64[(i * 2 + 1) & 7];", "} else {", "const uint8_t * const d64 = dither_8x8_73 [y & 7];", "const uint8_t * const d128 = dither_8x8_220[y & 7];", "dr1 = db1 = d128[(i * 2 + 0) & 7];", "dg1 = d64[(i * 2 + 0) & 7];", "dr2 = db2 = d128[(i * 2 + 1) & 7];", "dg2 = d64[(i * 2 + 1) & 7];", "}", "if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) {", "dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] +\n((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4);", "} else {", "dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];", "dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];", "}", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 27, 29, 31, 33, 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117, 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ] ]
4,085
int vhost_set_vring_enable(NetClientState *nc, int enable) { VHostNetState *net = get_vhost_net(nc); const VhostOps *vhost_ops; nc->vring_enable = enable; if (!net) { return 0; } vhost_ops = net->dev.vhost_ops; if (vhost_ops->vhost_set_vring_enable) { return vhost_ops->vhost_set_vring_enable(&net->dev, enable); } return 0; }
true
qemu
bb12e761e8e7b5c3c3d77bd08de9f007727a941e
int vhost_set_vring_enable(NetClientState *nc, int enable) { VHostNetState *net = get_vhost_net(nc); const VhostOps *vhost_ops; nc->vring_enable = enable; if (!net) { return 0; } vhost_ops = net->dev.vhost_ops; if (vhost_ops->vhost_set_vring_enable) { return vhost_ops->vhost_set_vring_enable(&net->dev, enable); } return 0; }
{ "code": [ " const VhostOps *vhost_ops;", " if (!net) {", " return 0;", " vhost_ops = net->dev.vhost_ops;" ], "line_no": [ 7, 15, 17, 23 ] }
int FUNC_0(NetClientState *VAR_0, int VAR_1) { VHostNetState *net = get_vhost_net(VAR_0); const VhostOps *VAR_2; VAR_0->vring_enable = VAR_1; if (!net) { return 0; } VAR_2 = net->dev.VAR_2; if (VAR_2->FUNC_0) { return VAR_2->FUNC_0(&net->dev, VAR_1); } return 0; }
[ "int FUNC_0(NetClientState *VAR_0, int VAR_1)\n{", "VHostNetState *net = get_vhost_net(VAR_0);", "const VhostOps *VAR_2;", "VAR_0->vring_enable = VAR_1;", "if (!net) {", "return 0;", "}", "VAR_2 = net->dev.VAR_2;", "if (VAR_2->FUNC_0) {", "return VAR_2->FUNC_0(&net->dev, VAR_1);", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
4,086
static int get_channel_idx(char **map, int *ch, char delim, int max_ch) { char *next = split(*map, delim); int len; int n = 0; if (!next && delim == '-') len = strlen(*map); sscanf(*map, "%d%n", ch, &n); if (n != len) if (*ch < 0 || *ch > max_ch) *map = next; return 0; }
true
FFmpeg
579795b2049bc8b0f291b302e7ab24f9561eaf24
static int get_channel_idx(char **map, int *ch, char delim, int max_ch) { char *next = split(*map, delim); int len; int n = 0; if (!next && delim == '-') len = strlen(*map); sscanf(*map, "%d%n", ch, &n); if (n != len) if (*ch < 0 || *ch > max_ch) *map = next; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(char **VAR_0, int *VAR_1, char VAR_2, int VAR_3) { char *VAR_4 = split(*VAR_0, VAR_2); int VAR_5; int VAR_6 = 0; if (!VAR_4 && VAR_2 == '-') VAR_5 = strlen(*VAR_0); sscanf(*VAR_0, "%d%VAR_6", VAR_1, &VAR_6); if (VAR_6 != VAR_5) if (*VAR_1 < 0 || *VAR_1 > VAR_3) *VAR_0 = VAR_4; return 0; }
[ "static int FUNC_0(char **VAR_0, int *VAR_1, char VAR_2, int VAR_3)\n{", "char *VAR_4 = split(*VAR_0, VAR_2);", "int VAR_5;", "int VAR_6 = 0;", "if (!VAR_4 && VAR_2 == '-')\nVAR_5 = strlen(*VAR_0);", "sscanf(*VAR_0, \"%d%VAR_6\", VAR_1, &VAR_6);", "if (VAR_6 != VAR_5)\nif (*VAR_1 < 0 || *VAR_1 > VAR_3)\n*VAR_0 = VAR_4;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 16 ], [ 18 ], [ 20, 23, 26 ], [ 28 ], [ 30 ] ]
4,087
static void piix3_xen_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix3; dc->no_user = 1; k->no_hotplug = 1; k->init = piix3_initfn; k->config_write = piix3_write_config_xen; k->vendor_id = PCI_VENDOR_ID_INTEL; /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; k->class_id = PCI_CLASS_BRIDGE_ISA; };
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void piix3_xen_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix3; dc->no_user = 1; k->no_hotplug = 1; k->init = piix3_initfn; k->config_write = piix3_write_config_xen; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; k->class_id = PCI_CLASS_BRIDGE_ISA; };
{ "code": [ " dc->no_user = 1;" ], "line_no": [ 15 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); PCIDeviceClass *k = PCI_DEVICE_CLASS(VAR_0); dc->desc = "ISA bridge"; dc->vmsd = &vmstate_piix3; dc->no_user = 1; k->no_hotplug = 1; k->init = piix3_initfn; k->config_write = piix3_write_config_xen; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0; k->class_id = PCI_CLASS_BRIDGE_ISA; };
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "PCIDeviceClass *k = PCI_DEVICE_CLASS(VAR_0);", "dc->desc = \"ISA bridge\";", "dc->vmsd = &vmstate_piix3;", "dc->no_user = 1;", "k->no_hotplug = 1;", "k->init = piix3_initfn;", "k->config_write = piix3_write_config_xen;", "k->vendor_id = PCI_VENDOR_ID_INTEL;", "k->device_id = PCI_DEVICE_ID_INTEL_82371SB_0;", "k->class_id = PCI_CLASS_BRIDGE_ISA;", "};" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ] ]
4,088
qio_channel_websock_source_check(GSource *source) { QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source; GIOCondition cond = 0; if (wsource->wioc->rawinput.offset) { cond |= G_IO_IN; } if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) { cond |= G_IO_OUT; } return cond & wsource->condition; }
true
qemu
eefa3d8ef649f9055611361e2201cca49f8c3433
qio_channel_websock_source_check(GSource *source) { QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source; GIOCondition cond = 0; if (wsource->wioc->rawinput.offset) { cond |= G_IO_IN; } if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) { cond |= G_IO_OUT; } return cond & wsource->condition; }
{ "code": [ " if (wsource->wioc->rawinput.offset) {", "qio_channel_websock_source_check(GSource *source)", " QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source;", " GIOCondition cond = 0;", " if (wsource->wioc->rawinput.offset) {", " cond |= G_IO_IN;", " if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {", " cond |= G_IO_OUT;", " return cond & wsource->condition;", " GIOCondition cond = 0;", " if (wsource->wioc->rawinput.offset) {", " cond |= G_IO_IN;", " if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {", " cond |= G_IO_OUT;" ], "line_no": [ 11, 1, 5, 7, 11, 13, 17, 19, 25, 7, 11, 13, 17, 19 ] }
FUNC_0(GSource *VAR_0) { QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)VAR_0; GIOCondition cond = 0; if (wsource->wioc->rawinput.offset) { cond |= G_IO_IN; } if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) { cond |= G_IO_OUT; } return cond & wsource->condition; }
[ "FUNC_0(GSource *VAR_0)\n{", "QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)VAR_0;", "GIOCondition cond = 0;", "if (wsource->wioc->rawinput.offset) {", "cond |= G_IO_IN;", "}", "if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {", "cond |= G_IO_OUT;", "}", "return cond & wsource->condition;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
4,089
static int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int i; int s; const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0); const vector unsigned char permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0}; vector unsigned char perm1 = vec_lvsl(0, pix1); vector unsigned char perm2 = vec_lvsl(0, pix2); vector unsigned char t1, t2, t3,t4, t5; vector unsigned int sad; vector signed int sumdiffs; sad = (vector unsigned int)vec_splat_u32(0); for (i = 0; i < h; i++) { /* Read potentially unaligned pixels into t1 and t2 Since we're reading 16 pixels, and actually only want 8, mask out the last 8 pixels. The 0s don't change the sum. */ vector unsigned char pix1l = vec_ld( 0, pix1); vector unsigned char pix1r = vec_ld(15, pix1); vector unsigned char pix2l = vec_ld( 0, pix2); vector unsigned char pix2r = vec_ld(15, pix2); t1 = vec_and(vec_perm(pix1l, pix1r, perm1), permclear); t2 = vec_and(vec_perm(pix2l, pix2r, perm2), permclear); /* Calculate a sum of abs differences vector */ t3 = vec_max(t1, t2); t4 = vec_min(t1, t2); t5 = vec_sub(t3, t4); /* Add each 4 pixel group together and put 4 results into sad */ sad = vec_sum4s(t5, sad); pix1 += line_size; pix2 += line_size; } /* Sum up the four partial sums, and put the result into s */ sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_splat(sumdiffs, 3); vec_ste(sumdiffs, 0, &s); return s; }
true
FFmpeg
98fdfa99704f1cfef3d3a26c580b92749b6b64cb
static int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int i; int s; const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0); const vector unsigned char permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0}; vector unsigned char perm1 = vec_lvsl(0, pix1); vector unsigned char perm2 = vec_lvsl(0, pix2); vector unsigned char t1, t2, t3,t4, t5; vector unsigned int sad; vector signed int sumdiffs; sad = (vector unsigned int)vec_splat_u32(0); for (i = 0; i < h; i++) { vector unsigned char pix1l = vec_ld( 0, pix1); vector unsigned char pix1r = vec_ld(15, pix1); vector unsigned char pix2l = vec_ld( 0, pix2); vector unsigned char pix2r = vec_ld(15, pix2); t1 = vec_and(vec_perm(pix1l, pix1r, perm1), permclear); t2 = vec_and(vec_perm(pix2l, pix2r, perm2), permclear); t3 = vec_max(t1, t2); t4 = vec_min(t1, t2); t5 = vec_sub(t3, t4); sad = vec_sum4s(t5, sad); pix1 += line_size; pix2 += line_size; } sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero); sumdiffs = vec_splat(sumdiffs, 3); vec_ste(sumdiffs, 0, &s); return s; }
{ "code": [ " vector unsigned char pix1l = vec_ld( 0, pix1);", " vector unsigned char pix1r = vec_ld(15, pix1);", " vector unsigned char pix2l = vec_ld( 0, pix2);", " vector unsigned char pix2r = vec_ld(15, pix2);", " vector unsigned char pix1l = vec_ld( 0, pix1);", " vector unsigned char pix1r = vec_ld(15, pix1);", " vector unsigned char pix2l = vec_ld( 0, pix2);", " vector unsigned char pix2r = vec_ld(15, pix2);" ], "line_no": [ 37, 39, 41, 43, 37, 39, 41, 43 ] }
static int FUNC_0(void *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4) { int VAR_5; int VAR_6; const vector unsigned int VAR_7 = (const vector unsigned int)vec_splat_u32(0); const vector unsigned char VAR_8 = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0}; vector unsigned char perm1 = vec_lvsl(0, VAR_1); vector unsigned char perm2 = vec_lvsl(0, VAR_2); vector unsigned char t1, t2, t3,t4, t5; vector unsigned int sad; vector signed int sumdiffs; sad = (vector unsigned int)vec_splat_u32(0); for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) { vector unsigned char pix1l = vec_ld( 0, VAR_1); vector unsigned char pix1r = vec_ld(15, VAR_1); vector unsigned char pix2l = vec_ld( 0, VAR_2); vector unsigned char pix2r = vec_ld(15, VAR_2); t1 = vec_and(vec_perm(pix1l, pix1r, perm1), VAR_8); t2 = vec_and(vec_perm(pix2l, pix2r, perm2), VAR_8); t3 = vec_max(t1, t2); t4 = vec_min(t1, t2); t5 = vec_sub(t3, t4); sad = vec_sum4s(t5, sad); VAR_1 += VAR_3; VAR_2 += VAR_3; } sumdiffs = vec_sums((vector signed int) sad, (vector signed int) VAR_7); sumdiffs = vec_splat(sumdiffs, 3); vec_ste(sumdiffs, 0, &VAR_6); return VAR_6; }
[ "static int FUNC_0(void *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5;", "int VAR_6;", "const vector unsigned int VAR_7 = (const vector unsigned int)vec_splat_u32(0);", "const vector unsigned char VAR_8 = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};", "vector unsigned char perm1 = vec_lvsl(0, VAR_1);", "vector unsigned char perm2 = vec_lvsl(0, VAR_2);", "vector unsigned char t1, t2, t3,t4, t5;", "vector unsigned int sad;", "vector signed int sumdiffs;", "sad = (vector unsigned int)vec_splat_u32(0);", "for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) {", "vector unsigned char pix1l = vec_ld( 0, VAR_1);", "vector unsigned char pix1r = vec_ld(15, VAR_1);", "vector unsigned char pix2l = vec_ld( 0, VAR_2);", "vector unsigned char pix2r = vec_ld(15, VAR_2);", "t1 = vec_and(vec_perm(pix1l, pix1r, perm1), VAR_8);", "t2 = vec_and(vec_perm(pix2l, pix2r, perm2), VAR_8);", "t3 = vec_max(t1, t2);", "t4 = vec_min(t1, t2);", "t5 = vec_sub(t3, t4);", "sad = vec_sum4s(t5, sad);", "VAR_1 += VAR_3;", "VAR_2 += VAR_3;", "}", "sumdiffs = vec_sums((vector signed int) sad, (vector signed int) VAR_7);", "sumdiffs = vec_splat(sumdiffs, 3);", "vec_ste(sumdiffs, 0, &VAR_6);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ] ]
4,092
static void move_audio(vorbis_enc_context *venc, float **audio, int *samples, int sf_size) { AVFrame *cur = NULL; int frame_size = 1 << (venc->log2_blocksize[1] - 1); int subframes = frame_size / sf_size; for (int sf = 0; sf < subframes; sf++) { cur = ff_bufqueue_get(&venc->bufqueue); *samples += cur->nb_samples; for (int ch = 0; ch < venc->channels; ch++) { const float *input = (float *) cur->extended_data[ch]; const size_t len = cur->nb_samples * sizeof(float); memcpy(&audio[ch][sf*sf_size], input, len); } av_frame_free(&cur); } }
true
FFmpeg
34c52005605d68f7cd1957b169b6732c7d2447d9
static void move_audio(vorbis_enc_context *venc, float **audio, int *samples, int sf_size) { AVFrame *cur = NULL; int frame_size = 1 << (venc->log2_blocksize[1] - 1); int subframes = frame_size / sf_size; for (int sf = 0; sf < subframes; sf++) { cur = ff_bufqueue_get(&venc->bufqueue); *samples += cur->nb_samples; for (int ch = 0; ch < venc->channels; ch++) { const float *input = (float *) cur->extended_data[ch]; const size_t len = cur->nb_samples * sizeof(float); memcpy(&audio[ch][sf*sf_size], input, len); } av_frame_free(&cur); } }
{ "code": [ "static void move_audio(vorbis_enc_context *venc, float **audio, int *samples, int sf_size)", " memcpy(&audio[ch][sf*sf_size], input, len);" ], "line_no": [ 1, 27 ] }
static void FUNC_0(vorbis_enc_context *VAR_0, float **VAR_1, int *VAR_2, int VAR_3) { AVFrame *cur = NULL; int VAR_4 = 1 << (VAR_0->log2_blocksize[1] - 1); int VAR_5 = VAR_4 / VAR_3; for (int VAR_6 = 0; VAR_6 < VAR_5; VAR_6++) { cur = ff_bufqueue_get(&VAR_0->bufqueue); *VAR_2 += cur->nb_samples; for (int ch = 0; ch < VAR_0->channels; ch++) { const float *input = (float *) cur->extended_data[ch]; const size_t len = cur->nb_samples * sizeof(float); memcpy(&VAR_1[ch][VAR_6*VAR_3], input, len); } av_frame_free(&cur); } }
[ "static void FUNC_0(vorbis_enc_context *VAR_0, float **VAR_1, int *VAR_2, int VAR_3)\n{", "AVFrame *cur = NULL;", "int VAR_4 = 1 << (VAR_0->log2_blocksize[1] - 1);", "int VAR_5 = VAR_4 / VAR_3;", "for (int VAR_6 = 0; VAR_6 < VAR_5; VAR_6++) {", "cur = ff_bufqueue_get(&VAR_0->bufqueue);", "*VAR_2 += cur->nb_samples;", "for (int ch = 0; ch < VAR_0->channels; ch++) {", "const float *input = (float *) cur->extended_data[ch];", "const size_t len = cur->nb_samples * sizeof(float);", "memcpy(&VAR_1[ch][VAR_6*VAR_3], input, len);", "}", "av_frame_free(&cur);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
4,094
static void svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc) { const int qmul = svq3_dequant_coeff[qp]; int i; if (dc) { dc = 13 * 13 * (dc == 1 ? 1538U* block[0] : qmul * (block[0] >> 3) / 2); block[0] = 0; } for (i = 0; i < 4; i++) { const int z0 = 13 * (block[0 + 4 * i] + block[2 + 4 * i]); const int z1 = 13 * (block[0 + 4 * i] - block[2 + 4 * i]); const int z2 = 7 * block[1 + 4 * i] - 17 * block[3 + 4 * i]; const int z3 = 17 * block[1 + 4 * i] + 7 * block[3 + 4 * i]; block[0 + 4 * i] = z0 + z3; block[1 + 4 * i] = z1 + z2; block[2 + 4 * i] = z1 - z2; block[3 + 4 * i] = z0 - z3; } for (i = 0; i < 4; i++) { const unsigned z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]); const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]); const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3]; const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3]; const int rr = (dc + 0x80000); dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((int)((z0 + z3) * qmul + rr) >> 20)); dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((int)((z1 + z2) * qmul + rr) >> 20)); dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((int)((z1 - z2) * qmul + rr) >> 20)); dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((int)((z0 - z3) * qmul + rr) >> 20)); } memset(block, 0, 16 * sizeof(int16_t)); }
true
FFmpeg
2c933c51687db958d8045d25ed87848342e869f6
static void svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc) { const int qmul = svq3_dequant_coeff[qp]; int i; if (dc) { dc = 13 * 13 * (dc == 1 ? 1538U* block[0] : qmul * (block[0] >> 3) / 2); block[0] = 0; } for (i = 0; i < 4; i++) { const int z0 = 13 * (block[0 + 4 * i] + block[2 + 4 * i]); const int z1 = 13 * (block[0 + 4 * i] - block[2 + 4 * i]); const int z2 = 7 * block[1 + 4 * i] - 17 * block[3 + 4 * i]; const int z3 = 17 * block[1 + 4 * i] + 7 * block[3 + 4 * i]; block[0 + 4 * i] = z0 + z3; block[1 + 4 * i] = z1 + z2; block[2 + 4 * i] = z1 - z2; block[3 + 4 * i] = z0 - z3; } for (i = 0; i < 4; i++) { const unsigned z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]); const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]); const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3]; const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3]; const int rr = (dc + 0x80000); dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((int)((z0 + z3) * qmul + rr) >> 20)); dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((int)((z1 + z2) * qmul + rr) >> 20)); dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((int)((z1 - z2) * qmul + rr) >> 20)); dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((int)((z0 - z3) * qmul + rr) >> 20)); } memset(block, 0, 16 * sizeof(int16_t)); }
{ "code": [ " const int rr = (dc + 0x80000);" ], "line_no": [ 59 ] }
static void FUNC_0(uint8_t *VAR_0, int16_t *VAR_1, int VAR_2, int VAR_3, int VAR_4) { const int VAR_5 = svq3_dequant_coeff[VAR_3]; int VAR_6; if (VAR_4) { VAR_4 = 13 * 13 * (VAR_4 == 1 ? 1538U* VAR_1[0] : VAR_5 * (VAR_1[0] >> 3) / 2); VAR_1[0] = 0; } for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { const int VAR_11 = 13 * (VAR_1[0 + 4 * VAR_6] + VAR_1[2 + 4 * VAR_6]); const int VAR_11 = 13 * (VAR_1[0 + 4 * VAR_6] - VAR_1[2 + 4 * VAR_6]); const int VAR_11 = 7 * VAR_1[1 + 4 * VAR_6] - 17 * VAR_1[3 + 4 * VAR_6]; const int VAR_11 = 17 * VAR_1[1 + 4 * VAR_6] + 7 * VAR_1[3 + 4 * VAR_6]; VAR_1[0 + 4 * VAR_6] = VAR_11 + VAR_11; VAR_1[1 + 4 * VAR_6] = VAR_11 + VAR_11; VAR_1[2 + 4 * VAR_6] = VAR_11 - VAR_11; VAR_1[3 + 4 * VAR_6] = VAR_11 - VAR_11; } for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { const unsigned VAR_11 = 13 * (VAR_1[VAR_6 + 4 * 0] + VAR_1[VAR_6 + 4 * 2]); const unsigned VAR_11 = 13 * (VAR_1[VAR_6 + 4 * 0] - VAR_1[VAR_6 + 4 * 2]); const unsigned VAR_11 = 7 * VAR_1[VAR_6 + 4 * 1] - 17 * VAR_1[VAR_6 + 4 * 3]; const unsigned VAR_11 = 17 * VAR_1[VAR_6 + 4 * 1] + 7 * VAR_1[VAR_6 + 4 * 3]; const int VAR_11 = (VAR_4 + 0x80000); VAR_0[VAR_6 + VAR_2 * 0] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 0] + ((int)((VAR_11 + VAR_11) * VAR_5 + VAR_11) >> 20)); VAR_0[VAR_6 + VAR_2 * 1] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 1] + ((int)((VAR_11 + VAR_11) * VAR_5 + VAR_11) >> 20)); VAR_0[VAR_6 + VAR_2 * 2] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 2] + ((int)((VAR_11 - VAR_11) * VAR_5 + VAR_11) >> 20)); VAR_0[VAR_6 + VAR_2 * 3] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 3] + ((int)((VAR_11 - VAR_11) * VAR_5 + VAR_11) >> 20)); } memset(VAR_1, 0, 16 * sizeof(int16_t)); }
[ "static void FUNC_0(uint8_t *VAR_0, int16_t *VAR_1,\nint VAR_2, int VAR_3, int VAR_4)\n{", "const int VAR_5 = svq3_dequant_coeff[VAR_3];", "int VAR_6;", "if (VAR_4) {", "VAR_4 = 13 * 13 * (VAR_4 == 1 ? 1538U* VAR_1[0]\n: VAR_5 * (VAR_1[0] >> 3) / 2);", "VAR_1[0] = 0;", "}", "for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "const int VAR_11 = 13 * (VAR_1[0 + 4 * VAR_6] + VAR_1[2 + 4 * VAR_6]);", "const int VAR_11 = 13 * (VAR_1[0 + 4 * VAR_6] - VAR_1[2 + 4 * VAR_6]);", "const int VAR_11 = 7 * VAR_1[1 + 4 * VAR_6] - 17 * VAR_1[3 + 4 * VAR_6];", "const int VAR_11 = 17 * VAR_1[1 + 4 * VAR_6] + 7 * VAR_1[3 + 4 * VAR_6];", "VAR_1[0 + 4 * VAR_6] = VAR_11 + VAR_11;", "VAR_1[1 + 4 * VAR_6] = VAR_11 + VAR_11;", "VAR_1[2 + 4 * VAR_6] = VAR_11 - VAR_11;", "VAR_1[3 + 4 * VAR_6] = VAR_11 - VAR_11;", "}", "for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "const unsigned VAR_11 = 13 * (VAR_1[VAR_6 + 4 * 0] + VAR_1[VAR_6 + 4 * 2]);", "const unsigned VAR_11 = 13 * (VAR_1[VAR_6 + 4 * 0] - VAR_1[VAR_6 + 4 * 2]);", "const unsigned VAR_11 = 7 * VAR_1[VAR_6 + 4 * 1] - 17 * VAR_1[VAR_6 + 4 * 3];", "const unsigned VAR_11 = 17 * VAR_1[VAR_6 + 4 * 1] + 7 * VAR_1[VAR_6 + 4 * 3];", "const int VAR_11 = (VAR_4 + 0x80000);", "VAR_0[VAR_6 + VAR_2 * 0] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 0] + ((int)((VAR_11 + VAR_11) * VAR_5 + VAR_11) >> 20));", "VAR_0[VAR_6 + VAR_2 * 1] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 1] + ((int)((VAR_11 + VAR_11) * VAR_5 + VAR_11) >> 20));", "VAR_0[VAR_6 + VAR_2 * 2] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 2] + ((int)((VAR_11 - VAR_11) * VAR_5 + VAR_11) >> 20));", "VAR_0[VAR_6 + VAR_2 * 3] = av_clip_uint8(VAR_0[VAR_6 + VAR_2 * 3] + ((int)((VAR_11 - VAR_11) * VAR_5 + VAR_11) >> 20));", "}", "memset(VAR_1, 0, 16 * sizeof(int16_t));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
4,096
static char *vnc_socket_local_addr(const char *format, int fd) { struct sockaddr_storage sa; socklen_t salen; salen = sizeof(sa); if (getsockname(fd, (struct sockaddr*)&sa, &salen) < 0) return NULL; return addr_to_string(format, &sa, salen); }
true
qemu
2f9606b3736c3be4dbd606c46525c7b770ced119
static char *vnc_socket_local_addr(const char *format, int fd) { struct sockaddr_storage sa; socklen_t salen; salen = sizeof(sa); if (getsockname(fd, (struct sockaddr*)&sa, &salen) < 0) return NULL; return addr_to_string(format, &sa, salen); }
{ "code": [ "static char *vnc_socket_local_addr(const char *format, int fd) {" ], "line_no": [ 1 ] }
static char *FUNC_0(const char *VAR_0, int VAR_1) { struct sockaddr_storage VAR_2; socklen_t salen; salen = sizeof(VAR_2); if (getsockname(VAR_1, (struct sockaddr*)&VAR_2, &salen) < 0) return NULL; return addr_to_string(VAR_0, &VAR_2, salen); }
[ "static char *FUNC_0(const char *VAR_0, int VAR_1) {", "struct sockaddr_storage VAR_2;", "socklen_t salen;", "salen = sizeof(VAR_2);", "if (getsockname(VAR_1, (struct sockaddr*)&VAR_2, &salen) < 0)\nreturn NULL;", "return addr_to_string(VAR_0, &VAR_2, salen);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19 ] ]
4,097
static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) { /* Primary audio coding side information */ int j, k; if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; if (!base_channel) { s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1; s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) s->prediction_mode[j][k] = get_bits(&s->gb, 1); } /* Get prediction codebook */ for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) { if (s->prediction_mode[j][k] > 0) { /* (Prediction coefficient VQ address) */ s->prediction_vq[j][k] = get_bits(&s->gb, 12); } } } /* Bit allocation index */ for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->vq_start_subband[j]; k++) { if (s->bitalloc_huffman[j] == 6) s->bitalloc[j][k] = get_bits(&s->gb, 5); else if (s->bitalloc_huffman[j] == 5) s->bitalloc[j][k] = get_bits(&s->gb, 4); else if (s->bitalloc_huffman[j] == 7) { av_log(s->avctx, AV_LOG_ERROR, "Invalid bit allocation index\n"); return AVERROR_INVALIDDATA; } else { s->bitalloc[j][k] = get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]); } if (s->bitalloc[j][k] > 26) { // av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index [%i][%i] too big (%i)\n", // j, k, s->bitalloc[j][k]); return AVERROR_INVALIDDATA; } } } /* Transition mode */ for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) { s->transition_mode[j][k] = 0; if (s->subsubframes[s->current_subframe] > 1 && k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) { s->transition_mode[j][k] = get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]); } } } if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; for (j = base_channel; j < s->prim_channels; j++) { const uint32_t *scale_table; int scale_sum, log_size; memset(s->scale_factor[j], 0, s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2); if (s->scalefactor_huffman[j] == 6) { scale_table = scale_factor_quant7; log_size = 7; } else { scale_table = scale_factor_quant6; log_size = 6; } /* When huffman coded, only the difference is encoded */ scale_sum = 0; for (k = 0; k < s->subband_activity[j]; k++) { if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) { scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); s->scale_factor[j][k][0] = scale_table[scale_sum]; } if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) { /* Get second scale factor */ scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); s->scale_factor[j][k][1] = scale_table[scale_sum]; } } } /* Joint subband scale factor codebook select */ for (j = base_channel; j < s->prim_channels; j++) { /* Transmitted only if joint subband coding enabled */ if (s->joint_intensity[j] > 0) s->joint_huff[j] = get_bits(&s->gb, 3); } if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; /* Scale factors for joint subband coding */ for (j = base_channel; j < s->prim_channels; j++) { int source_channel; /* Transmitted only if joint subband coding enabled */ if (s->joint_intensity[j] > 0) { int scale = 0; source_channel = s->joint_intensity[j] - 1; /* When huffman coded, only the difference is encoded * (is this valid as well for joint scales ???) */ for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) { scale = get_scale(&s->gb, s->joint_huff[j], 64 /* bias */, 7); s->joint_scale_factor[j][k] = scale; /*joint_scale_table[scale]; */ } if (!(s->debug_flag & 0x02)) { av_log(s->avctx, AV_LOG_DEBUG, "Joint stereo coding not supported\n"); s->debug_flag |= 0x02; } } } /* Stereo downmix coefficients */ if (!base_channel && s->prim_channels > 2) { if (s->downmix) { for (j = base_channel; j < s->prim_channels; j++) { s->downmix_coef[j][0] = get_bits(&s->gb, 7); s->downmix_coef[j][1] = get_bits(&s->gb, 7); } } else { int am = s->amode & DCA_CHANNEL_MASK; if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) { av_log(s->avctx, AV_LOG_ERROR, "Invalid channel mode %d\n", am); return AVERROR_INVALIDDATA; } for (j = base_channel; j < s->prim_channels; j++) { s->downmix_coef[j][0] = dca_default_coeffs[am][j][0]; s->downmix_coef[j][1] = dca_default_coeffs[am][j][1]; } } } /* Dynamic range coefficient */ if (!base_channel && s->dynrange) s->dynrange_coef = get_bits(&s->gb, 8); /* Side information CRC check word */ if (s->crc_present) { get_bits(&s->gb, 16); } /* * Primary audio data arrays */ /* VQ encoded high frequency subbands */ for (j = base_channel; j < s->prim_channels; j++) for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) /* 1 vector -> 32 samples */ s->high_freq_vq[j][k] = get_bits(&s->gb, 10); /* Low frequency effect data */ if (!base_channel && s->lfe) { int quant7; /* LFE samples */ int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); float lfe_scale; for (j = lfe_samples; j < lfe_end_sample; j++) { /* Signed 8 bits int */ s->lfe_data[j] = get_sbits(&s->gb, 8); } /* Scale factor index */ quant7 = get_bits(&s->gb, 8); if (quant7 > 127) { av_log_ask_for_sample(s->avctx, "LFEScaleIndex larger than 127\n"); return AVERROR_INVALIDDATA; } s->lfe_scale_factor = scale_factor_quant7[quant7]; /* Quantization step size * scale factor */ lfe_scale = 0.035 * s->lfe_scale_factor; for (j = lfe_samples; j < lfe_end_sample; j++) s->lfe_data[j] *= lfe_scale; } #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", s->subsubframes[s->current_subframe]); av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n", s->partial_samples[s->current_subframe]); for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:"); for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "prediction coefs: %f, %f, %f, %f\n", (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: "); for (k = 0; k < s->vq_start_subband[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:"); for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:"); for (k = 0; k < s->subband_activity[j]; k++) { if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]); if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { if (s->joint_intensity[j] > 0) { int source_channel = s->joint_intensity[j] - 1; av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n"); for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } if (!base_channel && s->prim_channels > 2 && s->downmix) { av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n"); for (j = 0; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][0]]); av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][1]]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]); if (!base_channel && s->lfe) { int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n"); for (j = lfe_samples; j < lfe_end_sample; j++) av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } #endif return 0; }
true
FFmpeg
8e77c3846e91b1af9df4084736257d9899156eef
static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) { int j, k; if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; if (!base_channel) { s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1; s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) s->prediction_mode[j][k] = get_bits(&s->gb, 1); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) { if (s->prediction_mode[j][k] > 0) { s->prediction_vq[j][k] = get_bits(&s->gb, 12); } } } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->vq_start_subband[j]; k++) { if (s->bitalloc_huffman[j] == 6) s->bitalloc[j][k] = get_bits(&s->gb, 5); else if (s->bitalloc_huffman[j] == 5) s->bitalloc[j][k] = get_bits(&s->gb, 4); else if (s->bitalloc_huffman[j] == 7) { av_log(s->avctx, AV_LOG_ERROR, "Invalid bit allocation index\n"); return AVERROR_INVALIDDATA; } else { s->bitalloc[j][k] = get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]); } if (s->bitalloc[j][k] > 26) { return AVERROR_INVALIDDATA; } } } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) { s->transition_mode[j][k] = 0; if (s->subsubframes[s->current_subframe] > 1 && k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) { s->transition_mode[j][k] = get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]); } } } if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; for (j = base_channel; j < s->prim_channels; j++) { const uint32_t *scale_table; int scale_sum, log_size; memset(s->scale_factor[j], 0, s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2); if (s->scalefactor_huffman[j] == 6) { scale_table = scale_factor_quant7; log_size = 7; } else { scale_table = scale_factor_quant6; log_size = 6; } scale_sum = 0; for (k = 0; k < s->subband_activity[j]; k++) { if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) { scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); s->scale_factor[j][k][0] = scale_table[scale_sum]; } if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) { scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); s->scale_factor[j][k][1] = scale_table[scale_sum]; } } } for (j = base_channel; j < s->prim_channels; j++) { if (s->joint_intensity[j] > 0) s->joint_huff[j] = get_bits(&s->gb, 3); } if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; for (j = base_channel; j < s->prim_channels; j++) { int source_channel; if (s->joint_intensity[j] > 0) { int scale = 0; source_channel = s->joint_intensity[j] - 1; for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) { scale = get_scale(&s->gb, s->joint_huff[j], 64 , 7); s->joint_scale_factor[j][k] = scale; } if (!(s->debug_flag & 0x02)) { av_log(s->avctx, AV_LOG_DEBUG, "Joint stereo coding not supported\n"); s->debug_flag |= 0x02; } } } if (!base_channel && s->prim_channels > 2) { if (s->downmix) { for (j = base_channel; j < s->prim_channels; j++) { s->downmix_coef[j][0] = get_bits(&s->gb, 7); s->downmix_coef[j][1] = get_bits(&s->gb, 7); } } else { int am = s->amode & DCA_CHANNEL_MASK; if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) { av_log(s->avctx, AV_LOG_ERROR, "Invalid channel mode %d\n", am); return AVERROR_INVALIDDATA; } for (j = base_channel; j < s->prim_channels; j++) { s->downmix_coef[j][0] = dca_default_coeffs[am][j][0]; s->downmix_coef[j][1] = dca_default_coeffs[am][j][1]; } } } if (!base_channel && s->dynrange) s->dynrange_coef = get_bits(&s->gb, 8); if (s->crc_present) { get_bits(&s->gb, 16); } for (j = base_channel; j < s->prim_channels; j++) for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) s->high_freq_vq[j][k] = get_bits(&s->gb, 10); if (!base_channel && s->lfe) { int quant7; int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); float lfe_scale; for (j = lfe_samples; j < lfe_end_sample; j++) { s->lfe_data[j] = get_sbits(&s->gb, 8); } quant7 = get_bits(&s->gb, 8); if (quant7 > 127) { av_log_ask_for_sample(s->avctx, "LFEScaleIndex larger than 127\n"); return AVERROR_INVALIDDATA; } s->lfe_scale_factor = scale_factor_quant7[quant7]; lfe_scale = 0.035 * s->lfe_scale_factor; for (j = lfe_samples; j < lfe_end_sample; j++) s->lfe_data[j] *= lfe_scale; } #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", s->subsubframes[s->current_subframe]); av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n", s->partial_samples[s->current_subframe]); for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:"); for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "prediction coefs: %f, %f, %f, %f\n", (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192, (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: "); for (k = 0; k < s->vq_start_subband[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:"); for (k = 0; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:"); for (k = 0; k < s->subband_activity[j]; k++) { if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]); if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) { if (s->joint_intensity[j] > 0) { int source_channel = s->joint_intensity[j] - 1; av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n"); for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } if (!base_channel && s->prim_channels > 2 && s->downmix) { av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n"); for (j = 0; j < s->prim_channels; j++) { av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][0]]); av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][1]]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for (j = base_channel; j < s->prim_channels; j++) for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]); if (!base_channel && s->lfe) { int lfe_samples = 2 * s->lfe * (4 + block_index); int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n"); for (j = lfe_samples; j < lfe_end_sample; j++) av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]); av_log(s->avctx, AV_LOG_DEBUG, "\n"); } #endif return 0; }
{ "code": [ " for (j = base_channel; j < s->prim_channels; j++) {" ], "line_no": [ 275 ] }
static int FUNC_0(DCAContext *VAR_0, int VAR_1, int VAR_2) { int VAR_3, VAR_4; if (get_bits_left(&VAR_0->gb) < 0) return AVERROR_INVALIDDATA; if (!VAR_1) { VAR_0->subsubframes[VAR_0->current_subframe] = get_bits(&VAR_0->gb, 2) + 1; VAR_0->partial_samples[VAR_0->current_subframe] = get_bits(&VAR_0->gb, 3); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) VAR_0->prediction_mode[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 1); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) { if (VAR_0->prediction_mode[VAR_3][VAR_4] > 0) { VAR_0->prediction_vq[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 12); } } } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { for (VAR_4 = 0; VAR_4 < VAR_0->vq_start_subband[VAR_3]; VAR_4++) { if (VAR_0->bitalloc_huffman[VAR_3] == 6) VAR_0->bitalloc[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 5); else if (VAR_0->bitalloc_huffman[VAR_3] == 5) VAR_0->bitalloc[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 4); else if (VAR_0->bitalloc_huffman[VAR_3] == 7) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid bit allocation index\n"); return AVERROR_INVALIDDATA; } else { VAR_0->bitalloc[VAR_3][VAR_4] = get_bitalloc(&VAR_0->gb, &dca_bitalloc_index, VAR_0->bitalloc_huffman[VAR_3]); } if (VAR_0->bitalloc[VAR_3][VAR_4] > 26) { return AVERROR_INVALIDDATA; } } } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) { VAR_0->transition_mode[VAR_3][VAR_4] = 0; if (VAR_0->subsubframes[VAR_0->current_subframe] > 1 && VAR_4 < VAR_0->vq_start_subband[VAR_3] && VAR_0->bitalloc[VAR_3][VAR_4] > 0) { VAR_0->transition_mode[VAR_3][VAR_4] = get_bitalloc(&VAR_0->gb, &dca_tmode, VAR_0->transient_huffman[VAR_3]); } } } if (get_bits_left(&VAR_0->gb) < 0) return AVERROR_INVALIDDATA; for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { const uint32_t *scale_table; int scale_sum, log_size; memset(VAR_0->scale_factor[VAR_3], 0, VAR_0->subband_activity[VAR_3] * sizeof(VAR_0->scale_factor[0][0][0]) * 2); if (VAR_0->scalefactor_huffman[VAR_3] == 6) { scale_table = scale_factor_quant7; log_size = 7; } else { scale_table = scale_factor_quant6; log_size = 6; } scale_sum = 0; for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) { if (VAR_4 >= VAR_0->vq_start_subband[VAR_3] || VAR_0->bitalloc[VAR_3][VAR_4] > 0) { scale_sum = get_scale(&VAR_0->gb, VAR_0->scalefactor_huffman[VAR_3], scale_sum, log_size); VAR_0->scale_factor[VAR_3][VAR_4][0] = scale_table[scale_sum]; } if (VAR_4 < VAR_0->vq_start_subband[VAR_3] && VAR_0->transition_mode[VAR_3][VAR_4]) { scale_sum = get_scale(&VAR_0->gb, VAR_0->scalefactor_huffman[VAR_3], scale_sum, log_size); VAR_0->scale_factor[VAR_3][VAR_4][1] = scale_table[scale_sum]; } } } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { if (VAR_0->joint_intensity[VAR_3] > 0) VAR_0->joint_huff[VAR_3] = get_bits(&VAR_0->gb, 3); } if (get_bits_left(&VAR_0->gb) < 0) return AVERROR_INVALIDDATA; for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { int source_channel; if (VAR_0->joint_intensity[VAR_3] > 0) { int scale = 0; source_channel = VAR_0->joint_intensity[VAR_3] - 1; for (VAR_4 = VAR_0->subband_activity[VAR_3]; VAR_4 < VAR_0->subband_activity[source_channel]; VAR_4++) { scale = get_scale(&VAR_0->gb, VAR_0->joint_huff[VAR_3], 64 , 7); VAR_0->joint_scale_factor[VAR_3][VAR_4] = scale; } if (!(VAR_0->debug_flag & 0x02)) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Joint stereo coding not supported\n"); VAR_0->debug_flag |= 0x02; } } } if (!VAR_1 && VAR_0->prim_channels > 2) { if (VAR_0->downmix) { for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { VAR_0->downmix_coef[VAR_3][0] = get_bits(&VAR_0->gb, 7); VAR_0->downmix_coef[VAR_3][1] = get_bits(&VAR_0->gb, 7); } } else { int VAR_5 = VAR_0->amode & DCA_CHANNEL_MASK; if (VAR_5 >= FF_ARRAY_ELEMS(dca_default_coeffs)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid channel mode %d\n", VAR_5); return AVERROR_INVALIDDATA; } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { VAR_0->downmix_coef[VAR_3][0] = dca_default_coeffs[VAR_5][VAR_3][0]; VAR_0->downmix_coef[VAR_3][1] = dca_default_coeffs[VAR_5][VAR_3][1]; } } } if (!VAR_1 && VAR_0->dynrange) VAR_0->dynrange_coef = get_bits(&VAR_0->gb, 8); if (VAR_0->crc_present) { get_bits(&VAR_0->gb, 16); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) for (VAR_4 = VAR_0->vq_start_subband[VAR_3]; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) VAR_0->high_freq_vq[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 10); if (!VAR_1 && VAR_0->lfe) { int VAR_6; int VAR_7 = 2 * VAR_0->lfe * (4 + VAR_2); int VAR_8 = 2 * VAR_0->lfe * (4 + VAR_2 + VAR_0->subsubframes[VAR_0->current_subframe]); float VAR_9; for (VAR_3 = VAR_7; VAR_3 < VAR_8; VAR_3++) { VAR_0->lfe_data[VAR_3] = get_sbits(&VAR_0->gb, 8); } VAR_6 = get_bits(&VAR_0->gb, 8); if (VAR_6 > 127) { av_log_ask_for_sample(VAR_0->avctx, "LFEScaleIndex larger than 127\n"); return AVERROR_INVALIDDATA; } VAR_0->lfe_scale_factor = scale_factor_quant7[VAR_6]; VAR_9 = 0.035 * VAR_0->lfe_scale_factor; for (VAR_3 = VAR_7; VAR_3 < VAR_8; VAR_3++) VAR_0->lfe_data[VAR_3] *= VAR_9; } #ifdef TRACE av_log(VAR_0->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", VAR_0->subsubframes[VAR_0->current_subframe]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "partial samples: %i\n", VAR_0->partial_samples[VAR_0->current_subframe]); for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "prediction mode:"); for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) av_log(VAR_0->avctx, AV_LOG_DEBUG, " %i", VAR_0->prediction_mode[VAR_3][VAR_4]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "prediction coefs: %f, %f, %f, %f\n", (float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][0] / 8192, (float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][1] / 8192, (float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][2] / 8192, (float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][3] / 8192); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "bitalloc index: "); for (VAR_4 = 0; VAR_4 < VAR_0->vq_start_subband[VAR_3]; VAR_4++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "%2.2i ", VAR_0->bitalloc[VAR_3][VAR_4]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Transition mode:"); for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) av_log(VAR_0->avctx, AV_LOG_DEBUG, " %i", VAR_0->transition_mode[VAR_3][VAR_4]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Scale factor:"); for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) { if (VAR_4 >= VAR_0->vq_start_subband[VAR_3] || VAR_0->bitalloc[VAR_3][VAR_4] > 0) av_log(VAR_0->avctx, AV_LOG_DEBUG, " %i", VAR_0->scale_factor[VAR_3][VAR_4][0]); if (VAR_4 < VAR_0->vq_start_subband[VAR_3] && VAR_0->transition_mode[VAR_3][VAR_4]) av_log(VAR_0->avctx, AV_LOG_DEBUG, " %i(t)", VAR_0->scale_factor[VAR_3][VAR_4][1]); } av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) { if (VAR_0->joint_intensity[VAR_3] > 0) { int source_channel = VAR_0->joint_intensity[VAR_3] - 1; av_log(VAR_0->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n"); for (VAR_4 = VAR_0->subband_activity[VAR_3]; VAR_4 < VAR_0->subband_activity[source_channel]; VAR_4++) av_log(VAR_0->avctx, AV_LOG_DEBUG, " %i", VAR_0->joint_scale_factor[VAR_3][VAR_4]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } } if (!VAR_1 && VAR_0->prim_channels > 2 && VAR_0->downmix) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n"); for (VAR_3 = 0; VAR_3 < VAR_0->prim_channels; VAR_3++) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", VAR_3, dca_downmix_coeffs[VAR_0->downmix_coef[VAR_3][0]]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", VAR_3, dca_downmix_coeffs[VAR_0->downmix_coef[VAR_3][1]]); } av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) for (VAR_4 = VAR_0->vq_start_subband[VAR_3]; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) av_log(VAR_0->avctx, AV_LOG_DEBUG, "VQ index: %i\n", VAR_0->high_freq_vq[VAR_3][VAR_4]); if (!VAR_1 && VAR_0->lfe) { int VAR_7 = 2 * VAR_0->lfe * (4 + VAR_2); int VAR_8 = 2 * VAR_0->lfe * (4 + VAR_2 + VAR_0->subsubframes[VAR_0->current_subframe]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "LFE samples:\n"); for (VAR_3 = VAR_7; VAR_3 < VAR_8; VAR_3++) av_log(VAR_0->avctx, AV_LOG_DEBUG, " %f", VAR_0->lfe_data[VAR_3]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } #endif return 0; }
[ "static int FUNC_0(DCAContext *VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4;", "if (get_bits_left(&VAR_0->gb) < 0)\nreturn AVERROR_INVALIDDATA;", "if (!VAR_1) {", "VAR_0->subsubframes[VAR_0->current_subframe] = get_bits(&VAR_0->gb, 2) + 1;", "VAR_0->partial_samples[VAR_0->current_subframe] = get_bits(&VAR_0->gb, 3);", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++)", "VAR_0->prediction_mode[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 1);", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) {", "if (VAR_0->prediction_mode[VAR_3][VAR_4] > 0) {", "VAR_0->prediction_vq[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 12);", "}", "}", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->vq_start_subband[VAR_3]; VAR_4++) {", "if (VAR_0->bitalloc_huffman[VAR_3] == 6)\nVAR_0->bitalloc[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 5);", "else if (VAR_0->bitalloc_huffman[VAR_3] == 5)\nVAR_0->bitalloc[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 4);", "else if (VAR_0->bitalloc_huffman[VAR_3] == 7) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid bit allocation index\\n\");", "return AVERROR_INVALIDDATA;", "} else {", "VAR_0->bitalloc[VAR_3][VAR_4] =\nget_bitalloc(&VAR_0->gb, &dca_bitalloc_index, VAR_0->bitalloc_huffman[VAR_3]);", "}", "if (VAR_0->bitalloc[VAR_3][VAR_4] > 26) {", "return AVERROR_INVALIDDATA;", "}", "}", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) {", "VAR_0->transition_mode[VAR_3][VAR_4] = 0;", "if (VAR_0->subsubframes[VAR_0->current_subframe] > 1 &&\nVAR_4 < VAR_0->vq_start_subband[VAR_3] && VAR_0->bitalloc[VAR_3][VAR_4] > 0) {", "VAR_0->transition_mode[VAR_3][VAR_4] =\nget_bitalloc(&VAR_0->gb, &dca_tmode, VAR_0->transient_huffman[VAR_3]);", "}", "}", "}", "if (get_bits_left(&VAR_0->gb) < 0)\nreturn AVERROR_INVALIDDATA;", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "const uint32_t *scale_table;", "int scale_sum, log_size;", "memset(VAR_0->scale_factor[VAR_3], 0,\nVAR_0->subband_activity[VAR_3] * sizeof(VAR_0->scale_factor[0][0][0]) * 2);", "if (VAR_0->scalefactor_huffman[VAR_3] == 6) {", "scale_table = scale_factor_quant7;", "log_size = 7;", "} else {", "scale_table = scale_factor_quant6;", "log_size = 6;", "}", "scale_sum = 0;", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) {", "if (VAR_4 >= VAR_0->vq_start_subband[VAR_3] || VAR_0->bitalloc[VAR_3][VAR_4] > 0) {", "scale_sum = get_scale(&VAR_0->gb, VAR_0->scalefactor_huffman[VAR_3], scale_sum, log_size);", "VAR_0->scale_factor[VAR_3][VAR_4][0] = scale_table[scale_sum];", "}", "if (VAR_4 < VAR_0->vq_start_subband[VAR_3] && VAR_0->transition_mode[VAR_3][VAR_4]) {", "scale_sum = get_scale(&VAR_0->gb, VAR_0->scalefactor_huffman[VAR_3], scale_sum, log_size);", "VAR_0->scale_factor[VAR_3][VAR_4][1] = scale_table[scale_sum];", "}", "}", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "if (VAR_0->joint_intensity[VAR_3] > 0)\nVAR_0->joint_huff[VAR_3] = get_bits(&VAR_0->gb, 3);", "}", "if (get_bits_left(&VAR_0->gb) < 0)\nreturn AVERROR_INVALIDDATA;", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "int source_channel;", "if (VAR_0->joint_intensity[VAR_3] > 0) {", "int scale = 0;", "source_channel = VAR_0->joint_intensity[VAR_3] - 1;", "for (VAR_4 = VAR_0->subband_activity[VAR_3]; VAR_4 < VAR_0->subband_activity[source_channel]; VAR_4++) {", "scale = get_scale(&VAR_0->gb, VAR_0->joint_huff[VAR_3], 64 , 7);", "VAR_0->joint_scale_factor[VAR_3][VAR_4] = scale;", "}", "if (!(VAR_0->debug_flag & 0x02)) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"Joint stereo coding not supported\\n\");", "VAR_0->debug_flag |= 0x02;", "}", "}", "}", "if (!VAR_1 && VAR_0->prim_channels > 2) {", "if (VAR_0->downmix) {", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "VAR_0->downmix_coef[VAR_3][0] = get_bits(&VAR_0->gb, 7);", "VAR_0->downmix_coef[VAR_3][1] = get_bits(&VAR_0->gb, 7);", "}", "} else {", "int VAR_5 = VAR_0->amode & DCA_CHANNEL_MASK;", "if (VAR_5 >= FF_ARRAY_ELEMS(dca_default_coeffs)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid channel mode %d\\n\", VAR_5);", "return AVERROR_INVALIDDATA;", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "VAR_0->downmix_coef[VAR_3][0] = dca_default_coeffs[VAR_5][VAR_3][0];", "VAR_0->downmix_coef[VAR_3][1] = dca_default_coeffs[VAR_5][VAR_3][1];", "}", "}", "}", "if (!VAR_1 && VAR_0->dynrange)\nVAR_0->dynrange_coef = get_bits(&VAR_0->gb, 8);", "if (VAR_0->crc_present) {", "get_bits(&VAR_0->gb, 16);", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++)", "for (VAR_4 = VAR_0->vq_start_subband[VAR_3]; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++)", "VAR_0->high_freq_vq[VAR_3][VAR_4] = get_bits(&VAR_0->gb, 10);", "if (!VAR_1 && VAR_0->lfe) {", "int VAR_6;", "int VAR_7 = 2 * VAR_0->lfe * (4 + VAR_2);", "int VAR_8 = 2 * VAR_0->lfe * (4 + VAR_2 + VAR_0->subsubframes[VAR_0->current_subframe]);", "float VAR_9;", "for (VAR_3 = VAR_7; VAR_3 < VAR_8; VAR_3++) {", "VAR_0->lfe_data[VAR_3] = get_sbits(&VAR_0->gb, 8);", "}", "VAR_6 = get_bits(&VAR_0->gb, 8);", "if (VAR_6 > 127) {", "av_log_ask_for_sample(VAR_0->avctx, \"LFEScaleIndex larger than 127\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->lfe_scale_factor = scale_factor_quant7[VAR_6];", "VAR_9 = 0.035 * VAR_0->lfe_scale_factor;", "for (VAR_3 = VAR_7; VAR_3 < VAR_8; VAR_3++)", "VAR_0->lfe_data[VAR_3] *= VAR_9;", "}", "#ifdef TRACE\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"subsubframes: %i\\n\",\nVAR_0->subsubframes[VAR_0->current_subframe]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"partial samples: %i\\n\",\nVAR_0->partial_samples[VAR_0->current_subframe]);", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"prediction mode:\");", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \" %i\", VAR_0->prediction_mode[VAR_3][VAR_4]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"prediction coefs: %f, %f, %f, %f\\n\",\n(float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][0] / 8192,\n(float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][1] / 8192,\n(float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][2] / 8192,\n(float) adpcm_vb[VAR_0->prediction_vq[VAR_3][VAR_4]][3] / 8192);", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"bitalloc index: \");", "for (VAR_4 = 0; VAR_4 < VAR_0->vq_start_subband[VAR_3]; VAR_4++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"%2.2i \", VAR_0->bitalloc[VAR_3][VAR_4]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Transition mode:\");", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \" %i\", VAR_0->transition_mode[VAR_3][VAR_4]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Scale factor:\");", "for (VAR_4 = 0; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++) {", "if (VAR_4 >= VAR_0->vq_start_subband[VAR_3] || VAR_0->bitalloc[VAR_3][VAR_4] > 0)\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \" %i\", VAR_0->scale_factor[VAR_3][VAR_4][0]);", "if (VAR_4 < VAR_0->vq_start_subband[VAR_3] && VAR_0->transition_mode[VAR_3][VAR_4])\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \" %i(t)\", VAR_0->scale_factor[VAR_3][VAR_4][1]);", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "if (VAR_0->joint_intensity[VAR_3] > 0) {", "int source_channel = VAR_0->joint_intensity[VAR_3] - 1;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Joint scale factor index:\\n\");", "for (VAR_4 = VAR_0->subband_activity[VAR_3]; VAR_4 < VAR_0->subband_activity[source_channel]; VAR_4++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \" %i\", VAR_0->joint_scale_factor[VAR_3][VAR_4]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "}", "if (!VAR_1 && VAR_0->prim_channels > 2 && VAR_0->downmix) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Downmix coeffs:\\n\");", "for (VAR_3 = 0; VAR_3 < VAR_0->prim_channels; VAR_3++) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Channel 0, %d = %f\\n\", VAR_3,\ndca_downmix_coeffs[VAR_0->downmix_coef[VAR_3][0]]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"Channel 1, %d = %f\\n\", VAR_3,\ndca_downmix_coeffs[VAR_0->downmix_coef[VAR_3][1]]);", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "for (VAR_3 = VAR_1; VAR_3 < VAR_0->prim_channels; VAR_3++)", "for (VAR_4 = VAR_0->vq_start_subband[VAR_3]; VAR_4 < VAR_0->subband_activity[VAR_3]; VAR_4++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"VQ index: %i\\n\", VAR_0->high_freq_vq[VAR_3][VAR_4]);", "if (!VAR_1 && VAR_0->lfe) {", "int VAR_7 = 2 * VAR_0->lfe * (4 + VAR_2);", "int VAR_8 = 2 * VAR_0->lfe * (4 + VAR_2 + VAR_0->subsubframes[VAR_0->current_subframe]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"LFE samples:\\n\");", "for (VAR_3 = VAR_7; VAR_3 < VAR_8; VAR_3++)", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \" %f\", VAR_0->lfe_data[VAR_3]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "#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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129, 131 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 201 ], [ 205, 207 ], [ 209 ], [ 213, 215 ], [ 221 ], [ 223 ], [ 229 ], [ 231 ], [ 233 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 313, 315 ], [ 321 ], [ 323 ], [ 325 ], [ 339 ], [ 341 ], [ 345 ], [ 351 ], [ 353 ], [ 357 ], [ 359 ], [ 361 ], [ 365 ], [ 369 ], [ 371 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 393 ], [ 397 ], [ 399 ], [ 401 ], [ 405, 407, 409 ], [ 411, 413 ], [ 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 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553, 557 ], [ 559 ] ]
4,098
static void gen_neon_dup_u8(TCGv var, int shift) { TCGv tmp = new_tmp(); if (shift) tcg_gen_shri_i32(var, var, shift); tcg_gen_ext8u_i32(var, var); tcg_gen_shli_i32(tmp, var, 8); tcg_gen_or_i32(var, var, tmp); tcg_gen_shli_i32(tmp, var, 16); tcg_gen_or_i32(var, var, tmp); dead_tmp(tmp); }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static void gen_neon_dup_u8(TCGv var, int shift) { TCGv tmp = new_tmp(); if (shift) tcg_gen_shri_i32(var, var, shift); tcg_gen_ext8u_i32(var, var); tcg_gen_shli_i32(tmp, var, 8); tcg_gen_or_i32(var, var, tmp); tcg_gen_shli_i32(tmp, var, 16); tcg_gen_or_i32(var, var, tmp); dead_tmp(tmp); }
{ "code": [ " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);", " TCGv tmp = new_tmp();", " dead_tmp(tmp);", " dead_tmp(tmp);" ], "line_no": [ 5, 5, 5, 21, 5, 21, 5, 21, 5, 21, 5, 21, 21, 21, 21, 5, 21, 21, 5, 5, 5, 5, 5, 5, 5, 21, 5, 21, 5, 21, 5, 21, 5, 21, 21, 5, 21, 21, 5, 21, 21 ] }
static void FUNC_0(TCGv VAR_0, int VAR_1) { TCGv tmp = new_tmp(); if (VAR_1) tcg_gen_shri_i32(VAR_0, VAR_0, VAR_1); tcg_gen_ext8u_i32(VAR_0, VAR_0); tcg_gen_shli_i32(tmp, VAR_0, 8); tcg_gen_or_i32(VAR_0, VAR_0, tmp); tcg_gen_shli_i32(tmp, VAR_0, 16); tcg_gen_or_i32(VAR_0, VAR_0, tmp); dead_tmp(tmp); }
[ "static void FUNC_0(TCGv VAR_0, int VAR_1)\n{", "TCGv tmp = new_tmp();", "if (VAR_1)\ntcg_gen_shri_i32(VAR_0, VAR_0, VAR_1);", "tcg_gen_ext8u_i32(VAR_0, VAR_0);", "tcg_gen_shli_i32(tmp, VAR_0, 8);", "tcg_gen_or_i32(VAR_0, VAR_0, tmp);", "tcg_gen_shli_i32(tmp, VAR_0, 16);", "tcg_gen_or_i32(VAR_0, VAR_0, tmp);", "dead_tmp(tmp);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
4,099
static target_ulong helper_udiv_common(CPUSPARCState *env, target_ulong a, target_ulong b, int cc) { SPARCCPU *cpu = sparc_env_get_cpu(env); int overflow = 0; uint64_t x0; uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) { cpu_restore_state(CPU(cpu), GETPC()); helper_raise_exception(env, TT_DIV_ZERO); } x0 = x0 / x1; if (x0 > 0xffffffff) { x0 = 0xffffffff; overflow = 1; } if (cc) { env->cc_dst = x0; env->cc_src2 = overflow; env->cc_op = CC_OP_DIV; } return x0; }
true
qemu
6a5b69a959483c7404576a7dc54221ced41e6515
static target_ulong helper_udiv_common(CPUSPARCState *env, target_ulong a, target_ulong b, int cc) { SPARCCPU *cpu = sparc_env_get_cpu(env); int overflow = 0; uint64_t x0; uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) { cpu_restore_state(CPU(cpu), GETPC()); helper_raise_exception(env, TT_DIV_ZERO); } x0 = x0 / x1; if (x0 > 0xffffffff) { x0 = 0xffffffff; overflow = 1; } if (cc) { env->cc_dst = x0; env->cc_src2 = overflow; env->cc_op = CC_OP_DIV; } return x0; }
{ "code": [ " if (x0 > 0xffffffff) {", " x0 = 0xffffffff;", " x0 = x0 / x1;" ], "line_no": [ 35, 37, 33 ] }
static target_ulong FUNC_0(CPUSPARCState *env, target_ulong a, target_ulong b, int cc) { SPARCCPU *cpu = sparc_env_get_cpu(env); int VAR_0 = 0; uint64_t x0; uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) { cpu_restore_state(CPU(cpu), GETPC()); helper_raise_exception(env, TT_DIV_ZERO); } x0 = x0 / x1; if (x0 > 0xffffffff) { x0 = 0xffffffff; VAR_0 = 1; } if (cc) { env->cc_dst = x0; env->cc_src2 = VAR_0; env->cc_op = CC_OP_DIV; } return x0; }
[ "static target_ulong FUNC_0(CPUSPARCState *env, target_ulong a,\ntarget_ulong b, int cc)\n{", "SPARCCPU *cpu = sparc_env_get_cpu(env);", "int VAR_0 = 0;", "uint64_t x0;", "uint32_t x1;", "x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32);", "x1 = (b & 0xffffffff);", "if (x1 == 0) {", "cpu_restore_state(CPU(cpu), GETPC());", "helper_raise_exception(env, TT_DIV_ZERO);", "}", "x0 = x0 / x1;", "if (x0 > 0xffffffff) {", "x0 = 0xffffffff;", "VAR_0 = 1;", "}", "if (cc) {", "env->cc_dst = x0;", "env->cc_src2 = VAR_0;", "env->cc_op = CC_OP_DIV;", "}", "return x0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
4,100
static BlockStats *bdrv_query_stats(const BlockDriverState *bs, bool query_backing) { BlockStats *s; s = g_malloc0(sizeof(*s)); if (bdrv_get_device_name(bs)[0]) { s->has_device = true; s->device = g_strdup(bdrv_get_device_name(bs)); } if (bdrv_get_node_name(bs)[0]) { s->has_node_name = true; s->node_name = g_strdup(bdrv_get_node_name(bs)); } s->stats = g_malloc0(sizeof(*s->stats)); if (bs->blk) { BlockAcctStats *stats = blk_get_stats(bs->blk); s->stats->rd_bytes = stats->nr_bytes[BLOCK_ACCT_READ]; s->stats->wr_bytes = stats->nr_bytes[BLOCK_ACCT_WRITE]; s->stats->rd_operations = stats->nr_ops[BLOCK_ACCT_READ]; s->stats->wr_operations = stats->nr_ops[BLOCK_ACCT_WRITE]; s->stats->failed_rd_operations = stats->failed_ops[BLOCK_ACCT_READ]; s->stats->failed_wr_operations = stats->failed_ops[BLOCK_ACCT_WRITE]; s->stats->failed_flush_operations = stats->failed_ops[BLOCK_ACCT_FLUSH]; s->stats->invalid_rd_operations = stats->invalid_ops[BLOCK_ACCT_READ]; s->stats->invalid_wr_operations = stats->invalid_ops[BLOCK_ACCT_WRITE]; s->stats->invalid_flush_operations = stats->invalid_ops[BLOCK_ACCT_FLUSH]; s->stats->rd_merged = stats->merged[BLOCK_ACCT_READ]; s->stats->wr_merged = stats->merged[BLOCK_ACCT_WRITE]; s->stats->flush_operations = stats->nr_ops[BLOCK_ACCT_FLUSH]; s->stats->wr_total_time_ns = stats->total_time_ns[BLOCK_ACCT_WRITE]; s->stats->rd_total_time_ns = stats->total_time_ns[BLOCK_ACCT_READ]; s->stats->flush_total_time_ns = stats->total_time_ns[BLOCK_ACCT_FLUSH]; s->stats->has_idle_time_ns = stats->last_access_time_ns > 0; if (s->stats->has_idle_time_ns) { s->stats->idle_time_ns = block_acct_idle_time_ns(stats); } } s->stats->wr_highest_offset = bs->wr_highest_offset; if (bs->file) { s->has_parent = true; s->parent = bdrv_query_stats(bs->file->bs, query_backing); } if (query_backing && bs->backing) { s->has_backing = true; s->backing = bdrv_query_stats(bs->backing->bs, query_backing); } return s; }
true
qemu
362e9299b34b3101aaa20f20363441c9f055fa5e
static BlockStats *bdrv_query_stats(const BlockDriverState *bs, bool query_backing) { BlockStats *s; s = g_malloc0(sizeof(*s)); if (bdrv_get_device_name(bs)[0]) { s->has_device = true; s->device = g_strdup(bdrv_get_device_name(bs)); } if (bdrv_get_node_name(bs)[0]) { s->has_node_name = true; s->node_name = g_strdup(bdrv_get_node_name(bs)); } s->stats = g_malloc0(sizeof(*s->stats)); if (bs->blk) { BlockAcctStats *stats = blk_get_stats(bs->blk); s->stats->rd_bytes = stats->nr_bytes[BLOCK_ACCT_READ]; s->stats->wr_bytes = stats->nr_bytes[BLOCK_ACCT_WRITE]; s->stats->rd_operations = stats->nr_ops[BLOCK_ACCT_READ]; s->stats->wr_operations = stats->nr_ops[BLOCK_ACCT_WRITE]; s->stats->failed_rd_operations = stats->failed_ops[BLOCK_ACCT_READ]; s->stats->failed_wr_operations = stats->failed_ops[BLOCK_ACCT_WRITE]; s->stats->failed_flush_operations = stats->failed_ops[BLOCK_ACCT_FLUSH]; s->stats->invalid_rd_operations = stats->invalid_ops[BLOCK_ACCT_READ]; s->stats->invalid_wr_operations = stats->invalid_ops[BLOCK_ACCT_WRITE]; s->stats->invalid_flush_operations = stats->invalid_ops[BLOCK_ACCT_FLUSH]; s->stats->rd_merged = stats->merged[BLOCK_ACCT_READ]; s->stats->wr_merged = stats->merged[BLOCK_ACCT_WRITE]; s->stats->flush_operations = stats->nr_ops[BLOCK_ACCT_FLUSH]; s->stats->wr_total_time_ns = stats->total_time_ns[BLOCK_ACCT_WRITE]; s->stats->rd_total_time_ns = stats->total_time_ns[BLOCK_ACCT_READ]; s->stats->flush_total_time_ns = stats->total_time_ns[BLOCK_ACCT_FLUSH]; s->stats->has_idle_time_ns = stats->last_access_time_ns > 0; if (s->stats->has_idle_time_ns) { s->stats->idle_time_ns = block_acct_idle_time_ns(stats); } } s->stats->wr_highest_offset = bs->wr_highest_offset; if (bs->file) { s->has_parent = true; s->parent = bdrv_query_stats(bs->file->bs, query_backing); } if (query_backing && bs->backing) { s->has_backing = true; s->backing = bdrv_query_stats(bs->backing->bs, query_backing); } return s; }
{ "code": [], "line_no": [] }
static BlockStats *FUNC_0(const BlockDriverState *bs, bool query_backing) { BlockStats *s; s = g_malloc0(sizeof(*s)); if (bdrv_get_device_name(bs)[0]) { s->has_device = true; s->device = g_strdup(bdrv_get_device_name(bs)); } if (bdrv_get_node_name(bs)[0]) { s->has_node_name = true; s->node_name = g_strdup(bdrv_get_node_name(bs)); } s->stats = g_malloc0(sizeof(*s->stats)); if (bs->blk) { BlockAcctStats *stats = blk_get_stats(bs->blk); s->stats->rd_bytes = stats->nr_bytes[BLOCK_ACCT_READ]; s->stats->wr_bytes = stats->nr_bytes[BLOCK_ACCT_WRITE]; s->stats->rd_operations = stats->nr_ops[BLOCK_ACCT_READ]; s->stats->wr_operations = stats->nr_ops[BLOCK_ACCT_WRITE]; s->stats->failed_rd_operations = stats->failed_ops[BLOCK_ACCT_READ]; s->stats->failed_wr_operations = stats->failed_ops[BLOCK_ACCT_WRITE]; s->stats->failed_flush_operations = stats->failed_ops[BLOCK_ACCT_FLUSH]; s->stats->invalid_rd_operations = stats->invalid_ops[BLOCK_ACCT_READ]; s->stats->invalid_wr_operations = stats->invalid_ops[BLOCK_ACCT_WRITE]; s->stats->invalid_flush_operations = stats->invalid_ops[BLOCK_ACCT_FLUSH]; s->stats->rd_merged = stats->merged[BLOCK_ACCT_READ]; s->stats->wr_merged = stats->merged[BLOCK_ACCT_WRITE]; s->stats->flush_operations = stats->nr_ops[BLOCK_ACCT_FLUSH]; s->stats->wr_total_time_ns = stats->total_time_ns[BLOCK_ACCT_WRITE]; s->stats->rd_total_time_ns = stats->total_time_ns[BLOCK_ACCT_READ]; s->stats->flush_total_time_ns = stats->total_time_ns[BLOCK_ACCT_FLUSH]; s->stats->has_idle_time_ns = stats->last_access_time_ns > 0; if (s->stats->has_idle_time_ns) { s->stats->idle_time_ns = block_acct_idle_time_ns(stats); } } s->stats->wr_highest_offset = bs->wr_highest_offset; if (bs->file) { s->has_parent = true; s->parent = FUNC_0(bs->file->bs, query_backing); } if (query_backing && bs->backing) { s->has_backing = true; s->backing = FUNC_0(bs->backing->bs, query_backing); } return s; }
[ "static BlockStats *FUNC_0(const BlockDriverState *bs,\nbool query_backing)\n{", "BlockStats *s;", "s = g_malloc0(sizeof(*s));", "if (bdrv_get_device_name(bs)[0]) {", "s->has_device = true;", "s->device = g_strdup(bdrv_get_device_name(bs));", "}", "if (bdrv_get_node_name(bs)[0]) {", "s->has_node_name = true;", "s->node_name = g_strdup(bdrv_get_node_name(bs));", "}", "s->stats = g_malloc0(sizeof(*s->stats));", "if (bs->blk) {", "BlockAcctStats *stats = blk_get_stats(bs->blk);", "s->stats->rd_bytes = stats->nr_bytes[BLOCK_ACCT_READ];", "s->stats->wr_bytes = stats->nr_bytes[BLOCK_ACCT_WRITE];", "s->stats->rd_operations = stats->nr_ops[BLOCK_ACCT_READ];", "s->stats->wr_operations = stats->nr_ops[BLOCK_ACCT_WRITE];", "s->stats->failed_rd_operations = stats->failed_ops[BLOCK_ACCT_READ];", "s->stats->failed_wr_operations = stats->failed_ops[BLOCK_ACCT_WRITE];", "s->stats->failed_flush_operations = stats->failed_ops[BLOCK_ACCT_FLUSH];", "s->stats->invalid_rd_operations = stats->invalid_ops[BLOCK_ACCT_READ];", "s->stats->invalid_wr_operations = stats->invalid_ops[BLOCK_ACCT_WRITE];", "s->stats->invalid_flush_operations =\nstats->invalid_ops[BLOCK_ACCT_FLUSH];", "s->stats->rd_merged = stats->merged[BLOCK_ACCT_READ];", "s->stats->wr_merged = stats->merged[BLOCK_ACCT_WRITE];", "s->stats->flush_operations = stats->nr_ops[BLOCK_ACCT_FLUSH];", "s->stats->wr_total_time_ns = stats->total_time_ns[BLOCK_ACCT_WRITE];", "s->stats->rd_total_time_ns = stats->total_time_ns[BLOCK_ACCT_READ];", "s->stats->flush_total_time_ns = stats->total_time_ns[BLOCK_ACCT_FLUSH];", "s->stats->has_idle_time_ns = stats->last_access_time_ns > 0;", "if (s->stats->has_idle_time_ns) {", "s->stats->idle_time_ns = block_acct_idle_time_ns(stats);", "}", "}", "s->stats->wr_highest_offset = bs->wr_highest_offset;", "if (bs->file) {", "s->has_parent = true;", "s->parent = FUNC_0(bs->file->bs, query_backing);", "}", "if (query_backing && bs->backing) {", "s->has_backing = true;", "s->backing = FUNC_0(bs->backing->bs, query_backing);", "}", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ] ]
4,101
static uint64_t hb_regs_read(void *opaque, hwaddr offset, unsigned size) { uint32_t *regs = opaque; uint32_t value = regs[offset/4]; if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { value |= 0x30000000; } return value; }
false
qemu
c5c752af8cddad3e4e51acef40a46db998638144
static uint64_t hb_regs_read(void *opaque, hwaddr offset, unsigned size) { uint32_t *regs = opaque; uint32_t value = regs[offset/4]; if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { value |= 0x30000000; } return value; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, hwaddr offset, unsigned size) { uint32_t *regs = opaque; uint32_t value = regs[offset/4]; if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) { value |= 0x30000000; } return value; }
[ "static uint64_t FUNC_0(void *opaque, hwaddr offset,\nunsigned size)\n{", "uint32_t *regs = opaque;", "uint32_t value = regs[offset/4];", "if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) {", "value |= 0x30000000;", "}", "return value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
4,103
static unsigned acpi_data_len(GArray *table) { #if GLIB_CHECK_VERSION(2, 14, 0) assert(g_array_get_element_size(table) == 1); #endif return table->len; }
false
qemu
134d42d614768b2803e551621f6654dab1fdc2d2
static unsigned acpi_data_len(GArray *table) { #if GLIB_CHECK_VERSION(2, 14, 0) assert(g_array_get_element_size(table) == 1); #endif return table->len; }
{ "code": [], "line_no": [] }
static unsigned FUNC_0(GArray *VAR_0) { #if GLIB_CHECK_VERSION(2, 14, 0) assert(g_array_get_element_size(VAR_0) == 1); #endif return VAR_0->len; }
[ "static unsigned FUNC_0(GArray *VAR_0)\n{", "#if GLIB_CHECK_VERSION(2, 14, 0)\nassert(g_array_get_element_size(VAR_0) == 1);", "#endif\nreturn VAR_0->len;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ] ]
4,105
static void init_excp_970 (CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; env->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380; env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; env->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480; env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; #if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */ env->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980; #endif env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; env->excp_vectors[POWERPC_EXCP_MAINT] = 0x00001600; env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001700; env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001800; env->excp_prefix = 0x00000000FFF00000ULL; /* Hardware reset vector */ env->hreset_vector = 0x0000000000000100ULL; #endif }
false
qemu
b172c56a6d849554f7e43adc95983a9d6c042689
static void init_excp_970 (CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; env->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380; env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; env->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480; env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; #if defined(TARGET_PPC64H) env->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980; #endif env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; env->excp_vectors[POWERPC_EXCP_MAINT] = 0x00001600; env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001700; env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001800; env->excp_prefix = 0x00000000FFF00000ULL; env->hreset_vector = 0x0000000000000100ULL; #endif }
{ "code": [], "line_no": [] }
static void FUNC_0 (CPUPPCState *VAR_0) { #if !defined(CONFIG_USER_ONLY) VAR_0->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; VAR_0->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; VAR_0->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; VAR_0->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380; VAR_0->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; VAR_0->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480; VAR_0->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500; VAR_0->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600; VAR_0->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700; VAR_0->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800; VAR_0->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900; #if defined(TARGET_PPC64H) VAR_0->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980; #endif VAR_0->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00; VAR_0->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00; VAR_0->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00; VAR_0->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20; VAR_0->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300; VAR_0->excp_vectors[POWERPC_EXCP_MAINT] = 0x00001600; VAR_0->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001700; VAR_0->excp_vectors[POWERPC_EXCP_THERM] = 0x00001800; VAR_0->excp_prefix = 0x00000000FFF00000ULL; VAR_0->hreset_vector = 0x0000000000000100ULL; #endif }
[ "static void FUNC_0 (CPUPPCState *VAR_0)\n{", "#if !defined(CONFIG_USER_ONLY)\nVAR_0->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;", "VAR_0->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;", "VAR_0->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;", "VAR_0->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380;", "VAR_0->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;", "VAR_0->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480;", "VAR_0->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;", "VAR_0->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;", "VAR_0->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;", "VAR_0->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;", "VAR_0->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;", "#if defined(TARGET_PPC64H)\nVAR_0->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980;", "#endif\nVAR_0->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;", "VAR_0->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;", "VAR_0->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;", "VAR_0->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20;", "VAR_0->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;", "VAR_0->excp_vectors[POWERPC_EXCP_MAINT] = 0x00001600;", "VAR_0->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001700;", "VAR_0->excp_vectors[POWERPC_EXCP_THERM] = 0x00001800;", "VAR_0->excp_prefix = 0x00000000FFF00000ULL;", "VAR_0->hreset_vector = 0x0000000000000100ULL;", "#endif\n}" ]
[ 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 ], [ 55 ], [ 57, 59 ] ]
4,106
static int proxy_ioc_getversion(FsContext *fs_ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; /* Do not try to open special files like device nodes, fifos etc * we can get fd for regular files and directories only */ if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { errno = ENOTTY; return -1; } err = v9fs_request(fs_ctx->private, T_GETVERSION, st_gen, "s", path); if (err < 0) { errno = -err; err = -1; } return err; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_ioc_getversion(FsContext *fs_ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { errno = ENOTTY; return -1; } err = v9fs_request(fs_ctx->private, T_GETVERSION, st_gen, "s", path); if (err < 0) { errno = -err; err = -1; } return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, mode_t VAR_2, uint64_t *VAR_3) { int VAR_4; if (!S_ISREG(VAR_2) && !S_ISDIR(VAR_2)) { errno = ENOTTY; return -1; } VAR_4 = v9fs_request(VAR_0->private, T_GETVERSION, VAR_3, "s", VAR_1); if (VAR_4 < 0) { errno = -VAR_4; VAR_4 = -1; } return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nmode_t VAR_2, uint64_t *VAR_3)\n{", "int VAR_4;", "if (!S_ISREG(VAR_2) && !S_ISDIR(VAR_2)) {", "errno = ENOTTY;", "return -1;", "}", "VAR_4 = v9fs_request(VAR_0->private, T_GETVERSION, VAR_3, \"s\", VAR_1);", "if (VAR_4 < 0) {", "errno = -VAR_4;", "VAR_4 = -1;", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
4,107
void vga_common_init(VGACommonState *s) { int i, j, v, b; for(i = 0;i < 256; i++) { v = 0; for(j = 0; j < 8; j++) { v |= ((i >> j) & 1) << (j * 4); } expand4[i] = v; v = 0; for(j = 0; j < 4; j++) { v |= ((i >> (2 * j)) & 3) << (j * 4); } expand2[i] = v; } for(i = 0; i < 16; i++) { v = 0; for(j = 0; j < 4; j++) { b = ((i >> j) & 1); v |= b << (2 * j); v |= b << (2 * j + 1); } expand4to8[i] = v; } /* valid range: 1 MB -> 256 MB */ s->vram_size = 1024 * 1024; while (s->vram_size < (s->vram_size_mb << 20) && s->vram_size < (256 << 20)) { s->vram_size <<= 1; } s->vram_size_mb = s->vram_size >> 20; s->is_vbe_vmstate = 1; memory_region_init_ram(&s->vram, "vga.vram", s->vram_size); vmstate_register_ram_global(&s->vram); xen_register_framebuffer(&s->vram); s->vram_ptr = memory_region_get_ram_ptr(&s->vram); s->get_bpp = vga_get_bpp; s->get_offsets = vga_get_offsets; s->get_resolution = vga_get_resolution; s->update = vga_update_display; s->invalidate = vga_invalidate_display; s->screen_dump = vga_screen_dump; s->text_update = vga_update_text; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: s->retrace = vga_dumb_retrace; s->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: s->retrace = vga_precise_retrace; s->update_retrace_info = vga_precise_update_retrace_info; break; } vga_dirty_log_start(s); }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
void vga_common_init(VGACommonState *s) { int i, j, v, b; for(i = 0;i < 256; i++) { v = 0; for(j = 0; j < 8; j++) { v |= ((i >> j) & 1) << (j * 4); } expand4[i] = v; v = 0; for(j = 0; j < 4; j++) { v |= ((i >> (2 * j)) & 3) << (j * 4); } expand2[i] = v; } for(i = 0; i < 16; i++) { v = 0; for(j = 0; j < 4; j++) { b = ((i >> j) & 1); v |= b << (2 * j); v |= b << (2 * j + 1); } expand4to8[i] = v; } s->vram_size = 1024 * 1024; while (s->vram_size < (s->vram_size_mb << 20) && s->vram_size < (256 << 20)) { s->vram_size <<= 1; } s->vram_size_mb = s->vram_size >> 20; s->is_vbe_vmstate = 1; memory_region_init_ram(&s->vram, "vga.vram", s->vram_size); vmstate_register_ram_global(&s->vram); xen_register_framebuffer(&s->vram); s->vram_ptr = memory_region_get_ram_ptr(&s->vram); s->get_bpp = vga_get_bpp; s->get_offsets = vga_get_offsets; s->get_resolution = vga_get_resolution; s->update = vga_update_display; s->invalidate = vga_invalidate_display; s->screen_dump = vga_screen_dump; s->text_update = vga_update_text; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: s->retrace = vga_dumb_retrace; s->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: s->retrace = vga_precise_retrace; s->update_retrace_info = vga_precise_update_retrace_info; break; } vga_dirty_log_start(s); }
{ "code": [], "line_no": [] }
void FUNC_0(VGACommonState *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4; for(VAR_1 = 0;VAR_1 < 256; VAR_1++) { VAR_3 = 0; for(VAR_2 = 0; VAR_2 < 8; VAR_2++) { VAR_3 |= ((VAR_1 >> VAR_2) & 1) << (VAR_2 * 4); } expand4[VAR_1] = VAR_3; VAR_3 = 0; for(VAR_2 = 0; VAR_2 < 4; VAR_2++) { VAR_3 |= ((VAR_1 >> (2 * VAR_2)) & 3) << (VAR_2 * 4); } expand2[VAR_1] = VAR_3; } for(VAR_1 = 0; VAR_1 < 16; VAR_1++) { VAR_3 = 0; for(VAR_2 = 0; VAR_2 < 4; VAR_2++) { VAR_4 = ((VAR_1 >> VAR_2) & 1); VAR_3 |= VAR_4 << (2 * VAR_2); VAR_3 |= VAR_4 << (2 * VAR_2 + 1); } expand4to8[VAR_1] = VAR_3; } VAR_0->vram_size = 1024 * 1024; while (VAR_0->vram_size < (VAR_0->vram_size_mb << 20) && VAR_0->vram_size < (256 << 20)) { VAR_0->vram_size <<= 1; } VAR_0->vram_size_mb = VAR_0->vram_size >> 20; VAR_0->is_vbe_vmstate = 1; memory_region_init_ram(&VAR_0->vram, "vga.vram", VAR_0->vram_size); vmstate_register_ram_global(&VAR_0->vram); xen_register_framebuffer(&VAR_0->vram); VAR_0->vram_ptr = memory_region_get_ram_ptr(&VAR_0->vram); VAR_0->get_bpp = vga_get_bpp; VAR_0->get_offsets = vga_get_offsets; VAR_0->get_resolution = vga_get_resolution; VAR_0->update = vga_update_display; VAR_0->invalidate = vga_invalidate_display; VAR_0->screen_dump = vga_screen_dump; VAR_0->text_update = vga_update_text; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: VAR_0->retrace = vga_dumb_retrace; VAR_0->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: VAR_0->retrace = vga_precise_retrace; VAR_0->update_retrace_info = vga_precise_update_retrace_info; break; } vga_dirty_log_start(VAR_0); }
[ "void FUNC_0(VGACommonState *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4;", "for(VAR_1 = 0;VAR_1 < 256; VAR_1++) {", "VAR_3 = 0;", "for(VAR_2 = 0; VAR_2 < 8; VAR_2++) {", "VAR_3 |= ((VAR_1 >> VAR_2) & 1) << (VAR_2 * 4);", "}", "expand4[VAR_1] = VAR_3;", "VAR_3 = 0;", "for(VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "VAR_3 |= ((VAR_1 >> (2 * VAR_2)) & 3) << (VAR_2 * 4);", "}", "expand2[VAR_1] = VAR_3;", "}", "for(VAR_1 = 0; VAR_1 < 16; VAR_1++) {", "VAR_3 = 0;", "for(VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "VAR_4 = ((VAR_1 >> VAR_2) & 1);", "VAR_3 |= VAR_4 << (2 * VAR_2);", "VAR_3 |= VAR_4 << (2 * VAR_2 + 1);", "}", "expand4to8[VAR_1] = VAR_3;", "}", "VAR_0->vram_size = 1024 * 1024;", "while (VAR_0->vram_size < (VAR_0->vram_size_mb << 20) &&\nVAR_0->vram_size < (256 << 20)) {", "VAR_0->vram_size <<= 1;", "}", "VAR_0->vram_size_mb = VAR_0->vram_size >> 20;", "VAR_0->is_vbe_vmstate = 1;", "memory_region_init_ram(&VAR_0->vram, \"vga.vram\", VAR_0->vram_size);", "vmstate_register_ram_global(&VAR_0->vram);", "xen_register_framebuffer(&VAR_0->vram);", "VAR_0->vram_ptr = memory_region_get_ram_ptr(&VAR_0->vram);", "VAR_0->get_bpp = vga_get_bpp;", "VAR_0->get_offsets = vga_get_offsets;", "VAR_0->get_resolution = vga_get_resolution;", "VAR_0->update = vga_update_display;", "VAR_0->invalidate = vga_invalidate_display;", "VAR_0->screen_dump = vga_screen_dump;", "VAR_0->text_update = vga_update_text;", "switch (vga_retrace_method) {", "case VGA_RETRACE_DUMB:\nVAR_0->retrace = vga_dumb_retrace;", "VAR_0->update_retrace_info = vga_dumb_update_retrace_info;", "break;", "case VGA_RETRACE_PRECISE:\nVAR_0->retrace = vga_precise_retrace;", "VAR_0->update_retrace_info = vga_precise_update_retrace_info;", "break;", "}", "vga_dirty_log_start(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ] ]
4,108
static uint32_t do_mac_read(lan9118_state *s, int reg) { switch (reg) { case MAC_CR: return s->mac_cr; case MAC_ADDRH: return s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8); case MAC_ADDRL: return s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8) | (s->conf.macaddr.a[2] << 16) | (s->conf.macaddr.a[3] << 24); case MAC_HASHH: return s->mac_hashh; break; case MAC_HASHL: return s->mac_hashl; break; case MAC_MII_ACC: return s->mac_mii_acc; case MAC_MII_DATA: return s->mac_mii_data; case MAC_FLOW: return s->mac_flow; default: hw_error("lan9118: Unimplemented MAC register read: %d\n", s->mac_cmd & 0xf); } }
false
qemu
52b4bb7383b32e4e7512f98c57738c8fc9cb35ba
static uint32_t do_mac_read(lan9118_state *s, int reg) { switch (reg) { case MAC_CR: return s->mac_cr; case MAC_ADDRH: return s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8); case MAC_ADDRL: return s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8) | (s->conf.macaddr.a[2] << 16) | (s->conf.macaddr.a[3] << 24); case MAC_HASHH: return s->mac_hashh; break; case MAC_HASHL: return s->mac_hashl; break; case MAC_MII_ACC: return s->mac_mii_acc; case MAC_MII_DATA: return s->mac_mii_data; case MAC_FLOW: return s->mac_flow; default: hw_error("lan9118: Unimplemented MAC register read: %d\n", s->mac_cmd & 0xf); } }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(lan9118_state *s, int reg) { switch (reg) { case MAC_CR: return s->mac_cr; case MAC_ADDRH: return s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8); case MAC_ADDRL: return s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8) | (s->conf.macaddr.a[2] << 16) | (s->conf.macaddr.a[3] << 24); case MAC_HASHH: return s->mac_hashh; break; case MAC_HASHL: return s->mac_hashl; break; case MAC_MII_ACC: return s->mac_mii_acc; case MAC_MII_DATA: return s->mac_mii_data; case MAC_FLOW: return s->mac_flow; default: hw_error("lan9118: Unimplemented MAC register read: %d\n", s->mac_cmd & 0xf); } }
[ "static uint32_t FUNC_0(lan9118_state *s, int reg)\n{", "switch (reg) {", "case MAC_CR:\nreturn s->mac_cr;", "case MAC_ADDRH:\nreturn s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8);", "case MAC_ADDRL:\nreturn s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8)\n| (s->conf.macaddr.a[2] << 16) | (s->conf.macaddr.a[3] << 24);", "case MAC_HASHH:\nreturn s->mac_hashh;", "break;", "case MAC_HASHL:\nreturn s->mac_hashl;", "break;", "case MAC_MII_ACC:\nreturn s->mac_mii_acc;", "case MAC_MII_DATA:\nreturn s->mac_mii_data;", "case MAC_FLOW:\nreturn s->mac_flow;", "default:\nhw_error(\"lan9118: Unimplemented MAC register read: %d\\n\",\ns->mac_cmd & 0xf);", "}", "}" ]
[ 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 ] ]
4,109
void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp) { int64_t value; if (v->type_uint32) { v->type_uint32(v, obj, name, errp); } else { value = *obj; v->type_int64(v, &value, name, errp); if (value < 0 || value > UINT32_MAX) { /* FIXME questionable reuse of errp if callback changed value on error */ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "uint32_t"); return; } *obj = value; } }
false
qemu
f755dea79dc81b0d6a8f6414e0672e165e28d8ba
void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp) { int64_t value; if (v->type_uint32) { v->type_uint32(v, obj, name, errp); } else { value = *obj; v->type_int64(v, &value, name, errp); if (value < 0 || value > UINT32_MAX) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "uint32_t"); return; } *obj = value; } }
{ "code": [], "line_no": [] }
void FUNC_0(Visitor *VAR_0, uint32_t *VAR_1, const char *VAR_2, Error **VAR_3) { int64_t value; if (VAR_0->type_uint32) { VAR_0->type_uint32(VAR_0, VAR_1, VAR_2, VAR_3); } else { value = *VAR_1; VAR_0->type_int64(VAR_0, &value, VAR_2, VAR_3); if (value < 0 || value > UINT32_MAX) { error_setg(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_2 ? VAR_2 : "null", "uint32_t"); return; } *VAR_1 = value; } }
[ "void FUNC_0(Visitor *VAR_0, uint32_t *VAR_1, const char *VAR_2, Error **VAR_3)\n{", "int64_t value;", "if (VAR_0->type_uint32) {", "VAR_0->type_uint32(VAR_0, VAR_1, VAR_2, VAR_3);", "} else {", "value = *VAR_1;", "VAR_0->type_int64(VAR_0, &value, VAR_2, VAR_3);", "if (value < 0 || value > UINT32_MAX) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_VALUE,\nVAR_2 ? VAR_2 : \"null\", \"uint32_t\");", "return;", "}", "*VAR_1 = value;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
4,110
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; int size, stream_id, flags, discard; int64_t pts, last_IP_pts; size= decode_frame_header(nut, &flags, &pts, &stream_id, frame_code); if(size < 0) return -1; if (flags & FLAG_KEY) nut->stream[stream_id].skip_until_key_frame=0; discard= s->streams[ stream_id ]->discard; last_IP_pts= s->streams[ stream_id ]->last_IP_pts; if( (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY)) ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || discard >= AVDISCARD_ALL || nut->stream[stream_id].skip_until_key_frame){ url_fskip(bc, size); return 1; } av_get_packet(bc, pkt, size); pkt->stream_index = stream_id; if (flags & FLAG_KEY) pkt->flags |= PKT_FLAG_KEY; pkt->pts = pts; return 0; }
false
FFmpeg
06599638dd678c9939df0fd83ff693c43b25971d
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; int size, stream_id, flags, discard; int64_t pts, last_IP_pts; size= decode_frame_header(nut, &flags, &pts, &stream_id, frame_code); if(size < 0) return -1; if (flags & FLAG_KEY) nut->stream[stream_id].skip_until_key_frame=0; discard= s->streams[ stream_id ]->discard; last_IP_pts= s->streams[ stream_id ]->last_IP_pts; if( (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY)) ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || discard >= AVDISCARD_ALL || nut->stream[stream_id].skip_until_key_frame){ url_fskip(bc, size); return 1; } av_get_packet(bc, pkt, size); pkt->stream_index = stream_id; if (flags & FLAG_KEY) pkt->flags |= PKT_FLAG_KEY; pkt->pts = pts; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(NUTContext *VAR_0, AVPacket *VAR_1, int VAR_2){ AVFormatContext *s= VAR_0->avf; ByteIOContext *bc = &s->pb; int VAR_3, VAR_4, VAR_5, VAR_6; int64_t pts, last_IP_pts; VAR_3= decode_frame_header(VAR_0, &VAR_5, &pts, &VAR_4, VAR_2); if(VAR_3 < 0) return -1; if (VAR_5 & FLAG_KEY) VAR_0->stream[VAR_4].skip_until_key_frame=0; VAR_6= s->streams[ VAR_4 ]->VAR_6; last_IP_pts= s->streams[ VAR_4 ]->last_IP_pts; if( (VAR_6 >= AVDISCARD_NONKEY && !(VAR_5 & FLAG_KEY)) ||(VAR_6 >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || VAR_6 >= AVDISCARD_ALL || VAR_0->stream[VAR_4].skip_until_key_frame){ url_fskip(bc, VAR_3); return 1; } av_get_packet(bc, VAR_1, VAR_3); VAR_1->stream_index = VAR_4; if (VAR_5 & FLAG_KEY) VAR_1->VAR_5 |= PKT_FLAG_KEY; VAR_1->pts = pts; return 0; }
[ "static int FUNC_0(NUTContext *VAR_0, AVPacket *VAR_1, int VAR_2){", "AVFormatContext *s= VAR_0->avf;", "ByteIOContext *bc = &s->pb;", "int VAR_3, VAR_4, VAR_5, VAR_6;", "int64_t pts, last_IP_pts;", "VAR_3= decode_frame_header(VAR_0, &VAR_5, &pts, &VAR_4, VAR_2);", "if(VAR_3 < 0)\nreturn -1;", "if (VAR_5 & FLAG_KEY)\nVAR_0->stream[VAR_4].skip_until_key_frame=0;", "VAR_6= s->streams[ VAR_4 ]->VAR_6;", "last_IP_pts= s->streams[ VAR_4 ]->last_IP_pts;", "if( (VAR_6 >= AVDISCARD_NONKEY && !(VAR_5 & FLAG_KEY))\n||(VAR_6 >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)\n|| VAR_6 >= AVDISCARD_ALL\n|| VAR_0->stream[VAR_4].skip_until_key_frame){", "url_fskip(bc, VAR_3);", "return 1;", "}", "av_get_packet(bc, VAR_1, VAR_3);", "VAR_1->stream_index = VAR_4;", "if (VAR_5 & FLAG_KEY)\nVAR_1->VAR_5 |= PKT_FLAG_KEY;", "VAR_1->pts = pts;", "return 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 ], [ 27 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ] ]
4,113
static void bdrv_assign_node_name(BlockDriverState *bs, const char *node_name, Error **errp) { if (!node_name) { return; } /* empty string node name is invalid */ if (node_name[0] == '\0') { error_setg(errp, "Empty node name"); return; } /* takes care of avoiding namespaces collisions */ if (bdrv_find(node_name)) { error_setg(errp, "node-name=%s is conflicting with a device id", node_name); return; } /* takes care of avoiding duplicates node names */ if (bdrv_find_node(node_name)) { error_setg(errp, "Duplicate node name"); return; } /* copy node name into the bs and insert it into the graph list */ pstrcpy(bs->node_name, sizeof(bs->node_name), node_name); QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs, node_list); }
false
qemu
9aebf3b89281a173d2dfeee379b800be5e3f363e
static void bdrv_assign_node_name(BlockDriverState *bs, const char *node_name, Error **errp) { if (!node_name) { return; } if (node_name[0] == '\0') { error_setg(errp, "Empty node name"); return; } if (bdrv_find(node_name)) { error_setg(errp, "node-name=%s is conflicting with a device id", node_name); return; } if (bdrv_find_node(node_name)) { error_setg(errp, "Duplicate node name"); return; } pstrcpy(bs->node_name, sizeof(bs->node_name), node_name); QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs, node_list); }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, Error **VAR_2) { if (!VAR_1) { return; } if (VAR_1[0] == '\0') { error_setg(VAR_2, "Empty node name"); return; } if (bdrv_find(VAR_1)) { error_setg(VAR_2, "node-name=%s is conflicting with a device id", VAR_1); return; } if (bdrv_find_node(VAR_1)) { error_setg(VAR_2, "Duplicate node name"); return; } pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1); QTAILQ_INSERT_TAIL(&graph_bdrv_states, VAR_0, node_list); }
[ "static void FUNC_0(BlockDriverState *VAR_0,\nconst char *VAR_1,\nError **VAR_2)\n{", "if (!VAR_1) {", "return;", "}", "if (VAR_1[0] == '\\0') {", "error_setg(VAR_2, \"Empty node name\");", "return;", "}", "if (bdrv_find(VAR_1)) {", "error_setg(VAR_2, \"node-name=%s is conflicting with a device id\",\nVAR_1);", "return;", "}", "if (bdrv_find_node(VAR_1)) {", "error_setg(VAR_2, \"Duplicate node name\");", "return;", "}", "pstrcpy(VAR_0->VAR_1, sizeof(VAR_0->VAR_1), VAR_1);", "QTAILQ_INSERT_TAIL(&graph_bdrv_states, VAR_0, node_list);", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ] ]
4,114
int bdrv_can_snapshot(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (!drv || bdrv_is_removable(bs) || bdrv_is_read_only(bs)) { return 0; } if (!drv->bdrv_snapshot_create) { if (bs->file != NULL) { return bdrv_can_snapshot(bs->file); } return 0; } return 1; }
false
qemu
07b70bfbb3f3aea9ce7a3a1da78cbfa8ae6bbce6
int bdrv_can_snapshot(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (!drv || bdrv_is_removable(bs) || bdrv_is_read_only(bs)) { return 0; } if (!drv->bdrv_snapshot_create) { if (bs->file != NULL) { return bdrv_can_snapshot(bs->file); } return 0; } return 1; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0) { BlockDriver *drv = VAR_0->drv; if (!drv || bdrv_is_removable(VAR_0) || bdrv_is_read_only(VAR_0)) { return 0; } if (!drv->bdrv_snapshot_create) { if (VAR_0->file != NULL) { return FUNC_0(VAR_0->file); } return 0; } return 1; }
[ "int FUNC_0(BlockDriverState *VAR_0)\n{", "BlockDriver *drv = VAR_0->drv;", "if (!drv || bdrv_is_removable(VAR_0) || bdrv_is_read_only(VAR_0)) {", "return 0;", "}", "if (!drv->bdrv_snapshot_create) {", "if (VAR_0->file != NULL) {", "return FUNC_0(VAR_0->file);", "}", "return 0;", "}", "return 1;", "}" ]
[ 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 ], [ 29 ], [ 31 ] ]
4,115
int float32_le_quiet( float32 a, float32 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { float_raise( float_flag_invalid STATUS_VAR); } return 0; } aSign = extractFloat32Sign( a ); bSign = extractFloat32Sign( b ); if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 ); return ( a == b ) || ( aSign ^ ( a < b ) ); }
false
qemu
f090c9d4ad5812fb92843d6470a1111c15190c4c
int float32_le_quiet( float32 a, float32 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { float_raise( float_flag_invalid STATUS_VAR); } return 0; } aSign = extractFloat32Sign( a ); bSign = extractFloat32Sign( b ); if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 ); return ( a == b ) || ( aSign ^ ( a < b ) ); }
{ "code": [], "line_no": [] }
int FUNC_0( float32 VAR_0, float32 VAR_1 STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat32Exp( VAR_0 ) == 0xFF ) && extractFloat32Frac( VAR_0 ) ) || ( ( extractFloat32Exp( VAR_1 ) == 0xFF ) && extractFloat32Frac( VAR_1 ) ) ) { if ( float32_is_signaling_nan( VAR_0 ) || float32_is_signaling_nan( VAR_1 ) ) { float_raise( float_flag_invalid STATUS_VAR); } return 0; } aSign = extractFloat32Sign( VAR_0 ); bSign = extractFloat32Sign( VAR_1 ); if ( aSign != bSign ) return aSign || ( (bits32) ( ( VAR_0 | VAR_1 )<<1 ) == 0 ); return ( VAR_0 == VAR_1 ) || ( aSign ^ ( VAR_0 < VAR_1 ) ); }
[ "int FUNC_0( float32 VAR_0, float32 VAR_1 STATUS_PARAM )\n{", "flag aSign, bSign;", "if ( ( ( extractFloat32Exp( VAR_0 ) == 0xFF ) && extractFloat32Frac( VAR_0 ) )\n|| ( ( extractFloat32Exp( VAR_1 ) == 0xFF ) && extractFloat32Frac( VAR_1 ) )\n) {", "if ( float32_is_signaling_nan( VAR_0 ) || float32_is_signaling_nan( VAR_1 ) ) {", "float_raise( float_flag_invalid STATUS_VAR);", "}", "return 0;", "}", "aSign = extractFloat32Sign( VAR_0 );", "bSign = extractFloat32Sign( VAR_1 );", "if ( aSign != bSign ) return aSign || ( (bits32) ( ( VAR_0 | VAR_1 )<<1 ) == 0 );", "return ( VAR_0 == VAR_1 ) || ( aSign ^ ( VAR_0 < VAR_1 ) );", "}" ]
[ 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 ], [ 35 ] ]
4,116
static AioContext *block_job_get_aio_context(BlockJob *job) { return job->deferred_to_main_loop ? qemu_get_aio_context() : blk_get_aio_context(job->blk); }
false
qemu
bae8196d9f97916de6323e70e3e374362ee16ec4
static AioContext *block_job_get_aio_context(BlockJob *job) { return job->deferred_to_main_loop ? qemu_get_aio_context() : blk_get_aio_context(job->blk); }
{ "code": [], "line_no": [] }
static AioContext *FUNC_0(BlockJob *job) { return job->deferred_to_main_loop ? qemu_get_aio_context() : blk_get_aio_context(job->blk); }
[ "static AioContext *FUNC_0(BlockJob *job)\n{", "return job->deferred_to_main_loop ?\nqemu_get_aio_context() :\nblk_get_aio_context(job->blk);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 11 ] ]
4,117
static int gen_jz_ecx_string(DisasContext *s, target_ulong next_eip) { int l1, l2; l1 = gen_new_label(); l2 = gen_new_label(); gen_op_jnz_ecx[s->aflag](l1); gen_set_label(l2); gen_jmp_tb(s, next_eip, 1); gen_set_label(l1); return l2; }
false
qemu
6e0d8677cb443e7408c0b7a25a93c6596d7fa380
static int gen_jz_ecx_string(DisasContext *s, target_ulong next_eip) { int l1, l2; l1 = gen_new_label(); l2 = gen_new_label(); gen_op_jnz_ecx[s->aflag](l1); gen_set_label(l2); gen_jmp_tb(s, next_eip, 1); gen_set_label(l1); return l2; }
{ "code": [], "line_no": [] }
static int FUNC_0(DisasContext *VAR_0, target_ulong VAR_1) { int VAR_2, VAR_3; VAR_2 = gen_new_label(); VAR_3 = gen_new_label(); gen_op_jnz_ecx[VAR_0->aflag](VAR_2); gen_set_label(VAR_3); gen_jmp_tb(VAR_0, VAR_1, 1); gen_set_label(VAR_2); return VAR_3; }
[ "static int FUNC_0(DisasContext *VAR_0, target_ulong VAR_1)\n{", "int VAR_2, VAR_3;", "VAR_2 = gen_new_label();", "VAR_3 = gen_new_label();", "gen_op_jnz_ecx[VAR_0->aflag](VAR_2);", "gen_set_label(VAR_3);", "gen_jmp_tb(VAR_0, VAR_1, 1);", "gen_set_label(VAR_2);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
4,119
const char *qjson_get_str(QJSON *json) { return qstring_get_str(json->str); }
false
qemu
17b74b98676aee5bc470b173b1e528d2fce2cf18
const char *qjson_get_str(QJSON *json) { return qstring_get_str(json->str); }
{ "code": [], "line_no": [] }
const char *FUNC_0(QJSON *VAR_0) { return qstring_get_str(VAR_0->str); }
[ "const char *FUNC_0(QJSON *VAR_0)\n{", "return qstring_get_str(VAR_0->str);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,120
void arm_v7m_cpu_do_interrupt(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; uint32_t lr; arm_log_exception(cs->exception_index); /* For exceptions we just mark as pending on the NVIC, and let that handle it. */ switch (cs->exception_index) { case EXCP_UDEF: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNDEFINSTR_MASK; break; case EXCP_NOCP: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK; break; case EXCP_INVSTATE: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVSTATE_MASK; break; case EXCP_SWI: /* The PC already points to the next instruction. */ armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC); break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: /* Note that for M profile we don't have a guest facing FSR, but * the env->exception.fsr will be populated by the code that * raises the fault, in the A profile short-descriptor format. */ switch (env->exception.fsr & 0xf) { case 0x8: /* External Abort */ switch (cs->exception_index) { case EXCP_PREFETCH_ABORT: env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK; qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n"); break; case EXCP_DATA_ABORT: env->v7m.cfsr[M_REG_NS] |= (R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK); env->v7m.bfar = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR and BFAR 0x%x\n", env->v7m.bfar); break; } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS); break; default: /* All other FSR values are either MPU faults or "can't happen * for M profile" cases. */ switch (cs->exception_index) { case EXCP_PREFETCH_ABORT: env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK; qemu_log_mask(CPU_LOG_INT, "...with CFSR.IACCVIOL\n"); break; case EXCP_DATA_ABORT: env->v7m.cfsr[env->v7m.secure] |= (R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK); env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.DACCVIOL and MMFAR 0x%x\n", env->v7m.mmfar[env->v7m.secure]); break; } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM); break; } break; case EXCP_BKPT: if (semihosting_enabled()) { int nr; nr = arm_lduw_code(env, env->regs[15], arm_sctlr_b(env)) & 0xff; if (nr == 0xab) { env->regs[15] += 2; qemu_log_mask(CPU_LOG_INT, "...handling as semihosting call 0x%x\n", env->regs[0]); env->regs[0] = do_arm_semihosting(env); return; } } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG); break; case EXCP_IRQ: break; case EXCP_EXCEPTION_EXIT: do_v7m_exception_exit(cpu); return; default: cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); return; /* Never happens. Keep compiler happy. */ } lr = 0xfffffff1; if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) { lr |= 4; } if (!arm_v7m_is_handler_mode(env)) { lr |= 8; } v7m_push_stack(cpu); v7m_exception_taken(cpu, lr); qemu_log_mask(CPU_LOG_INT, "... as %d\n", env->v7m.exception); }
false
qemu
4d1e7a4745c050f7ccac49a1c01437526b5130b5
void arm_v7m_cpu_do_interrupt(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; uint32_t lr; arm_log_exception(cs->exception_index); switch (cs->exception_index) { case EXCP_UDEF: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNDEFINSTR_MASK; break; case EXCP_NOCP: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK; break; case EXCP_INVSTATE: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVSTATE_MASK; break; case EXCP_SWI: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC); break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: switch (env->exception.fsr & 0xf) { case 0x8: switch (cs->exception_index) { case EXCP_PREFETCH_ABORT: env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK; qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n"); break; case EXCP_DATA_ABORT: env->v7m.cfsr[M_REG_NS] |= (R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK); env->v7m.bfar = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR and BFAR 0x%x\n", env->v7m.bfar); break; } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS); break; default: switch (cs->exception_index) { case EXCP_PREFETCH_ABORT: env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK; qemu_log_mask(CPU_LOG_INT, "...with CFSR.IACCVIOL\n"); break; case EXCP_DATA_ABORT: env->v7m.cfsr[env->v7m.secure] |= (R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK); env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.DACCVIOL and MMFAR 0x%x\n", env->v7m.mmfar[env->v7m.secure]); break; } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM); break; } break; case EXCP_BKPT: if (semihosting_enabled()) { int nr; nr = arm_lduw_code(env, env->regs[15], arm_sctlr_b(env)) & 0xff; if (nr == 0xab) { env->regs[15] += 2; qemu_log_mask(CPU_LOG_INT, "...handling as semihosting call 0x%x\n", env->regs[0]); env->regs[0] = do_arm_semihosting(env); return; } } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG); break; case EXCP_IRQ: break; case EXCP_EXCEPTION_EXIT: do_v7m_exception_exit(cpu); return; default: cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); return; } lr = 0xfffffff1; if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) { lr |= 4; } if (!arm_v7m_is_handler_mode(env)) { lr |= 8; } v7m_push_stack(cpu); v7m_exception_taken(cpu, lr); qemu_log_mask(CPU_LOG_INT, "... as %d\n", env->v7m.exception); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0) { ARMCPU *cpu = ARM_CPU(VAR_0); CPUARMState *env = &cpu->env; uint32_t lr; arm_log_exception(VAR_0->exception_index); switch (VAR_0->exception_index) { case EXCP_UDEF: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNDEFINSTR_MASK; break; case EXCP_NOCP: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK; break; case EXCP_INVSTATE: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVSTATE_MASK; break; case EXCP_SWI: armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC); break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: switch (env->exception.fsr & 0xf) { case 0x8: switch (VAR_0->exception_index) { case EXCP_PREFETCH_ABORT: env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK; qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n"); break; case EXCP_DATA_ABORT: env->v7m.cfsr[M_REG_NS] |= (R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK); env->v7m.bfar = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR and BFAR 0x%x\n", env->v7m.bfar); break; } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS); break; default: switch (VAR_0->exception_index) { case EXCP_PREFETCH_ABORT: env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK; qemu_log_mask(CPU_LOG_INT, "...with CFSR.IACCVIOL\n"); break; case EXCP_DATA_ABORT: env->v7m.cfsr[env->v7m.secure] |= (R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK); env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress; qemu_log_mask(CPU_LOG_INT, "...with CFSR.DACCVIOL and MMFAR 0x%x\n", env->v7m.mmfar[env->v7m.secure]); break; } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM); break; } break; case EXCP_BKPT: if (semihosting_enabled()) { int VAR_1; VAR_1 = arm_lduw_code(env, env->regs[15], arm_sctlr_b(env)) & 0xff; if (VAR_1 == 0xab) { env->regs[15] += 2; qemu_log_mask(CPU_LOG_INT, "...handling as semihosting call 0x%x\n", env->regs[0]); env->regs[0] = do_arm_semihosting(env); return; } } armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG); break; case EXCP_IRQ: break; case EXCP_EXCEPTION_EXIT: do_v7m_exception_exit(cpu); return; default: cpu_abort(VAR_0, "Unhandled exception 0x%x\n", VAR_0->exception_index); return; } lr = 0xfffffff1; if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) { lr |= 4; } if (!arm_v7m_is_handler_mode(env)) { lr |= 8; } v7m_push_stack(cpu); v7m_exception_taken(cpu, lr); qemu_log_mask(CPU_LOG_INT, "... as %d\n", env->v7m.exception); }
[ "void FUNC_0(CPUState *VAR_0)\n{", "ARMCPU *cpu = ARM_CPU(VAR_0);", "CPUARMState *env = &cpu->env;", "uint32_t lr;", "arm_log_exception(VAR_0->exception_index);", "switch (VAR_0->exception_index) {", "case EXCP_UDEF:\narmv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);", "env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNDEFINSTR_MASK;", "break;", "case EXCP_NOCP:\narmv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);", "env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK;", "break;", "case EXCP_INVSTATE:\narmv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);", "env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVSTATE_MASK;", "break;", "case EXCP_SWI:\narmv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC);", "break;", "case EXCP_PREFETCH_ABORT:\ncase EXCP_DATA_ABORT:\nswitch (env->exception.fsr & 0xf) {", "case 0x8:\nswitch (VAR_0->exception_index) {", "case EXCP_PREFETCH_ABORT:\nenv->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK;", "qemu_log_mask(CPU_LOG_INT, \"...with CFSR.IBUSERR\\n\");", "break;", "case EXCP_DATA_ABORT:\nenv->v7m.cfsr[M_REG_NS] |=\n(R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK);", "env->v7m.bfar = env->exception.vaddress;", "qemu_log_mask(CPU_LOG_INT,\n\"...with CFSR.PRECISERR and BFAR 0x%x\\n\",\nenv->v7m.bfar);", "break;", "}", "armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS);", "break;", "default:\nswitch (VAR_0->exception_index) {", "case EXCP_PREFETCH_ABORT:\nenv->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK;", "qemu_log_mask(CPU_LOG_INT, \"...with CFSR.IACCVIOL\\n\");", "break;", "case EXCP_DATA_ABORT:\nenv->v7m.cfsr[env->v7m.secure] |=\n(R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK);", "env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress;", "qemu_log_mask(CPU_LOG_INT,\n\"...with CFSR.DACCVIOL and MMFAR 0x%x\\n\",\nenv->v7m.mmfar[env->v7m.secure]);", "break;", "}", "armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM);", "break;", "}", "break;", "case EXCP_BKPT:\nif (semihosting_enabled()) {", "int VAR_1;", "VAR_1 = arm_lduw_code(env, env->regs[15], arm_sctlr_b(env)) & 0xff;", "if (VAR_1 == 0xab) {", "env->regs[15] += 2;", "qemu_log_mask(CPU_LOG_INT,\n\"...handling as semihosting call 0x%x\\n\",\nenv->regs[0]);", "env->regs[0] = do_arm_semihosting(env);", "return;", "}", "}", "armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG);", "break;", "case EXCP_IRQ:\nbreak;", "case EXCP_EXCEPTION_EXIT:\ndo_v7m_exception_exit(cpu);", "return;", "default:\ncpu_abort(VAR_0, \"Unhandled exception 0x%x\\n\", VAR_0->exception_index);", "return;", "}", "lr = 0xfffffff1;", "if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) {", "lr |= 4;", "}", "if (!arm_v7m_is_handler_mode(env)) {", "lr |= 8;", "}", "v7m_push_stack(cpu);", "v7m_exception_taken(cpu, lr);", "qemu_log_mask(CPU_LOG_INT, \"... as %d\\n\", env->v7m.exception);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 51 ], [ 53 ], [ 55, 57, 67 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 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 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ] ]
4,122
static av_cold int find_component(OMXContext *omx_context, void *logctx, const char *role, char *str, int str_size) { OMX_U32 i, num = 0; char **components; int ret = 0; #if CONFIG_OMX_RPI if (av_strstart(role, "video_encoder.", NULL)) { av_strlcpy(str, "OMX.broadcom.video_encode", str_size); return 0; } #endif omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL); if (!num) { av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role); return AVERROR_ENCODER_NOT_FOUND; } components = av_mallocz(sizeof(char*) * num); if (!components) return AVERROR(ENOMEM); for (i = 0; i < num; i++) { components[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE); if (!components) { ret = AVERROR(ENOMEM); goto end; } } omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) components); av_strlcpy(str, components[0], str_size); end: for (i = 0; i < num; i++) av_free(components[i]); av_free(components); return ret; }
false
FFmpeg
16a75304fe42d3a007c78126b6370c94ccf891f6
static av_cold int find_component(OMXContext *omx_context, void *logctx, const char *role, char *str, int str_size) { OMX_U32 i, num = 0; char **components; int ret = 0; #if CONFIG_OMX_RPI if (av_strstart(role, "video_encoder.", NULL)) { av_strlcpy(str, "OMX.broadcom.video_encode", str_size); return 0; } #endif omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL); if (!num) { av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role); return AVERROR_ENCODER_NOT_FOUND; } components = av_mallocz(sizeof(char*) * num); if (!components) return AVERROR(ENOMEM); for (i = 0; i < num; i++) { components[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE); if (!components) { ret = AVERROR(ENOMEM); goto end; } } omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) components); av_strlcpy(str, components[0], str_size); end: for (i = 0; i < num; i++) av_free(components[i]); av_free(components); return ret; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(OMXContext *omx_context, void *logctx, const char *role, char *str, int str_size) { OMX_U32 i, num = 0; char **VAR_0; int VAR_1 = 0; #if CONFIG_OMX_RPI if (av_strstart(role, "video_encoder.", NULL)) { av_strlcpy(str, "OMX.broadcom.video_encode", str_size); return 0; } #endif omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL); if (!num) { av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role); return AVERROR_ENCODER_NOT_FOUND; } VAR_0 = av_mallocz(sizeof(char*) * num); if (!VAR_0) return AVERROR(ENOMEM); for (i = 0; i < num; i++) { VAR_0[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE); if (!VAR_0) { VAR_1 = AVERROR(ENOMEM); goto end; } } omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) VAR_0); av_strlcpy(str, VAR_0[0], str_size); end: for (i = 0; i < num; i++) av_free(VAR_0[i]); av_free(VAR_0); return VAR_1; }
[ "static av_cold int FUNC_0(OMXContext *omx_context, void *logctx,\nconst char *role, char *str, int str_size)\n{", "OMX_U32 i, num = 0;", "char **VAR_0;", "int VAR_1 = 0;", "#if CONFIG_OMX_RPI\nif (av_strstart(role, \"video_encoder.\", NULL)) {", "av_strlcpy(str, \"OMX.broadcom.video_encode\", str_size);", "return 0;", "}", "#endif\nomx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL);", "if (!num) {", "av_log(logctx, AV_LOG_WARNING, \"No component for role %s found\\n\", role);", "return AVERROR_ENCODER_NOT_FOUND;", "}", "VAR_0 = av_mallocz(sizeof(char*) * num);", "if (!VAR_0)\nreturn AVERROR(ENOMEM);", "for (i = 0; i < num; i++) {", "VAR_0[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE);", "if (!VAR_0) {", "VAR_1 = AVERROR(ENOMEM);", "goto end;", "}", "}", "omx_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) VAR_0);", "av_strlcpy(str, VAR_0[0], str_size);", "end:\nfor (i = 0; i < num; i++)", "av_free(VAR_0[i]);", "av_free(VAR_0);", "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, 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 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
4,123
set_mdic(E1000State *s, int index, uint32_t val) { uint32_t data = val & E1000_MDIC_DATA_MASK; uint32_t addr = ((val & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT); if ((val & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1) // phy # val = s->mac_reg[MDIC] | E1000_MDIC_ERROR; else if (val & E1000_MDIC_OP_READ) { DBGOUT(MDIC, "MDIC read reg 0x%x\n", addr); if (!(phy_regcap[addr] & PHY_R)) { DBGOUT(MDIC, "MDIC read reg %x unhandled\n", addr); val |= E1000_MDIC_ERROR; } else val = (val ^ data) | s->phy_reg[addr]; } else if (val & E1000_MDIC_OP_WRITE) { DBGOUT(MDIC, "MDIC write reg 0x%x, value 0x%x\n", addr, data); if (!(phy_regcap[addr] & PHY_W)) { DBGOUT(MDIC, "MDIC write reg %x unhandled\n", addr); val |= E1000_MDIC_ERROR; } else { if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) { phyreg_writeops[addr](s, index, data); } s->phy_reg[addr] = data; } } s->mac_reg[MDIC] = val | E1000_MDIC_READY; if (val & E1000_MDIC_INT_EN) { set_ics(s, 0, E1000_ICR_MDAC); } }
false
qemu
1195fed9e6790bd8fd86b0dc33e2442d70355ac6
set_mdic(E1000State *s, int index, uint32_t val) { uint32_t data = val & E1000_MDIC_DATA_MASK; uint32_t addr = ((val & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT); if ((val & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1) val = s->mac_reg[MDIC] | E1000_MDIC_ERROR; else if (val & E1000_MDIC_OP_READ) { DBGOUT(MDIC, "MDIC read reg 0x%x\n", addr); if (!(phy_regcap[addr] & PHY_R)) { DBGOUT(MDIC, "MDIC read reg %x unhandled\n", addr); val |= E1000_MDIC_ERROR; } else val = (val ^ data) | s->phy_reg[addr]; } else if (val & E1000_MDIC_OP_WRITE) { DBGOUT(MDIC, "MDIC write reg 0x%x, value 0x%x\n", addr, data); if (!(phy_regcap[addr] & PHY_W)) { DBGOUT(MDIC, "MDIC write reg %x unhandled\n", addr); val |= E1000_MDIC_ERROR; } else { if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) { phyreg_writeops[addr](s, index, data); } s->phy_reg[addr] = data; } } s->mac_reg[MDIC] = val | E1000_MDIC_READY; if (val & E1000_MDIC_INT_EN) { set_ics(s, 0, E1000_ICR_MDAC); } }
{ "code": [], "line_no": [] }
FUNC_0(E1000State *VAR_0, int VAR_1, uint32_t VAR_2) { uint32_t data = VAR_2 & E1000_MDIC_DATA_MASK; uint32_t addr = ((VAR_2 & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT); if ((VAR_2 & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1) VAR_2 = VAR_0->mac_reg[MDIC] | E1000_MDIC_ERROR; else if (VAR_2 & E1000_MDIC_OP_READ) { DBGOUT(MDIC, "MDIC read reg 0x%x\n", addr); if (!(phy_regcap[addr] & PHY_R)) { DBGOUT(MDIC, "MDIC read reg %x unhandled\n", addr); VAR_2 |= E1000_MDIC_ERROR; } else VAR_2 = (VAR_2 ^ data) | VAR_0->phy_reg[addr]; } else if (VAR_2 & E1000_MDIC_OP_WRITE) { DBGOUT(MDIC, "MDIC write reg 0x%x, value 0x%x\n", addr, data); if (!(phy_regcap[addr] & PHY_W)) { DBGOUT(MDIC, "MDIC write reg %x unhandled\n", addr); VAR_2 |= E1000_MDIC_ERROR; } else { if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) { phyreg_writeops[addr](VAR_0, VAR_1, data); } VAR_0->phy_reg[addr] = data; } } VAR_0->mac_reg[MDIC] = VAR_2 | E1000_MDIC_READY; if (VAR_2 & E1000_MDIC_INT_EN) { set_ics(VAR_0, 0, E1000_ICR_MDAC); } }
[ "FUNC_0(E1000State *VAR_0, int VAR_1, uint32_t VAR_2)\n{", "uint32_t data = VAR_2 & E1000_MDIC_DATA_MASK;", "uint32_t addr = ((VAR_2 & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT);", "if ((VAR_2 & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1)\nVAR_2 = VAR_0->mac_reg[MDIC] | E1000_MDIC_ERROR;", "else if (VAR_2 & E1000_MDIC_OP_READ) {", "DBGOUT(MDIC, \"MDIC read reg 0x%x\\n\", addr);", "if (!(phy_regcap[addr] & PHY_R)) {", "DBGOUT(MDIC, \"MDIC read reg %x unhandled\\n\", addr);", "VAR_2 |= E1000_MDIC_ERROR;", "} else", "VAR_2 = (VAR_2 ^ data) | VAR_0->phy_reg[addr];", "} else if (VAR_2 & E1000_MDIC_OP_WRITE) {", "DBGOUT(MDIC, \"MDIC write reg 0x%x, value 0x%x\\n\", addr, data);", "if (!(phy_regcap[addr] & PHY_W)) {", "DBGOUT(MDIC, \"MDIC write reg %x unhandled\\n\", addr);", "VAR_2 |= E1000_MDIC_ERROR;", "} else {", "if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) {", "phyreg_writeops[addr](VAR_0, VAR_1, data);", "}", "VAR_0->phy_reg[addr] = data;", "}", "}", "VAR_0->mac_reg[MDIC] = VAR_2 | E1000_MDIC_READY;", "if (VAR_2 & E1000_MDIC_INT_EN) {", "set_ics(VAR_0, 0, E1000_ICR_MDAC);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
4,124
void phys_mem_set_alloc(void *(*alloc)(size_t)) { phys_mem_alloc = alloc; }
false
qemu
a2b257d6212ade772473f86bf0637480b2578a7e
void phys_mem_set_alloc(void *(*alloc)(size_t)) { phys_mem_alloc = alloc; }
{ "code": [], "line_no": [] }
void FUNC_0(void *(*VAR_0)(size_t)) { phys_mem_alloc = VAR_0; }
[ "void FUNC_0(void *(*VAR_0)(size_t))\n{", "phys_mem_alloc = VAR_0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,126
VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf) { V9fsState *s; int i, len; struct stat stat; FsTypeEntry *fse; s = (V9fsState *)virtio_common_init("virtio-9p", VIRTIO_ID_9P, sizeof(struct virtio_9p_config)+ MAX_TAG_LEN, sizeof(V9fsState)); /* initialize pdu allocator */ QLIST_INIT(&s->free_list); for (i = 0; i < (MAX_REQ - 1); i++) { QLIST_INSERT_HEAD(&s->free_list, &s->pdus[i], next); } s->vq = virtio_add_queue(&s->vdev, MAX_REQ, handle_9p_output); fse = get_fsdev_fsentry(conf->fsdev_id); if (!fse) { /* We don't have a fsdev identified by fsdev_id */ fprintf(stderr, "Virtio-9p device couldn't find fsdev " "with the id %s\n", conf->fsdev_id); exit(1); } if (!fse->path || !conf->tag) { /* we haven't specified a mount_tag or the path */ fprintf(stderr, "fsdev with id %s needs path " "and Virtio-9p device needs mount_tag arguments\n", conf->fsdev_id); exit(1); } if (!strcmp(fse->security_model, "passthrough")) { /* Files on the Fileserver set to client user credentials */ s->ctx.fs_sm = SM_PASSTHROUGH; } else if (!strcmp(fse->security_model, "mapped")) { /* Files on the fileserver are set to QEMU credentials. * Client user credentials are saved in extended attributes. */ s->ctx.fs_sm = SM_MAPPED; } else if (!strcmp(fse->security_model, "none")) { /* * Files on the fileserver are set to QEMU credentials. */ s->ctx.fs_sm = SM_NONE; } else { fprintf(stderr, "Default to security_model=none. You may want" " enable advanced security model using " "security option:\n\t security_model=passthrough \n\t " "security_model=mapped\n"); s->ctx.fs_sm = SM_NONE; } if (lstat(fse->path, &stat)) { fprintf(stderr, "share path %s does not exist\n", fse->path); exit(1); } else if (!S_ISDIR(stat.st_mode)) { fprintf(stderr, "share path %s is not a directory \n", fse->path); exit(1); } s->ctx.fs_root = qemu_strdup(fse->path); len = strlen(conf->tag); if (len > MAX_TAG_LEN) { len = MAX_TAG_LEN; } /* s->tag is non-NULL terminated string */ s->tag = qemu_malloc(len); memcpy(s->tag, conf->tag, len); s->tag_len = len; s->ctx.uid = -1; s->ops = fse->ops; s->vdev.get_features = virtio_9p_get_features; s->config_size = sizeof(struct virtio_9p_config) + s->tag_len; s->vdev.get_config = virtio_9p_get_config; return &s->vdev; }
false
qemu
fc22118d9bb56ec71655b936a29513c140e6c289
VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf) { V9fsState *s; int i, len; struct stat stat; FsTypeEntry *fse; s = (V9fsState *)virtio_common_init("virtio-9p", VIRTIO_ID_9P, sizeof(struct virtio_9p_config)+ MAX_TAG_LEN, sizeof(V9fsState)); QLIST_INIT(&s->free_list); for (i = 0; i < (MAX_REQ - 1); i++) { QLIST_INSERT_HEAD(&s->free_list, &s->pdus[i], next); } s->vq = virtio_add_queue(&s->vdev, MAX_REQ, handle_9p_output); fse = get_fsdev_fsentry(conf->fsdev_id); if (!fse) { fprintf(stderr, "Virtio-9p device couldn't find fsdev " "with the id %s\n", conf->fsdev_id); exit(1); } if (!fse->path || !conf->tag) { fprintf(stderr, "fsdev with id %s needs path " "and Virtio-9p device needs mount_tag arguments\n", conf->fsdev_id); exit(1); } if (!strcmp(fse->security_model, "passthrough")) { s->ctx.fs_sm = SM_PASSTHROUGH; } else if (!strcmp(fse->security_model, "mapped")) { s->ctx.fs_sm = SM_MAPPED; } else if (!strcmp(fse->security_model, "none")) { s->ctx.fs_sm = SM_NONE; } else { fprintf(stderr, "Default to security_model=none. You may want" " enable advanced security model using " "security option:\n\t security_model=passthrough \n\t " "security_model=mapped\n"); s->ctx.fs_sm = SM_NONE; } if (lstat(fse->path, &stat)) { fprintf(stderr, "share path %s does not exist\n", fse->path); exit(1); } else if (!S_ISDIR(stat.st_mode)) { fprintf(stderr, "share path %s is not a directory \n", fse->path); exit(1); } s->ctx.fs_root = qemu_strdup(fse->path); len = strlen(conf->tag); if (len > MAX_TAG_LEN) { len = MAX_TAG_LEN; } s->tag = qemu_malloc(len); memcpy(s->tag, conf->tag, len); s->tag_len = len; s->ctx.uid = -1; s->ops = fse->ops; s->vdev.get_features = virtio_9p_get_features; s->config_size = sizeof(struct virtio_9p_config) + s->tag_len; s->vdev.get_config = virtio_9p_get_config; return &s->vdev; }
{ "code": [], "line_no": [] }
VirtIODevice *FUNC_0(DeviceState *dev, V9fsConf *conf) { V9fsState *s; int VAR_0, VAR_1; struct VAR_2 VAR_2; FsTypeEntry *fse; s = (V9fsState *)virtio_common_init("virtio-9p", VIRTIO_ID_9P, sizeof(struct virtio_9p_config)+ MAX_TAG_LEN, sizeof(V9fsState)); QLIST_INIT(&s->free_list); for (VAR_0 = 0; VAR_0 < (MAX_REQ - 1); VAR_0++) { QLIST_INSERT_HEAD(&s->free_list, &s->pdus[VAR_0], next); } s->vq = virtio_add_queue(&s->vdev, MAX_REQ, handle_9p_output); fse = get_fsdev_fsentry(conf->fsdev_id); if (!fse) { fprintf(stderr, "Virtio-9p device couldn't find fsdev " "with the id %s\n", conf->fsdev_id); exit(1); } if (!fse->path || !conf->tag) { fprintf(stderr, "fsdev with id %s needs path " "and Virtio-9p device needs mount_tag arguments\n", conf->fsdev_id); exit(1); } if (!strcmp(fse->security_model, "passthrough")) { s->ctx.fs_sm = SM_PASSTHROUGH; } else if (!strcmp(fse->security_model, "mapped")) { s->ctx.fs_sm = SM_MAPPED; } else if (!strcmp(fse->security_model, "none")) { s->ctx.fs_sm = SM_NONE; } else { fprintf(stderr, "Default to security_model=none. You may want" " enable advanced security model using " "security option:\n\t security_model=passthrough \n\t " "security_model=mapped\n"); s->ctx.fs_sm = SM_NONE; } if (lstat(fse->path, &VAR_2)) { fprintf(stderr, "share path %s does not exist\n", fse->path); exit(1); } else if (!S_ISDIR(VAR_2.st_mode)) { fprintf(stderr, "share path %s is not a directory \n", fse->path); exit(1); } s->ctx.fs_root = qemu_strdup(fse->path); VAR_1 = strlen(conf->tag); if (VAR_1 > MAX_TAG_LEN) { VAR_1 = MAX_TAG_LEN; } s->tag = qemu_malloc(VAR_1); memcpy(s->tag, conf->tag, VAR_1); s->tag_len = VAR_1; s->ctx.uid = -1; s->ops = fse->ops; s->vdev.get_features = virtio_9p_get_features; s->config_size = sizeof(struct virtio_9p_config) + s->tag_len; s->vdev.get_config = virtio_9p_get_config; return &s->vdev; }
[ "VirtIODevice *FUNC_0(DeviceState *dev, V9fsConf *conf)\n{", "V9fsState *s;", "int VAR_0, VAR_1;", "struct VAR_2 VAR_2;", "FsTypeEntry *fse;", "s = (V9fsState *)virtio_common_init(\"virtio-9p\",\nVIRTIO_ID_9P,\nsizeof(struct virtio_9p_config)+\nMAX_TAG_LEN,\nsizeof(V9fsState));", "QLIST_INIT(&s->free_list);", "for (VAR_0 = 0; VAR_0 < (MAX_REQ - 1); VAR_0++) {", "QLIST_INSERT_HEAD(&s->free_list, &s->pdus[VAR_0], next);", "}", "s->vq = virtio_add_queue(&s->vdev, MAX_REQ, handle_9p_output);", "fse = get_fsdev_fsentry(conf->fsdev_id);", "if (!fse) {", "fprintf(stderr, \"Virtio-9p device couldn't find fsdev \"\n\"with the id %s\\n\", conf->fsdev_id);", "exit(1);", "}", "if (!fse->path || !conf->tag) {", "fprintf(stderr, \"fsdev with id %s needs path \"\n\"and Virtio-9p device needs mount_tag arguments\\n\",\nconf->fsdev_id);", "exit(1);", "}", "if (!strcmp(fse->security_model, \"passthrough\")) {", "s->ctx.fs_sm = SM_PASSTHROUGH;", "} else if (!strcmp(fse->security_model, \"mapped\")) {", "s->ctx.fs_sm = SM_MAPPED;", "} else if (!strcmp(fse->security_model, \"none\")) {", "s->ctx.fs_sm = SM_NONE;", "} else {", "fprintf(stderr, \"Default to security_model=none. You may want\"\n\" enable advanced security model using \"\n\"security option:\\n\\t security_model=passthrough \\n\\t \"\n\"security_model=mapped\\n\");", "s->ctx.fs_sm = SM_NONE;", "}", "if (lstat(fse->path, &VAR_2)) {", "fprintf(stderr, \"share path %s does not exist\\n\", fse->path);", "exit(1);", "} else if (!S_ISDIR(VAR_2.st_mode)) {", "fprintf(stderr, \"share path %s is not a directory \\n\", fse->path);", "exit(1);", "}", "s->ctx.fs_root = qemu_strdup(fse->path);", "VAR_1 = strlen(conf->tag);", "if (VAR_1 > MAX_TAG_LEN) {", "VAR_1 = MAX_TAG_LEN;", "}", "s->tag = qemu_malloc(VAR_1);", "memcpy(s->tag, conf->tag, VAR_1);", "s->tag_len = VAR_1;", "s->ctx.uid = -1;", "s->ops = fse->ops;", "s->vdev.get_features = virtio_9p_get_features;", "s->config_size = sizeof(struct virtio_9p_config) +\ns->tag_len;", "s->vdev.get_config = virtio_9p_get_config;", "return &s->vdev;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 17, 19, 21, 23, 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 93 ], [ 95 ], [ 103 ], [ 107 ], [ 109, 111, 113, 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 173 ], [ 175 ] ]
4,127
static void coroutine_fn aio_read_response(void *opaque) { SheepdogObjRsp rsp; BDRVSheepdogState *s = opaque; int fd = s->fd; int ret; AIOReq *aio_req = NULL; SheepdogAIOCB *acb; uint64_t idx; if (QLIST_EMPTY(&s->inflight_aio_head)) { goto out; } /* read a header */ ret = qemu_co_recv(fd, &rsp, sizeof(rsp)); if (ret < 0) { error_report("failed to get the header, %s", strerror(errno)); goto out; } /* find the right aio_req from the inflight aio list */ QLIST_FOREACH(aio_req, &s->inflight_aio_head, aio_siblings) { if (aio_req->id == rsp.id) { break; } } if (!aio_req) { error_report("cannot find aio_req %x", rsp.id); goto out; } acb = aio_req->aiocb; switch (acb->aiocb_type) { case AIOCB_WRITE_UDATA: /* this coroutine context is no longer suitable for co_recv * because we may send data to update vdi objects */ s->co_recv = NULL; if (!is_data_obj(aio_req->oid)) { break; } idx = data_oid_to_idx(aio_req->oid); if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) { /* * If the object is newly created one, we need to update * the vdi object (metadata object). min_dirty_data_idx * and max_dirty_data_idx are changed to include updated * index between them. */ if (rsp.result == SD_RES_SUCCESS) { s->inode.data_vdi_id[idx] = s->inode.vdi_id; s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); } /* * Some requests may be blocked because simultaneous * create requests are not allowed, so we search the * pending requests here. */ send_pending_req(s, aio_req->oid); } break; case AIOCB_READ_UDATA: ret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov, aio_req->iov_offset, rsp.data_length); if (ret < 0) { error_report("failed to get the data, %s", strerror(errno)); goto out; } break; case AIOCB_FLUSH_CACHE: if (rsp.result == SD_RES_INVALID_PARMS) { DPRINTF("disable cache since the server doesn't support it\n"); s->cache_flags = SD_FLAG_CMD_DIRECT; rsp.result = SD_RES_SUCCESS; } break; case AIOCB_DISCARD_OBJ: switch (rsp.result) { case SD_RES_INVALID_PARMS: error_report("sheep(%s) doesn't support discard command", s->host_spec); rsp.result = SD_RES_SUCCESS; s->discard_supported = false; break; case SD_RES_SUCCESS: idx = data_oid_to_idx(aio_req->oid); s->inode.data_vdi_id[idx] = 0; break; default: break; } } switch (rsp.result) { case SD_RES_SUCCESS: break; case SD_RES_READONLY: ret = resend_aioreq(s, aio_req); if (ret == SD_RES_SUCCESS) { goto out; } /* fall through */ default: acb->ret = -EIO; error_report("%s", sd_strerror(rsp.result)); break; } free_aio_req(s, aio_req); if (!acb->nr_pending) { /* * We've finished all requests which belong to the AIOCB, so * we can switch back to sd_co_readv/writev now. */ acb->aio_done_func(acb); } out: s->co_recv = NULL; }
false
qemu
80731d9da560461bbdcda5ad4b05f4a8a846fccd
static void coroutine_fn aio_read_response(void *opaque) { SheepdogObjRsp rsp; BDRVSheepdogState *s = opaque; int fd = s->fd; int ret; AIOReq *aio_req = NULL; SheepdogAIOCB *acb; uint64_t idx; if (QLIST_EMPTY(&s->inflight_aio_head)) { goto out; } ret = qemu_co_recv(fd, &rsp, sizeof(rsp)); if (ret < 0) { error_report("failed to get the header, %s", strerror(errno)); goto out; } QLIST_FOREACH(aio_req, &s->inflight_aio_head, aio_siblings) { if (aio_req->id == rsp.id) { break; } } if (!aio_req) { error_report("cannot find aio_req %x", rsp.id); goto out; } acb = aio_req->aiocb; switch (acb->aiocb_type) { case AIOCB_WRITE_UDATA: s->co_recv = NULL; if (!is_data_obj(aio_req->oid)) { break; } idx = data_oid_to_idx(aio_req->oid); if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) { if (rsp.result == SD_RES_SUCCESS) { s->inode.data_vdi_id[idx] = s->inode.vdi_id; s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); } send_pending_req(s, aio_req->oid); } break; case AIOCB_READ_UDATA: ret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov, aio_req->iov_offset, rsp.data_length); if (ret < 0) { error_report("failed to get the data, %s", strerror(errno)); goto out; } break; case AIOCB_FLUSH_CACHE: if (rsp.result == SD_RES_INVALID_PARMS) { DPRINTF("disable cache since the server doesn't support it\n"); s->cache_flags = SD_FLAG_CMD_DIRECT; rsp.result = SD_RES_SUCCESS; } break; case AIOCB_DISCARD_OBJ: switch (rsp.result) { case SD_RES_INVALID_PARMS: error_report("sheep(%s) doesn't support discard command", s->host_spec); rsp.result = SD_RES_SUCCESS; s->discard_supported = false; break; case SD_RES_SUCCESS: idx = data_oid_to_idx(aio_req->oid); s->inode.data_vdi_id[idx] = 0; break; default: break; } } switch (rsp.result) { case SD_RES_SUCCESS: break; case SD_RES_READONLY: ret = resend_aioreq(s, aio_req); if (ret == SD_RES_SUCCESS) { goto out; } default: acb->ret = -EIO; error_report("%s", sd_strerror(rsp.result)); break; } free_aio_req(s, aio_req); if (!acb->nr_pending) { acb->aio_done_func(acb); } out: s->co_recv = NULL; }
{ "code": [], "line_no": [] }
static void VAR_0 aio_read_response(void *opaque) { SheepdogObjRsp rsp; BDRVSheepdogState *s = opaque; int fd = s->fd; int ret; AIOReq *aio_req = NULL; SheepdogAIOCB *acb; uint64_t idx; if (QLIST_EMPTY(&s->inflight_aio_head)) { goto out; } ret = qemu_co_recv(fd, &rsp, sizeof(rsp)); if (ret < 0) { error_report("failed to get the header, %s", strerror(errno)); goto out; } QLIST_FOREACH(aio_req, &s->inflight_aio_head, aio_siblings) { if (aio_req->id == rsp.id) { break; } } if (!aio_req) { error_report("cannot find aio_req %x", rsp.id); goto out; } acb = aio_req->aiocb; switch (acb->aiocb_type) { case AIOCB_WRITE_UDATA: s->co_recv = NULL; if (!is_data_obj(aio_req->oid)) { break; } idx = data_oid_to_idx(aio_req->oid); if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) { if (rsp.result == SD_RES_SUCCESS) { s->inode.data_vdi_id[idx] = s->inode.vdi_id; s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); } send_pending_req(s, aio_req->oid); } break; case AIOCB_READ_UDATA: ret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov, aio_req->iov_offset, rsp.data_length); if (ret < 0) { error_report("failed to get the data, %s", strerror(errno)); goto out; } break; case AIOCB_FLUSH_CACHE: if (rsp.result == SD_RES_INVALID_PARMS) { DPRINTF("disable cache since the server doesn't support it\n"); s->cache_flags = SD_FLAG_CMD_DIRECT; rsp.result = SD_RES_SUCCESS; } break; case AIOCB_DISCARD_OBJ: switch (rsp.result) { case SD_RES_INVALID_PARMS: error_report("sheep(%s) doesn't support discard command", s->host_spec); rsp.result = SD_RES_SUCCESS; s->discard_supported = false; break; case SD_RES_SUCCESS: idx = data_oid_to_idx(aio_req->oid); s->inode.data_vdi_id[idx] = 0; break; default: break; } } switch (rsp.result) { case SD_RES_SUCCESS: break; case SD_RES_READONLY: ret = resend_aioreq(s, aio_req); if (ret == SD_RES_SUCCESS) { goto out; } default: acb->ret = -EIO; error_report("%s", sd_strerror(rsp.result)); break; } free_aio_req(s, aio_req); if (!acb->nr_pending) { acb->aio_done_func(acb); } out: s->co_recv = NULL; }
[ "static void VAR_0 aio_read_response(void *opaque)\n{", "SheepdogObjRsp rsp;", "BDRVSheepdogState *s = opaque;", "int fd = s->fd;", "int ret;", "AIOReq *aio_req = NULL;", "SheepdogAIOCB *acb;", "uint64_t idx;", "if (QLIST_EMPTY(&s->inflight_aio_head)) {", "goto out;", "}", "ret = qemu_co_recv(fd, &rsp, sizeof(rsp));", "if (ret < 0) {", "error_report(\"failed to get the header, %s\", strerror(errno));", "goto out;", "}", "QLIST_FOREACH(aio_req, &s->inflight_aio_head, aio_siblings) {", "if (aio_req->id == rsp.id) {", "break;", "}", "}", "if (!aio_req) {", "error_report(\"cannot find aio_req %x\", rsp.id);", "goto out;", "}", "acb = aio_req->aiocb;", "switch (acb->aiocb_type) {", "case AIOCB_WRITE_UDATA:\ns->co_recv = NULL;", "if (!is_data_obj(aio_req->oid)) {", "break;", "}", "idx = data_oid_to_idx(aio_req->oid);", "if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) {", "if (rsp.result == SD_RES_SUCCESS) {", "s->inode.data_vdi_id[idx] = s->inode.vdi_id;", "s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx);", "s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx);", "}", "send_pending_req(s, aio_req->oid);", "}", "break;", "case AIOCB_READ_UDATA:\nret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov,\naio_req->iov_offset, rsp.data_length);", "if (ret < 0) {", "error_report(\"failed to get the data, %s\", strerror(errno));", "goto out;", "}", "break;", "case AIOCB_FLUSH_CACHE:\nif (rsp.result == SD_RES_INVALID_PARMS) {", "DPRINTF(\"disable cache since the server doesn't support it\\n\");", "s->cache_flags = SD_FLAG_CMD_DIRECT;", "rsp.result = SD_RES_SUCCESS;", "}", "break;", "case AIOCB_DISCARD_OBJ:\nswitch (rsp.result) {", "case SD_RES_INVALID_PARMS:\nerror_report(\"sheep(%s) doesn't support discard command\",\ns->host_spec);", "rsp.result = SD_RES_SUCCESS;", "s->discard_supported = false;", "break;", "case SD_RES_SUCCESS:\nidx = data_oid_to_idx(aio_req->oid);", "s->inode.data_vdi_id[idx] = 0;", "break;", "default:\nbreak;", "}", "}", "switch (rsp.result) {", "case SD_RES_SUCCESS:\nbreak;", "case SD_RES_READONLY:\nret = resend_aioreq(s, aio_req);", "if (ret == SD_RES_SUCCESS) {", "goto out;", "}", "default:\nacb->ret = -EIO;", "error_report(\"%s\", sd_strerror(rsp.result));", "break;", "}", "free_aio_req(s, aio_req);", "if (!acb->nr_pending) {", "acb->aio_done_func(acb);", "}", "out:\ns->co_recv = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 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 ], [ 193 ], [ 195, 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ] ]
4,128
static void add_flagname_to_bitmaps(char *flagname, uint32_t *features, uint32_t *ext_features, uint32_t *ext2_features, uint32_t *ext3_features) { int i; int found = 0; for ( i = 0 ; i < 32 ; i++ ) if (feature_name[i] && !strcmp (flagname, feature_name[i])) { *features |= 1 << i; found = 1; } for ( i = 0 ; i < 32 ; i++ ) if (ext_feature_name[i] && !strcmp (flagname, ext_feature_name[i])) { *ext_features |= 1 << i; found = 1; } for ( i = 0 ; i < 32 ; i++ ) if (ext2_feature_name[i] && !strcmp (flagname, ext2_feature_name[i])) { *ext2_features |= 1 << i; found = 1; } for ( i = 0 ; i < 32 ; i++ ) if (ext3_feature_name[i] && !strcmp (flagname, ext3_feature_name[i])) { *ext3_features |= 1 << i; found = 1; } if (!found) { fprintf(stderr, "CPU feature %s not found\n", flagname); } }
false
qemu
6d2edc43731d0e804c1c846db1e07bddfb158ebd
static void add_flagname_to_bitmaps(char *flagname, uint32_t *features, uint32_t *ext_features, uint32_t *ext2_features, uint32_t *ext3_features) { int i; int found = 0; for ( i = 0 ; i < 32 ; i++ ) if (feature_name[i] && !strcmp (flagname, feature_name[i])) { *features |= 1 << i; found = 1; } for ( i = 0 ; i < 32 ; i++ ) if (ext_feature_name[i] && !strcmp (flagname, ext_feature_name[i])) { *ext_features |= 1 << i; found = 1; } for ( i = 0 ; i < 32 ; i++ ) if (ext2_feature_name[i] && !strcmp (flagname, ext2_feature_name[i])) { *ext2_features |= 1 << i; found = 1; } for ( i = 0 ; i < 32 ; i++ ) if (ext3_feature_name[i] && !strcmp (flagname, ext3_feature_name[i])) { *ext3_features |= 1 << i; found = 1; } if (!found) { fprintf(stderr, "CPU feature %s not found\n", flagname); } }
{ "code": [], "line_no": [] }
static void FUNC_0(char *VAR_0, uint32_t *VAR_1, uint32_t *VAR_2, uint32_t *VAR_3, uint32_t *VAR_4) { int VAR_5; int VAR_6 = 0; for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ ) if (feature_name[VAR_5] && !strcmp (VAR_0, feature_name[VAR_5])) { *VAR_1 |= 1 << VAR_5; VAR_6 = 1; } for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ ) if (ext_feature_name[VAR_5] && !strcmp (VAR_0, ext_feature_name[VAR_5])) { *VAR_2 |= 1 << VAR_5; VAR_6 = 1; } for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ ) if (ext2_feature_name[VAR_5] && !strcmp (VAR_0, ext2_feature_name[VAR_5])) { *VAR_3 |= 1 << VAR_5; VAR_6 = 1; } for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ ) if (ext3_feature_name[VAR_5] && !strcmp (VAR_0, ext3_feature_name[VAR_5])) { *VAR_4 |= 1 << VAR_5; VAR_6 = 1; } if (!VAR_6) { fprintf(stderr, "CPU feature %s not VAR_6\n", VAR_0); } }
[ "static void FUNC_0(char *VAR_0, uint32_t *VAR_1,\nuint32_t *VAR_2,\nuint32_t *VAR_3,\nuint32_t *VAR_4)\n{", "int VAR_5;", "int VAR_6 = 0;", "for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ )", "if (feature_name[VAR_5] && !strcmp (VAR_0, feature_name[VAR_5])) {", "*VAR_1 |= 1 << VAR_5;", "VAR_6 = 1;", "}", "for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ )", "if (ext_feature_name[VAR_5] && !strcmp (VAR_0, ext_feature_name[VAR_5])) {", "*VAR_2 |= 1 << VAR_5;", "VAR_6 = 1;", "}", "for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ )", "if (ext2_feature_name[VAR_5] && !strcmp (VAR_0, ext2_feature_name[VAR_5])) {", "*VAR_3 |= 1 << VAR_5;", "VAR_6 = 1;", "}", "for ( VAR_5 = 0 ; VAR_5 < 32 ; VAR_5++ )", "if (ext3_feature_name[VAR_5] && !strcmp (VAR_0, ext3_feature_name[VAR_5])) {", "*VAR_4 |= 1 << VAR_5;", "VAR_6 = 1;", "}", "if (!VAR_6) {", "fprintf(stderr, \"CPU feature %s not VAR_6\\n\", VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
4,129
static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, BlockdevOnError on_source_error, BlockdevOnError on_target_error, bool unmap, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base) { MirrorBlockJob *s; BlockDriverState *replaced_bs; if (granularity == 0) { granularity = bdrv_get_default_bitmap_granularity(target); } assert ((granularity & (granularity - 1)) == 0); if (buf_size < 0) { error_setg(errp, "Invalid parameter 'buf-size'"); return; } if (buf_size == 0) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } /* We can't support this case as long as the block layer can't handle * multiple BlockBackends per BlockDriverState. */ if (replaces) { replaced_bs = bdrv_lookup_bs(replaces, replaces, errp); if (replaced_bs == NULL) { return; } } else { replaced_bs = bs; } if (replaced_bs->blk && target->blk) { error_setg(errp, "Can't create node with two BlockBackends"); return; } s = block_job_create(driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; s->target = target; s->is_none_mode = is_none_mode; s->base = base; s->granularity = granularity; s->buf_size = ROUND_UP(buf_size, granularity); s->unmap = unmap; s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { g_free(s->replaces); block_job_unref(&s->common); return; } bdrv_op_block_all(s->target, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run); trace_mirror_start(bs, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }
false
qemu
1f0c461b82d5ec2664ca0cfc9548f80da87a8f8a
static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, BlockdevOnError on_source_error, BlockdevOnError on_target_error, bool unmap, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base) { MirrorBlockJob *s; BlockDriverState *replaced_bs; if (granularity == 0) { granularity = bdrv_get_default_bitmap_granularity(target); } assert ((granularity & (granularity - 1)) == 0); if (buf_size < 0) { error_setg(errp, "Invalid parameter 'buf-size'"); return; } if (buf_size == 0) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } if (replaces) { replaced_bs = bdrv_lookup_bs(replaces, replaces, errp); if (replaced_bs == NULL) { return; } } else { replaced_bs = bs; } if (replaced_bs->blk && target->blk) { error_setg(errp, "Can't create node with two BlockBackends"); return; } s = block_job_create(driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; s->target = target; s->is_none_mode = is_none_mode; s->base = base; s->granularity = granularity; s->buf_size = ROUND_UP(buf_size, granularity); s->unmap = unmap; s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { g_free(s->replaces); block_job_unref(&s->common); return; } bdrv_op_block_all(s->target, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run); trace_mirror_start(bs, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, const char *VAR_2, int64_t VAR_3, uint32_t VAR_4, int64_t VAR_5, BlockdevOnError VAR_6, BlockdevOnError VAR_7, bool VAR_8, BlockCompletionFunc *VAR_9, void *VAR_10, Error **VAR_11, const BlockJobDriver *VAR_12, bool VAR_13, BlockDriverState *VAR_14) { MirrorBlockJob *s; BlockDriverState *replaced_bs; if (VAR_4 == 0) { VAR_4 = bdrv_get_default_bitmap_granularity(VAR_1); } assert ((VAR_4 & (VAR_4 - 1)) == 0); if (VAR_5 < 0) { error_setg(VAR_11, "Invalid parameter 'buf-size'"); return; } if (VAR_5 == 0) { VAR_5 = DEFAULT_MIRROR_BUF_SIZE; } if (VAR_2) { replaced_bs = bdrv_lookup_bs(VAR_2, VAR_2, VAR_11); if (replaced_bs == NULL) { return; } } else { replaced_bs = VAR_0; } if (replaced_bs->blk && VAR_1->blk) { error_setg(VAR_11, "Can't create node with two BlockBackends"); return; } s = block_job_create(VAR_12, VAR_0, VAR_3, VAR_9, VAR_10, VAR_11); if (!s) { return; } s->VAR_2 = g_strdup(VAR_2); s->VAR_6 = VAR_6; s->VAR_7 = VAR_7; s->VAR_1 = VAR_1; s->VAR_13 = VAR_13; s->VAR_14 = VAR_14; s->VAR_4 = VAR_4; s->VAR_5 = ROUND_UP(VAR_5, VAR_4); s->VAR_8 = VAR_8; s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_0, VAR_4, NULL, VAR_11); if (!s->dirty_bitmap) { g_free(s->VAR_2); block_job_unref(&s->common); return; } bdrv_op_block_all(s->VAR_1, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run); trace_mirror_start(VAR_0, s, s->common.co, VAR_10); qemu_coroutine_enter(s->common.co, s); }
[ "static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,\nconst char *VAR_2,\nint64_t VAR_3, uint32_t VAR_4,\nint64_t VAR_5,\nBlockdevOnError VAR_6,\nBlockdevOnError VAR_7,\nbool VAR_8,\nBlockCompletionFunc *VAR_9,\nvoid *VAR_10, Error **VAR_11,\nconst BlockJobDriver *VAR_12,\nbool VAR_13, BlockDriverState *VAR_14)\n{", "MirrorBlockJob *s;", "BlockDriverState *replaced_bs;", "if (VAR_4 == 0) {", "VAR_4 = bdrv_get_default_bitmap_granularity(VAR_1);", "}", "assert ((VAR_4 & (VAR_4 - 1)) == 0);", "if (VAR_5 < 0) {", "error_setg(VAR_11, \"Invalid parameter 'buf-size'\");", "return;", "}", "if (VAR_5 == 0) {", "VAR_5 = DEFAULT_MIRROR_BUF_SIZE;", "}", "if (VAR_2) {", "replaced_bs = bdrv_lookup_bs(VAR_2, VAR_2, VAR_11);", "if (replaced_bs == NULL) {", "return;", "}", "} else {", "replaced_bs = VAR_0;", "}", "if (replaced_bs->blk && VAR_1->blk) {", "error_setg(VAR_11, \"Can't create node with two BlockBackends\");", "return;", "}", "s = block_job_create(VAR_12, VAR_0, VAR_3, VAR_9, VAR_10, VAR_11);", "if (!s) {", "return;", "}", "s->VAR_2 = g_strdup(VAR_2);", "s->VAR_6 = VAR_6;", "s->VAR_7 = VAR_7;", "s->VAR_1 = VAR_1;", "s->VAR_13 = VAR_13;", "s->VAR_14 = VAR_14;", "s->VAR_4 = VAR_4;", "s->VAR_5 = ROUND_UP(VAR_5, VAR_4);", "s->VAR_8 = VAR_8;", "s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_0, VAR_4, NULL, VAR_11);", "if (!s->dirty_bitmap) {", "g_free(s->VAR_2);", "block_job_unref(&s->common);", "return;", "}", "bdrv_op_block_all(s->VAR_1, s->common.blocker);", "s->common.co = qemu_coroutine_create(mirror_run);", "trace_mirror_start(VAR_0, s, s->common.co, VAR_10);", "qemu_coroutine_enter(s->common.co, s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ] ]
4,130
DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp, int linesize, uint8_t *data) { DisplaySurface *surface = g_new0(DisplaySurface, 1); surface->pf = qemu_default_pixelformat(bpp); surface->format = qemu_pixman_get_format(&surface->pf); assert(surface->format != 0); surface->image = pixman_image_create_bits(surface->format, width, height, (void *)data, linesize); assert(surface->image != NULL); #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_BIG_ENDIAN_FLAG; #endif return surface; }
false
qemu
b1424e0381a7f1c9969079eca4458d5f20bf1859
DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp, int linesize, uint8_t *data) { DisplaySurface *surface = g_new0(DisplaySurface, 1); surface->pf = qemu_default_pixelformat(bpp); surface->format = qemu_pixman_get_format(&surface->pf); assert(surface->format != 0); surface->image = pixman_image_create_bits(surface->format, width, height, (void *)data, linesize); assert(surface->image != NULL); #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_BIG_ENDIAN_FLAG; #endif return surface; }
{ "code": [], "line_no": [] }
DisplaySurface *FUNC_0(int width, int height, int bpp, int linesize, uint8_t *data) { DisplaySurface *surface = g_new0(DisplaySurface, 1); surface->pf = qemu_default_pixelformat(bpp); surface->format = qemu_pixman_get_format(&surface->pf); assert(surface->format != 0); surface->image = pixman_image_create_bits(surface->format, width, height, (void *)data, linesize); assert(surface->image != NULL); #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_BIG_ENDIAN_FLAG; #endif return surface; }
[ "DisplaySurface *FUNC_0(int width, int height, int bpp,\nint linesize, uint8_t *data)\n{", "DisplaySurface *surface = g_new0(DisplaySurface, 1);", "surface->pf = qemu_default_pixelformat(bpp);", "surface->format = qemu_pixman_get_format(&surface->pf);", "assert(surface->format != 0);", "surface->image = pixman_image_create_bits(surface->format,\nwidth, height,\n(void *)data, linesize);", "assert(surface->image != NULL);", "#ifdef HOST_WORDS_BIGENDIAN\nsurface->flags = QEMU_BIG_ENDIAN_FLAG;", "#endif\nreturn surface;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 29, 31 ], [ 33, 37 ], [ 39 ] ]
4,131
static void spapr_phb_reset(DeviceState *qdev) { SysBusDevice *s = SYS_BUS_DEVICE(qdev); sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); /* Reset the IOMMU state */ spapr_tce_reset(sphb->tcet); }
false
qemu
a83000f5e3fac30a7f213af1ba6a8f827622854d
static void spapr_phb_reset(DeviceState *qdev) { SysBusDevice *s = SYS_BUS_DEVICE(qdev); sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); spapr_tce_reset(sphb->tcet); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0) { SysBusDevice *s = SYS_BUS_DEVICE(VAR_0); sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); spapr_tce_reset(sphb->tcet); }
[ "static void FUNC_0(DeviceState *VAR_0)\n{", "SysBusDevice *s = SYS_BUS_DEVICE(VAR_0);", "sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);", "spapr_tce_reset(sphb->tcet);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ] ]
4,132
static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int* n) { BDRVVVFATState* s = bs->opaque; *n = s->sector_count - sector_num; if (*n > nb_sectors) { *n = nb_sectors; } else if (*n < 0) { return 0; } return BDRV_BLOCK_DATA; }
false
qemu
67a0fd2a9bca204d2b39f910a97c7137636a0715
static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int* n) { BDRVVVFATState* s = bs->opaque; *n = s->sector_count - sector_num; if (*n > nb_sectors) { *n = nb_sectors; } else if (*n < 0) { return 0; } return BDRV_BLOCK_DATA; }
{ "code": [], "line_no": [] }
static int64_t VAR_0 vvfat_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int* n) { BDRVVVFATState* s = bs->opaque; *n = s->sector_count - sector_num; if (*n > nb_sectors) { *n = nb_sectors; } else if (*n < 0) { return 0; } return BDRV_BLOCK_DATA; }
[ "static int64_t VAR_0 vvfat_co_get_block_status(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors, int* n)\n{", "BDRVVVFATState* s = bs->opaque;", "*n = s->sector_count - sector_num;", "if (*n > nb_sectors) {", "*n = nb_sectors;", "} else if (*n < 0) {", "return 0;", "}", "return BDRV_BLOCK_DATA;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
4,133
static av_cold int nvenc_check_cuda(AVCodecContext *avctx) { int device_count = 0; CUdevice cu_device = 0; char gpu_name[128]; int smminor = 0, smmajor = 0; int i, smver, target_smver; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; switch (avctx->codec->id) { case AV_CODEC_ID_H264: target_smver = ctx->data_pix_fmt == AV_PIX_FMT_YUV444P ? 0x52 : 0x30; break; case AV_CODEC_ID_H265: target_smver = 0x52; break; default: av_log(avctx, AV_LOG_FATAL, "Unknown codec name\n"); goto error; } if (ctx->preset >= PRESET_LOSSLESS_DEFAULT) target_smver = 0x52; if (!nvenc_dyload_cuda(avctx)) return 0; if (dl_fn->nvenc_device_count > 0) return 1; check_cuda_errors(dl_fn->cu_init(0)); check_cuda_errors(dl_fn->cu_device_get_count(&device_count)); if (!device_count) { av_log(avctx, AV_LOG_FATAL, "No CUDA capable devices found\n"); goto error; } av_log(avctx, AV_LOG_VERBOSE, "%d CUDA capable devices found\n", device_count); dl_fn->nvenc_device_count = 0; for (i = 0; i < device_count; ++i) { check_cuda_errors(dl_fn->cu_device_get(&cu_device, i)); check_cuda_errors(dl_fn->cu_device_get_name(gpu_name, sizeof(gpu_name), cu_device)); check_cuda_errors(dl_fn->cu_device_compute_capability(&smmajor, &smminor, cu_device)); smver = (smmajor << 4) | smminor; av_log(avctx, AV_LOG_VERBOSE, "[ GPU #%d - < %s > has Compute SM %d.%d, NVENC %s ]\n", i, gpu_name, smmajor, smminor, (smver >= target_smver) ? "Available" : "Not Available"); if (smver >= target_smver) dl_fn->nvenc_devices[dl_fn->nvenc_device_count++] = cu_device; } if (!dl_fn->nvenc_device_count) { av_log(avctx, AV_LOG_FATAL, "No NVENC capable devices found\n"); goto error; } return 1; error: dl_fn->nvenc_device_count = 0; return 0; }
false
FFmpeg
0d021cc8b30a6f81c27fbeca7f99f1ee7a20acf8
static av_cold int nvenc_check_cuda(AVCodecContext *avctx) { int device_count = 0; CUdevice cu_device = 0; char gpu_name[128]; int smminor = 0, smmajor = 0; int i, smver, target_smver; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; switch (avctx->codec->id) { case AV_CODEC_ID_H264: target_smver = ctx->data_pix_fmt == AV_PIX_FMT_YUV444P ? 0x52 : 0x30; break; case AV_CODEC_ID_H265: target_smver = 0x52; break; default: av_log(avctx, AV_LOG_FATAL, "Unknown codec name\n"); goto error; } if (ctx->preset >= PRESET_LOSSLESS_DEFAULT) target_smver = 0x52; if (!nvenc_dyload_cuda(avctx)) return 0; if (dl_fn->nvenc_device_count > 0) return 1; check_cuda_errors(dl_fn->cu_init(0)); check_cuda_errors(dl_fn->cu_device_get_count(&device_count)); if (!device_count) { av_log(avctx, AV_LOG_FATAL, "No CUDA capable devices found\n"); goto error; } av_log(avctx, AV_LOG_VERBOSE, "%d CUDA capable devices found\n", device_count); dl_fn->nvenc_device_count = 0; for (i = 0; i < device_count; ++i) { check_cuda_errors(dl_fn->cu_device_get(&cu_device, i)); check_cuda_errors(dl_fn->cu_device_get_name(gpu_name, sizeof(gpu_name), cu_device)); check_cuda_errors(dl_fn->cu_device_compute_capability(&smmajor, &smminor, cu_device)); smver = (smmajor << 4) | smminor; av_log(avctx, AV_LOG_VERBOSE, "[ GPU #%d - < %s > has Compute SM %d.%d, NVENC %s ]\n", i, gpu_name, smmajor, smminor, (smver >= target_smver) ? "Available" : "Not Available"); if (smver >= target_smver) dl_fn->nvenc_devices[dl_fn->nvenc_device_count++] = cu_device; } if (!dl_fn->nvenc_device_count) { av_log(avctx, AV_LOG_FATAL, "No NVENC capable devices found\n"); goto error; } return 1; error: dl_fn->nvenc_device_count = 0; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { int VAR_0 = 0; CUdevice cu_device = 0; char VAR_1[128]; int VAR_2 = 0, VAR_3 = 0; int VAR_4, VAR_5, VAR_6; NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; switch (avctx->codec->id) { case AV_CODEC_ID_H264: VAR_6 = ctx->data_pix_fmt == AV_PIX_FMT_YUV444P ? 0x52 : 0x30; break; case AV_CODEC_ID_H265: VAR_6 = 0x52; break; default: av_log(avctx, AV_LOG_FATAL, "Unknown codec name\n"); goto error; } if (ctx->preset >= PRESET_LOSSLESS_DEFAULT) VAR_6 = 0x52; if (!nvenc_dyload_cuda(avctx)) return 0; if (dl_fn->nvenc_device_count > 0) return 1; check_cuda_errors(dl_fn->cu_init(0)); check_cuda_errors(dl_fn->cu_device_get_count(&VAR_0)); if (!VAR_0) { av_log(avctx, AV_LOG_FATAL, "No CUDA capable devices found\n"); goto error; } av_log(avctx, AV_LOG_VERBOSE, "%d CUDA capable devices found\n", VAR_0); dl_fn->nvenc_device_count = 0; for (VAR_4 = 0; VAR_4 < VAR_0; ++VAR_4) { check_cuda_errors(dl_fn->cu_device_get(&cu_device, VAR_4)); check_cuda_errors(dl_fn->cu_device_get_name(VAR_1, sizeof(VAR_1), cu_device)); check_cuda_errors(dl_fn->cu_device_compute_capability(&VAR_3, &VAR_2, cu_device)); VAR_5 = (VAR_3 << 4) | VAR_2; av_log(avctx, AV_LOG_VERBOSE, "[ GPU #%d - < %s > has Compute SM %d.%d, NVENC %s ]\n", VAR_4, VAR_1, VAR_3, VAR_2, (VAR_5 >= VAR_6) ? "Available" : "Not Available"); if (VAR_5 >= VAR_6) dl_fn->nvenc_devices[dl_fn->nvenc_device_count++] = cu_device; } if (!dl_fn->nvenc_device_count) { av_log(avctx, AV_LOG_FATAL, "No NVENC capable devices found\n"); goto error; } return 1; error: dl_fn->nvenc_device_count = 0; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "int VAR_0 = 0;", "CUdevice cu_device = 0;", "char VAR_1[128];", "int VAR_2 = 0, VAR_3 = 0;", "int VAR_4, VAR_5, VAR_6;", "NvencContext *ctx = avctx->priv_data;", "NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;", "switch (avctx->codec->id) {", "case AV_CODEC_ID_H264:\nVAR_6 = ctx->data_pix_fmt == AV_PIX_FMT_YUV444P ? 0x52 : 0x30;", "break;", "case AV_CODEC_ID_H265:\nVAR_6 = 0x52;", "break;", "default:\nav_log(avctx, AV_LOG_FATAL, \"Unknown codec name\\n\");", "goto error;", "}", "if (ctx->preset >= PRESET_LOSSLESS_DEFAULT)\nVAR_6 = 0x52;", "if (!nvenc_dyload_cuda(avctx))\nreturn 0;", "if (dl_fn->nvenc_device_count > 0)\nreturn 1;", "check_cuda_errors(dl_fn->cu_init(0));", "check_cuda_errors(dl_fn->cu_device_get_count(&VAR_0));", "if (!VAR_0) {", "av_log(avctx, AV_LOG_FATAL, \"No CUDA capable devices found\\n\");", "goto error;", "}", "av_log(avctx, AV_LOG_VERBOSE, \"%d CUDA capable devices found\\n\", VAR_0);", "dl_fn->nvenc_device_count = 0;", "for (VAR_4 = 0; VAR_4 < VAR_0; ++VAR_4) {", "check_cuda_errors(dl_fn->cu_device_get(&cu_device, VAR_4));", "check_cuda_errors(dl_fn->cu_device_get_name(VAR_1, sizeof(VAR_1), cu_device));", "check_cuda_errors(dl_fn->cu_device_compute_capability(&VAR_3, &VAR_2, cu_device));", "VAR_5 = (VAR_3 << 4) | VAR_2;", "av_log(avctx, AV_LOG_VERBOSE, \"[ GPU #%d - < %s > has Compute SM %d.%d, NVENC %s ]\\n\", VAR_4, VAR_1, VAR_3, VAR_2, (VAR_5 >= VAR_6) ? \"Available\" : \"Not Available\");", "if (VAR_5 >= VAR_6)\ndl_fn->nvenc_devices[dl_fn->nvenc_device_count++] = cu_device;", "}", "if (!dl_fn->nvenc_device_count) {", "av_log(avctx, AV_LOG_FATAL, \"No NVENC capable devices found\\n\");", "goto error;", "}", "return 1;", "error:\ndl_fn->nvenc_device_count = 0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 53, 55 ], [ 59, 61 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 131, 135 ], [ 139 ], [ 141 ] ]
4,134
static void gic_dist_writeb(void *opaque, hwaddr offset, uint32_t value, MemTxAttrs attrs) { GICState *s = (GICState *)opaque; int irq; int i; int cpu; cpu = gic_get_current_cpu(s); if (offset < 0x100) { if (offset == 0) { s->enabled = (value & 1); DPRINTF("Distribution %sabled\n", s->enabled ? "En" : "Dis"); } else if (offset < 4) { /* ignored. */ } else if (offset >= 0x80) { /* Interrupt Security Registers, RAZ/WI */ } else { goto bad_reg; } } else if (offset < 0x180) { /* Interrupt Set Enable. */ irq = (offset - 0x100) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0xff; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { int mask = (irq < GIC_INTERNAL) ? (1 << cpu) : GIC_TARGET(irq + i); int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK; if (!GIC_TEST_ENABLED(irq + i, cm)) { DPRINTF("Enabled IRQ %d\n", irq + i); } GIC_SET_ENABLED(irq + i, cm); /* If a raised level triggered IRQ enabled then mark is as pending. */ if (GIC_TEST_LEVEL(irq + i, mask) && !GIC_TEST_EDGE_TRIGGER(irq + i)) { DPRINTF("Set %d pending mask %x\n", irq + i, mask); GIC_SET_PENDING(irq + i, mask); } } } } else if (offset < 0x200) { /* Interrupt Clear Enable. */ irq = (offset - 0x180) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK; if (GIC_TEST_ENABLED(irq + i, cm)) { DPRINTF("Disabled IRQ %d\n", irq + i); } GIC_CLEAR_ENABLED(irq + i, cm); } } } else if (offset < 0x280) { /* Interrupt Set Pending. */ irq = (offset - 0x200) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { GIC_SET_PENDING(irq + i, GIC_TARGET(irq + i)); } } } else if (offset < 0x300) { /* Interrupt Clear Pending. */ irq = (offset - 0x280) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0; } for (i = 0; i < 8; i++) { /* ??? This currently clears the pending bit for all CPUs, even for per-CPU interrupts. It's unclear whether this is the corect behavior. */ if (value & (1 << i)) { GIC_CLEAR_PENDING(irq + i, ALL_CPU_MASK); } } } else if (offset < 0x400) { /* Interrupt Active. */ goto bad_reg; } else if (offset < 0x800) { /* Interrupt Priority. */ irq = (offset - 0x400) + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; gic_set_priority(s, cpu, irq, value); } else if (offset < 0xc00) { /* Interrupt CPU Target. RAZ/WI on uniprocessor GICs, with the * annoying exception of the 11MPCore's GIC. */ if (s->num_cpu != 1 || s->revision == REV_11MPCORE) { irq = (offset - 0x800) + GIC_BASE_IRQ; if (irq >= s->num_irq) { goto bad_reg; } if (irq < 29) { value = 0; } else if (irq < GIC_INTERNAL) { value = ALL_CPU_MASK; } s->irq_target[irq] = value & ALL_CPU_MASK; } } else if (offset < 0xf00) { /* Interrupt Configuration. */ irq = (offset - 0xc00) * 4 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) value |= 0xaa; for (i = 0; i < 4; i++) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { if (value & (1 << (i * 2))) { GIC_SET_MODEL(irq + i); } else { GIC_CLEAR_MODEL(irq + i); } } if (value & (2 << (i * 2))) { GIC_SET_EDGE_TRIGGER(irq + i); } else { GIC_CLEAR_EDGE_TRIGGER(irq + i); } } } else if (offset < 0xf10) { /* 0xf00 is only handled for 32-bit writes. */ goto bad_reg; } else if (offset < 0xf20) { /* GICD_CPENDSGIRn */ if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { goto bad_reg; } irq = (offset - 0xf10); s->sgi_pending[irq][cpu] &= ~value; if (s->sgi_pending[irq][cpu] == 0) { GIC_CLEAR_PENDING(irq, 1 << cpu); } } else if (offset < 0xf30) { /* GICD_SPENDSGIRn */ if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { goto bad_reg; } irq = (offset - 0xf20); GIC_SET_PENDING(irq, 1 << cpu); s->sgi_pending[irq][cpu] |= value; } else { goto bad_reg; } gic_update(s); return; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "gic_dist_writeb: Bad offset %x\n", (int)offset); }
false
qemu
c27a5ba94874cb3a29e21b3ad4bd5e504aea93b2
static void gic_dist_writeb(void *opaque, hwaddr offset, uint32_t value, MemTxAttrs attrs) { GICState *s = (GICState *)opaque; int irq; int i; int cpu; cpu = gic_get_current_cpu(s); if (offset < 0x100) { if (offset == 0) { s->enabled = (value & 1); DPRINTF("Distribution %sabled\n", s->enabled ? "En" : "Dis"); } else if (offset < 4) { } else if (offset >= 0x80) { } else { goto bad_reg; } } else if (offset < 0x180) { irq = (offset - 0x100) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0xff; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { int mask = (irq < GIC_INTERNAL) ? (1 << cpu) : GIC_TARGET(irq + i); int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK; if (!GIC_TEST_ENABLED(irq + i, cm)) { DPRINTF("Enabled IRQ %d\n", irq + i); } GIC_SET_ENABLED(irq + i, cm); if (GIC_TEST_LEVEL(irq + i, mask) && !GIC_TEST_EDGE_TRIGGER(irq + i)) { DPRINTF("Set %d pending mask %x\n", irq + i, mask); GIC_SET_PENDING(irq + i, mask); } } } } else if (offset < 0x200) { irq = (offset - 0x180) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK; if (GIC_TEST_ENABLED(irq + i, cm)) { DPRINTF("Disabled IRQ %d\n", irq + i); } GIC_CLEAR_ENABLED(irq + i, cm); } } } else if (offset < 0x280) { irq = (offset - 0x200) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { GIC_SET_PENDING(irq + i, GIC_TARGET(irq + i)); } } } else if (offset < 0x300) { irq = (offset - 0x280) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) { value = 0; } for (i = 0; i < 8; i++) { if (value & (1 << i)) { GIC_CLEAR_PENDING(irq + i, ALL_CPU_MASK); } } } else if (offset < 0x400) { goto bad_reg; } else if (offset < 0x800) { irq = (offset - 0x400) + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; gic_set_priority(s, cpu, irq, value); } else if (offset < 0xc00) { if (s->num_cpu != 1 || s->revision == REV_11MPCORE) { irq = (offset - 0x800) + GIC_BASE_IRQ; if (irq >= s->num_irq) { goto bad_reg; } if (irq < 29) { value = 0; } else if (irq < GIC_INTERNAL) { value = ALL_CPU_MASK; } s->irq_target[irq] = value & ALL_CPU_MASK; } } else if (offset < 0xf00) { irq = (offset - 0xc00) * 4 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; if (irq < GIC_NR_SGIS) value |= 0xaa; for (i = 0; i < 4; i++) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { if (value & (1 << (i * 2))) { GIC_SET_MODEL(irq + i); } else { GIC_CLEAR_MODEL(irq + i); } } if (value & (2 << (i * 2))) { GIC_SET_EDGE_TRIGGER(irq + i); } else { GIC_CLEAR_EDGE_TRIGGER(irq + i); } } } else if (offset < 0xf10) { goto bad_reg; } else if (offset < 0xf20) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { goto bad_reg; } irq = (offset - 0xf10); s->sgi_pending[irq][cpu] &= ~value; if (s->sgi_pending[irq][cpu] == 0) { GIC_CLEAR_PENDING(irq, 1 << cpu); } } else if (offset < 0xf30) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { goto bad_reg; } irq = (offset - 0xf20); GIC_SET_PENDING(irq, 1 << cpu); s->sgi_pending[irq][cpu] |= value; } else { goto bad_reg; } gic_update(s); return; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "gic_dist_writeb: Bad offset %x\n", (int)offset); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint32_t VAR_2, MemTxAttrs VAR_3) { GICState *s = (GICState *)VAR_0; int VAR_4; int VAR_5; int VAR_6; VAR_6 = gic_get_current_cpu(s); if (VAR_1 < 0x100) { if (VAR_1 == 0) { s->enabled = (VAR_2 & 1); DPRINTF("Distribution %sabled\n", s->enabled ? "En" : "Dis"); } else if (VAR_1 < 4) { } else if (VAR_1 >= 0x80) { } else { goto bad_reg; } } else if (VAR_1 < 0x180) { VAR_4 = (VAR_1 - 0x100) * 8 + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) goto bad_reg; if (VAR_4 < GIC_NR_SGIS) { VAR_2 = 0xff; } for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { if (VAR_2 & (1 << VAR_5)) { int VAR_7 = (VAR_4 < GIC_INTERNAL) ? (1 << VAR_6) : GIC_TARGET(VAR_4 + VAR_5); int VAR_9 = (VAR_4 < GIC_INTERNAL) ? (1 << VAR_6) : ALL_CPU_MASK; if (!GIC_TEST_ENABLED(VAR_4 + VAR_5, VAR_9)) { DPRINTF("Enabled IRQ %d\n", VAR_4 + VAR_5); } GIC_SET_ENABLED(VAR_4 + VAR_5, VAR_9); if (GIC_TEST_LEVEL(VAR_4 + VAR_5, VAR_7) && !GIC_TEST_EDGE_TRIGGER(VAR_4 + VAR_5)) { DPRINTF("Set %d pending VAR_7 %x\n", VAR_4 + VAR_5, VAR_7); GIC_SET_PENDING(VAR_4 + VAR_5, VAR_7); } } } } else if (VAR_1 < 0x200) { VAR_4 = (VAR_1 - 0x180) * 8 + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) goto bad_reg; if (VAR_4 < GIC_NR_SGIS) { VAR_2 = 0; } for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { if (VAR_2 & (1 << VAR_5)) { int VAR_9 = (VAR_4 < GIC_INTERNAL) ? (1 << VAR_6) : ALL_CPU_MASK; if (GIC_TEST_ENABLED(VAR_4 + VAR_5, VAR_9)) { DPRINTF("Disabled IRQ %d\n", VAR_4 + VAR_5); } GIC_CLEAR_ENABLED(VAR_4 + VAR_5, VAR_9); } } } else if (VAR_1 < 0x280) { VAR_4 = (VAR_1 - 0x200) * 8 + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) goto bad_reg; if (VAR_4 < GIC_NR_SGIS) { VAR_2 = 0; } for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { if (VAR_2 & (1 << VAR_5)) { GIC_SET_PENDING(VAR_4 + VAR_5, GIC_TARGET(VAR_4 + VAR_5)); } } } else if (VAR_1 < 0x300) { VAR_4 = (VAR_1 - 0x280) * 8 + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) goto bad_reg; if (VAR_4 < GIC_NR_SGIS) { VAR_2 = 0; } for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { if (VAR_2 & (1 << VAR_5)) { GIC_CLEAR_PENDING(VAR_4 + VAR_5, ALL_CPU_MASK); } } } else if (VAR_1 < 0x400) { goto bad_reg; } else if (VAR_1 < 0x800) { VAR_4 = (VAR_1 - 0x400) + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) goto bad_reg; gic_set_priority(s, VAR_6, VAR_4, VAR_2); } else if (VAR_1 < 0xc00) { if (s->num_cpu != 1 || s->revision == REV_11MPCORE) { VAR_4 = (VAR_1 - 0x800) + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) { goto bad_reg; } if (VAR_4 < 29) { VAR_2 = 0; } else if (VAR_4 < GIC_INTERNAL) { VAR_2 = ALL_CPU_MASK; } s->irq_target[VAR_4] = VAR_2 & ALL_CPU_MASK; } } else if (VAR_1 < 0xf00) { VAR_4 = (VAR_1 - 0xc00) * 4 + GIC_BASE_IRQ; if (VAR_4 >= s->num_irq) goto bad_reg; if (VAR_4 < GIC_NR_SGIS) VAR_2 |= 0xaa; for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { if (VAR_2 & (1 << (VAR_5 * 2))) { GIC_SET_MODEL(VAR_4 + VAR_5); } else { GIC_CLEAR_MODEL(VAR_4 + VAR_5); } } if (VAR_2 & (2 << (VAR_5 * 2))) { GIC_SET_EDGE_TRIGGER(VAR_4 + VAR_5); } else { GIC_CLEAR_EDGE_TRIGGER(VAR_4 + VAR_5); } } } else if (VAR_1 < 0xf10) { goto bad_reg; } else if (VAR_1 < 0xf20) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { goto bad_reg; } VAR_4 = (VAR_1 - 0xf10); s->sgi_pending[VAR_4][VAR_6] &= ~VAR_2; if (s->sgi_pending[VAR_4][VAR_6] == 0) { GIC_CLEAR_PENDING(VAR_4, 1 << VAR_6); } } else if (VAR_1 < 0xf30) { if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { goto bad_reg; } VAR_4 = (VAR_1 - 0xf20); GIC_SET_PENDING(VAR_4, 1 << VAR_6); s->sgi_pending[VAR_4][VAR_6] |= VAR_2; } else { goto bad_reg; } gic_update(s); return; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "FUNC_0: Bad VAR_1 %x\n", (int)VAR_1); }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint32_t VAR_2, MemTxAttrs VAR_3)\n{", "GICState *s = (GICState *)VAR_0;", "int VAR_4;", "int VAR_5;", "int VAR_6;", "VAR_6 = gic_get_current_cpu(s);", "if (VAR_1 < 0x100) {", "if (VAR_1 == 0) {", "s->enabled = (VAR_2 & 1);", "DPRINTF(\"Distribution %sabled\\n\", s->enabled ? \"En\" : \"Dis\");", "} else if (VAR_1 < 4) {", "} else if (VAR_1 >= 0x80) {", "} else {", "goto bad_reg;", "}", "} else if (VAR_1 < 0x180) {", "VAR_4 = (VAR_1 - 0x100) * 8 + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq)\ngoto bad_reg;", "if (VAR_4 < GIC_NR_SGIS) {", "VAR_2 = 0xff;", "}", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "if (VAR_2 & (1 << VAR_5)) {", "int VAR_7 =\n(VAR_4 < GIC_INTERNAL) ? (1 << VAR_6) : GIC_TARGET(VAR_4 + VAR_5);", "int VAR_9 = (VAR_4 < GIC_INTERNAL) ? (1 << VAR_6) : ALL_CPU_MASK;", "if (!GIC_TEST_ENABLED(VAR_4 + VAR_5, VAR_9)) {", "DPRINTF(\"Enabled IRQ %d\\n\", VAR_4 + VAR_5);", "}", "GIC_SET_ENABLED(VAR_4 + VAR_5, VAR_9);", "if (GIC_TEST_LEVEL(VAR_4 + VAR_5, VAR_7)\n&& !GIC_TEST_EDGE_TRIGGER(VAR_4 + VAR_5)) {", "DPRINTF(\"Set %d pending VAR_7 %x\\n\", VAR_4 + VAR_5, VAR_7);", "GIC_SET_PENDING(VAR_4 + VAR_5, VAR_7);", "}", "}", "}", "} else if (VAR_1 < 0x200) {", "VAR_4 = (VAR_1 - 0x180) * 8 + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq)\ngoto bad_reg;", "if (VAR_4 < GIC_NR_SGIS) {", "VAR_2 = 0;", "}", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "if (VAR_2 & (1 << VAR_5)) {", "int VAR_9 = (VAR_4 < GIC_INTERNAL) ? (1 << VAR_6) : ALL_CPU_MASK;", "if (GIC_TEST_ENABLED(VAR_4 + VAR_5, VAR_9)) {", "DPRINTF(\"Disabled IRQ %d\\n\", VAR_4 + VAR_5);", "}", "GIC_CLEAR_ENABLED(VAR_4 + VAR_5, VAR_9);", "}", "}", "} else if (VAR_1 < 0x280) {", "VAR_4 = (VAR_1 - 0x200) * 8 + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq)\ngoto bad_reg;", "if (VAR_4 < GIC_NR_SGIS) {", "VAR_2 = 0;", "}", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "if (VAR_2 & (1 << VAR_5)) {", "GIC_SET_PENDING(VAR_4 + VAR_5, GIC_TARGET(VAR_4 + VAR_5));", "}", "}", "} else if (VAR_1 < 0x300) {", "VAR_4 = (VAR_1 - 0x280) * 8 + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq)\ngoto bad_reg;", "if (VAR_4 < GIC_NR_SGIS) {", "VAR_2 = 0;", "}", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "if (VAR_2 & (1 << VAR_5)) {", "GIC_CLEAR_PENDING(VAR_4 + VAR_5, ALL_CPU_MASK);", "}", "}", "} else if (VAR_1 < 0x400) {", "goto bad_reg;", "} else if (VAR_1 < 0x800) {", "VAR_4 = (VAR_1 - 0x400) + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq)\ngoto bad_reg;", "gic_set_priority(s, VAR_6, VAR_4, VAR_2);", "} else if (VAR_1 < 0xc00) {", "if (s->num_cpu != 1 || s->revision == REV_11MPCORE) {", "VAR_4 = (VAR_1 - 0x800) + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq) {", "goto bad_reg;", "}", "if (VAR_4 < 29) {", "VAR_2 = 0;", "} else if (VAR_4 < GIC_INTERNAL) {", "VAR_2 = ALL_CPU_MASK;", "}", "s->irq_target[VAR_4] = VAR_2 & ALL_CPU_MASK;", "}", "} else if (VAR_1 < 0xf00) {", "VAR_4 = (VAR_1 - 0xc00) * 4 + GIC_BASE_IRQ;", "if (VAR_4 >= s->num_irq)\ngoto bad_reg;", "if (VAR_4 < GIC_NR_SGIS)\nVAR_2 |= 0xaa;", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {", "if (VAR_2 & (1 << (VAR_5 * 2))) {", "GIC_SET_MODEL(VAR_4 + VAR_5);", "} else {", "GIC_CLEAR_MODEL(VAR_4 + VAR_5);", "}", "}", "if (VAR_2 & (2 << (VAR_5 * 2))) {", "GIC_SET_EDGE_TRIGGER(VAR_4 + VAR_5);", "} else {", "GIC_CLEAR_EDGE_TRIGGER(VAR_4 + VAR_5);", "}", "}", "} else if (VAR_1 < 0xf10) {", "goto bad_reg;", "} else if (VAR_1 < 0xf20) {", "if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {", "goto bad_reg;", "}", "VAR_4 = (VAR_1 - 0xf10);", "s->sgi_pending[VAR_4][VAR_6] &= ~VAR_2;", "if (s->sgi_pending[VAR_4][VAR_6] == 0) {", "GIC_CLEAR_PENDING(VAR_4, 1 << VAR_6);", "}", "} else if (VAR_1 < 0xf30) {", "if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {", "goto bad_reg;", "}", "VAR_4 = (VAR_1 - 0xf20);", "GIC_SET_PENDING(VAR_4, 1 << VAR_6);", "s->sgi_pending[VAR_4][VAR_6] |= VAR_2;", "} else {", "goto bad_reg;", "}", "gic_update(s);", "return;", "bad_reg:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"FUNC_0: Bad VAR_1 %x\\n\", (int)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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 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 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347, 349 ], [ 351 ] ]
4,135
static int colo_packet_compare(Packet *ppkt, Packet *spkt) { trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src), inet_ntoa(ppkt->ip->ip_dst), spkt->size, inet_ntoa(spkt->ip->ip_src), inet_ntoa(spkt->ip->ip_dst)); if (ppkt->size == spkt->size) { return memcmp(ppkt->data, spkt->data, spkt->size); } else { return -1; } }
false
qemu
2ad7ca4c81733cba5c5c464078a643aba61044f8
static int colo_packet_compare(Packet *ppkt, Packet *spkt) { trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src), inet_ntoa(ppkt->ip->ip_dst), spkt->size, inet_ntoa(spkt->ip->ip_src), inet_ntoa(spkt->ip->ip_dst)); if (ppkt->size == spkt->size) { return memcmp(ppkt->data, spkt->data, spkt->size); } else { return -1; } }
{ "code": [], "line_no": [] }
static int FUNC_0(Packet *VAR_0, Packet *VAR_1) { trace_colo_compare_ip_info(VAR_0->size, inet_ntoa(VAR_0->ip->ip_src), inet_ntoa(VAR_0->ip->ip_dst), VAR_1->size, inet_ntoa(VAR_1->ip->ip_src), inet_ntoa(VAR_1->ip->ip_dst)); if (VAR_0->size == VAR_1->size) { return memcmp(VAR_0->data, VAR_1->data, VAR_1->size); } else { return -1; } }
[ "static int FUNC_0(Packet *VAR_0, Packet *VAR_1)\n{", "trace_colo_compare_ip_info(VAR_0->size, inet_ntoa(VAR_0->ip->ip_src),\ninet_ntoa(VAR_0->ip->ip_dst), VAR_1->size,\ninet_ntoa(VAR_1->ip->ip_src),\ninet_ntoa(VAR_1->ip->ip_dst));", "if (VAR_0->size == VAR_1->size) {", "return memcmp(VAR_0->data, VAR_1->data, VAR_1->size);", "} else {", "return -1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
4,136
BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { Coroutine *co; BlockAIOCBCoroutine *acb; trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; acb->req.sector = sector_num; acb->req.nb_sectors = nb_sectors; co = qemu_coroutine_create(bdrv_aio_discard_co_entry); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { Coroutine *co; BlockAIOCBCoroutine *acb; trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; acb->req.sector = sector_num; acb->req.nb_sectors = nb_sectors; co = qemu_coroutine_create(bdrv_aio_discard_co_entry); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
{ "code": [], "line_no": [] }
BlockAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { Coroutine *co; BlockAIOCBCoroutine *acb; trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; acb->req.sector = sector_num; acb->req.nb_sectors = nb_sectors; co = qemu_coroutine_create(bdrv_aio_discard_co_entry); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
[ "BlockAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors,\nBlockCompletionFunc *cb, void *opaque)\n{", "Coroutine *co;", "BlockAIOCBCoroutine *acb;", "trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);", "acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);", "acb->need_bh = true;", "acb->req.error = -EINPROGRESS;", "acb->req.sector = sector_num;", "acb->req.nb_sectors = nb_sectors;", "co = qemu_coroutine_create(bdrv_aio_discard_co_entry);", "qemu_coroutine_enter(co, acb);", "bdrv_co_maybe_schedule_bh(acb);", "return &acb->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ] ]
4,138
static void bdrv_drain_poll(BlockDriverState *bs) { while (bdrv_requests_pending(bs)) { /* Keep iterating */ aio_poll(bdrv_get_aio_context(bs), true); } }
false
qemu
d42cf28837801cd1f835089fe9db2a42a1af55cd
static void bdrv_drain_poll(BlockDriverState *bs) { while (bdrv_requests_pending(bs)) { aio_poll(bdrv_get_aio_context(bs), true); } }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0) { while (bdrv_requests_pending(VAR_0)) { aio_poll(bdrv_get_aio_context(VAR_0), true); } }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "while (bdrv_requests_pending(VAR_0)) {", "aio_poll(bdrv_get_aio_context(VAR_0), true);", "}", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
4,139
static void quorum_aio_cb(void *opaque, int ret) { QuorumChildRequest *sacb = opaque; QuorumAIOCB *acb = sacb->parent; BDRVQuorumState *s = acb->common.bs->opaque; sacb->ret = ret; acb->count++; if (ret == 0) { acb->success_count++; } else { quorum_report_bad(acb, sacb->aiocb->bs->node_name, ret); } assert(acb->count <= s->num_children); assert(acb->success_count <= s->num_children); if (acb->count < s->num_children) { return; } /* Do the vote on read */ if (acb->is_read) { quorum_vote(acb); } else { quorum_has_too_much_io_failed(acb); } quorum_aio_finalize(acb); }
true
qemu
cf29a570a7aa7abab66bf256fdf9540873590811
static void quorum_aio_cb(void *opaque, int ret) { QuorumChildRequest *sacb = opaque; QuorumAIOCB *acb = sacb->parent; BDRVQuorumState *s = acb->common.bs->opaque; sacb->ret = ret; acb->count++; if (ret == 0) { acb->success_count++; } else { quorum_report_bad(acb, sacb->aiocb->bs->node_name, ret); } assert(acb->count <= s->num_children); assert(acb->success_count <= s->num_children); if (acb->count < s->num_children) { return; } if (acb->is_read) { quorum_vote(acb); } else { quorum_has_too_much_io_failed(acb); } quorum_aio_finalize(acb); }
{ "code": [ " quorum_vote(acb);", " quorum_aio_finalize(acb);" ], "line_no": [ 43, 53 ] }
static void FUNC_0(void *VAR_0, int VAR_1) { QuorumChildRequest *sacb = VAR_0; QuorumAIOCB *acb = sacb->parent; BDRVQuorumState *s = acb->common.bs->VAR_0; sacb->VAR_1 = VAR_1; acb->count++; if (VAR_1 == 0) { acb->success_count++; } else { quorum_report_bad(acb, sacb->aiocb->bs->node_name, VAR_1); } assert(acb->count <= s->num_children); assert(acb->success_count <= s->num_children); if (acb->count < s->num_children) { return; } if (acb->is_read) { quorum_vote(acb); } else { quorum_has_too_much_io_failed(acb); } quorum_aio_finalize(acb); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "QuorumChildRequest *sacb = VAR_0;", "QuorumAIOCB *acb = sacb->parent;", "BDRVQuorumState *s = acb->common.bs->VAR_0;", "sacb->VAR_1 = VAR_1;", "acb->count++;", "if (VAR_1 == 0) {", "acb->success_count++;", "} else {", "quorum_report_bad(acb, sacb->aiocb->bs->node_name, VAR_1);", "}", "assert(acb->count <= s->num_children);", "assert(acb->success_count <= s->num_children);", "if (acb->count < s->num_children) {", "return;", "}", "if (acb->is_read) {", "quorum_vote(acb);", "} else {", "quorum_has_too_much_io_failed(acb);", "}", "quorum_aio_finalize(acb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
4,140
static const uint8_t *pcx_rle_decode(const uint8_t *src, const uint8_t *end, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int i = 0; unsigned char run, value; if (compressed) { while (i < bytes_per_scanline && src < end) { run = 1; value = *src++; if (value >= 0xc0 && src < end) { run = value & 0x3f; value = *src++; } while (i < bytes_per_scanline && run--) dst[i++] = value; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
true
FFmpeg
09b23786b3986502ee88d4907356979127169bdd
static const uint8_t *pcx_rle_decode(const uint8_t *src, const uint8_t *end, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int i = 0; unsigned char run, value; if (compressed) { while (i < bytes_per_scanline && src < end) { run = 1; value = *src++; if (value >= 0xc0 && src < end) { run = value & 0x3f; value = *src++; } while (i < bytes_per_scanline && run--) dst[i++] = value; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
{ "code": [ "static const uint8_t *pcx_rle_decode(const uint8_t *src,", " const uint8_t *end,", " uint8_t *dst,", " unsigned int bytes_per_scanline,", " int compressed)", " while (i < bytes_per_scanline && src < end) {", " value = *src++;", " if (value >= 0xc0 && src < end) {", " value = *src++;", " memcpy(dst, src, bytes_per_scanline);", " src += bytes_per_scanline;", " return src;" ], "line_no": [ 1, 3, 5, 7, 9, 21, 25, 27, 31, 43, 45, 51 ] }
static const uint8_t *FUNC_0(const uint8_t *src, const uint8_t *end, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int VAR_0 = 0; unsigned char VAR_1, VAR_2; if (compressed) { while (VAR_0 < bytes_per_scanline && src < end) { VAR_1 = 1; VAR_2 = *src++; if (VAR_2 >= 0xc0 && src < end) { VAR_1 = VAR_2 & 0x3f; VAR_2 = *src++; } while (VAR_0 < bytes_per_scanline && VAR_1--) dst[VAR_0++] = VAR_2; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
[ "static const uint8_t *FUNC_0(const uint8_t *src,\nconst uint8_t *end,\nuint8_t *dst,\nunsigned int bytes_per_scanline,\nint compressed)\n{", "unsigned int VAR_0 = 0;", "unsigned char VAR_1, VAR_2;", "if (compressed) {", "while (VAR_0 < bytes_per_scanline && src < end) {", "VAR_1 = 1;", "VAR_2 = *src++;", "if (VAR_2 >= 0xc0 && src < end) {", "VAR_1 = VAR_2 & 0x3f;", "VAR_2 = *src++;", "}", "while (VAR_0 < bytes_per_scanline && VAR_1--)\ndst[VAR_0++] = VAR_2;", "}", "} else {", "memcpy(dst, src, bytes_per_scanline);", "src += bytes_per_scanline;", "}", "return src;", "}" ]
[ 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
4,142
void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp) { int64_t value; if (!error_is_set(errp)) { if (v->type_int16) { v->type_int16(v, obj, name, errp); } else { value = *obj; v->type_int(v, &value, name, errp); if (value < INT16_MIN || value > INT16_MAX) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "int16_t"); return; } *obj = value; } } }
true
qemu
297a3646c2947ee64a6d42ca264039732c6218e0
void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp) { int64_t value; if (!error_is_set(errp)) { if (v->type_int16) { v->type_int16(v, obj, name, errp); } else { value = *obj; v->type_int(v, &value, name, errp); if (value < INT16_MIN || value > INT16_MAX) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "int16_t"); return; } *obj = value; } } }
{ "code": [ " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : \"null\",", " *obj = value;", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : \"null\",", " *obj = value;", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : \"null\",", " *obj = value;", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " *obj = value;", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : \"null\",", " *obj = value;", " if (!error_is_set(errp)) {", " if (v->type_int16) {", " v->type_int16(v, obj, name, errp);", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " if (value < INT16_MIN || value > INT16_MAX) {", " error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : \"null\",", " \"int16_t\");", " *obj = value;", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : \"null\",", " *obj = value;", " if (!error_is_set(errp)) {", " } else {", " if (!error_is_set(errp)) {", " } else {", " value = *obj;", " v->type_int(v, &value, name, errp);", " *obj = value;", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {", " if (!error_is_set(errp)) {" ], "line_no": [ 7, 7, 7, 7, 7, 7, 13, 15, 17, 21, 29, 7, 13, 15, 17, 21, 29, 7, 13, 15, 17, 21, 29, 7, 13, 15, 17, 29, 7, 13, 15, 17, 21, 29, 7, 9, 11, 13, 15, 17, 19, 21, 23, 29, 7, 13, 15, 17, 21, 29, 7, 13, 7, 13, 15, 17, 29, 7, 7, 7, 7, 7, 7, 7 ] }
void FUNC_0(Visitor *VAR_0, int16_t *VAR_1, const char *VAR_2, Error **VAR_3) { int64_t value; if (!error_is_set(VAR_3)) { if (VAR_0->type_int16) { VAR_0->type_int16(VAR_0, VAR_1, VAR_2, VAR_3); } else { value = *VAR_1; VAR_0->type_int(VAR_0, &value, VAR_2, VAR_3); if (value < INT16_MIN || value > INT16_MAX) { error_set(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_2 ? VAR_2 : "null", "int16_t"); return; } *VAR_1 = value; } } }
[ "void FUNC_0(Visitor *VAR_0, int16_t *VAR_1, const char *VAR_2, Error **VAR_3)\n{", "int64_t value;", "if (!error_is_set(VAR_3)) {", "if (VAR_0->type_int16) {", "VAR_0->type_int16(VAR_0, VAR_1, VAR_2, VAR_3);", "} else {", "value = *VAR_1;", "VAR_0->type_int(VAR_0, &value, VAR_2, VAR_3);", "if (value < INT16_MIN || value > INT16_MAX) {", "error_set(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_2 ? VAR_2 : \"null\",\n\"int16_t\");", "return;", "}", "*VAR_1 = value;", "}", "}", "}" ]
[ 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
4,143
static void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename) { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { Error *err = NULL; if (strcmp(typename, prop->driver) != 0) { continue; } prop->used = true; object_property_parse(OBJECT(dev), prop->value, prop->property, &err); if (err != NULL) { assert(prop->user_provided); error_reportf_err(err, "Warning: global %s.%s=%s ignored: ", prop->driver, prop->property, prop->value); return; } } }
true
qemu
f9a8b5530d438f836f9697639814f585aaec554d
static void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename) { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { Error *err = NULL; if (strcmp(typename, prop->driver) != 0) { continue; } prop->used = true; object_property_parse(OBJECT(dev), prop->value, prop->property, &err); if (err != NULL) { assert(prop->user_provided); error_reportf_err(err, "Warning: global %s.%s=%s ignored: ", prop->driver, prop->property, prop->value); return; } } }
{ "code": [ " GlobalProperty *prop;", " QTAILQ_FOREACH(prop, &global_props, next) {", " GlobalProperty *prop;", " QTAILQ_FOREACH(prop, &global_props, next) {" ], "line_no": [ 7, 11, 7, 11 ] }
static void FUNC_0(DeviceState *VAR_0, const char *VAR_1) { GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { Error *err = NULL; if (strcmp(VAR_1, prop->driver) != 0) { continue; } prop->used = true; object_property_parse(OBJECT(VAR_0), prop->value, prop->property, &err); if (err != NULL) { assert(prop->user_provided); error_reportf_err(err, "Warning: global %s.%s=%s ignored: ", prop->driver, prop->property, prop->value); return; } } }
[ "static void FUNC_0(DeviceState *VAR_0,\nconst char *VAR_1)\n{", "GlobalProperty *prop;", "QTAILQ_FOREACH(prop, &global_props, next) {", "Error *err = NULL;", "if (strcmp(VAR_1, prop->driver) != 0) {", "continue;", "}", "prop->used = true;", "object_property_parse(OBJECT(VAR_0), prop->value, prop->property, &err);", "if (err != NULL) {", "assert(prop->user_provided);", "error_reportf_err(err, \"Warning: global %s.%s=%s ignored: \",\nprop->driver, prop->property, prop->value);", "return;", "}", "}", "}" ]
[ 0, 1, 1, 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 ] ]
4,145
static unsigned char get_ref_idx(AVFrame *frame) { FrameDecodeData *fdd; NVDECFrame *cf; if (!frame || !frame->private_ref) return 255; fdd = (FrameDecodeData*)frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; return cf->idx; }
false
FFmpeg
5a0f6b099f3e8fcb95a80e3ffe52b3bf369efe24
static unsigned char get_ref_idx(AVFrame *frame) { FrameDecodeData *fdd; NVDECFrame *cf; if (!frame || !frame->private_ref) return 255; fdd = (FrameDecodeData*)frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; return cf->idx; }
{ "code": [], "line_no": [] }
static unsigned char FUNC_0(AVFrame *VAR_0) { FrameDecodeData *fdd; NVDECFrame *cf; if (!VAR_0 || !VAR_0->private_ref) return 255; fdd = (FrameDecodeData*)VAR_0->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; return cf->idx; }
[ "static unsigned char FUNC_0(AVFrame *VAR_0)\n{", "FrameDecodeData *fdd;", "NVDECFrame *cf;", "if (!VAR_0 || !VAR_0->private_ref)\nreturn 255;", "fdd = (FrameDecodeData*)VAR_0->private_ref->data;", "cf = (NVDECFrame*)fdd->hwaccel_priv;", "return cf->idx;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
4,146
static av_cold int dnxhd_encode_end(AVCodecContext *avctx) { DNXHDEncContext *ctx = avctx->priv_data; int max_level = 1 << (ctx->cid_table->bit_depth + 2); int i; av_free(ctx->vlc_codes - max_level * 2); av_free(ctx->vlc_bits - max_level * 2); av_freep(&ctx->run_codes); av_freep(&ctx->run_bits); av_freep(&ctx->mb_bits); av_freep(&ctx->mb_qscale); av_freep(&ctx->mb_rc); av_freep(&ctx->mb_cmp); av_freep(&ctx->slice_size); av_freep(&ctx->slice_offs); av_freep(&ctx->qmatrix_c); av_freep(&ctx->qmatrix_l); av_freep(&ctx->qmatrix_c16); av_freep(&ctx->qmatrix_l16); for (i = 1; i < avctx->thread_count; i++) av_freep(&ctx->thread[i]); av_frame_free(&avctx->coded_frame); return 0; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int dnxhd_encode_end(AVCodecContext *avctx) { DNXHDEncContext *ctx = avctx->priv_data; int max_level = 1 << (ctx->cid_table->bit_depth + 2); int i; av_free(ctx->vlc_codes - max_level * 2); av_free(ctx->vlc_bits - max_level * 2); av_freep(&ctx->run_codes); av_freep(&ctx->run_bits); av_freep(&ctx->mb_bits); av_freep(&ctx->mb_qscale); av_freep(&ctx->mb_rc); av_freep(&ctx->mb_cmp); av_freep(&ctx->slice_size); av_freep(&ctx->slice_offs); av_freep(&ctx->qmatrix_c); av_freep(&ctx->qmatrix_l); av_freep(&ctx->qmatrix_c16); av_freep(&ctx->qmatrix_l16); for (i = 1; i < avctx->thread_count; i++) av_freep(&ctx->thread[i]); av_frame_free(&avctx->coded_frame); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { DNXHDEncContext *ctx = avctx->priv_data; int VAR_0 = 1 << (ctx->cid_table->bit_depth + 2); int VAR_1; av_free(ctx->vlc_codes - VAR_0 * 2); av_free(ctx->vlc_bits - VAR_0 * 2); av_freep(&ctx->run_codes); av_freep(&ctx->run_bits); av_freep(&ctx->mb_bits); av_freep(&ctx->mb_qscale); av_freep(&ctx->mb_rc); av_freep(&ctx->mb_cmp); av_freep(&ctx->slice_size); av_freep(&ctx->slice_offs); av_freep(&ctx->qmatrix_c); av_freep(&ctx->qmatrix_l); av_freep(&ctx->qmatrix_c16); av_freep(&ctx->qmatrix_l16); for (VAR_1 = 1; VAR_1 < avctx->thread_count; VAR_1++) av_freep(&ctx->thread[VAR_1]); av_frame_free(&avctx->coded_frame); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "DNXHDEncContext *ctx = avctx->priv_data;", "int VAR_0 = 1 << (ctx->cid_table->bit_depth + 2);", "int VAR_1;", "av_free(ctx->vlc_codes - VAR_0 * 2);", "av_free(ctx->vlc_bits - VAR_0 * 2);", "av_freep(&ctx->run_codes);", "av_freep(&ctx->run_bits);", "av_freep(&ctx->mb_bits);", "av_freep(&ctx->mb_qscale);", "av_freep(&ctx->mb_rc);", "av_freep(&ctx->mb_cmp);", "av_freep(&ctx->slice_size);", "av_freep(&ctx->slice_offs);", "av_freep(&ctx->qmatrix_c);", "av_freep(&ctx->qmatrix_l);", "av_freep(&ctx->qmatrix_c16);", "av_freep(&ctx->qmatrix_l16);", "for (VAR_1 = 1; VAR_1 < avctx->thread_count; VAR_1++)", "av_freep(&ctx->thread[VAR_1]);", "av_frame_free(&avctx->coded_frame);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ] ]
4,147
static void *sigwait_compat(void *opaque) { struct sigfd_compat_info *info = opaque; int err; sigset_t all; sigfillset(&all); sigprocmask(SIG_BLOCK, &all, NULL); do { siginfo_t siginfo; err = sigwaitinfo(&info->mask, &siginfo); if (err == -1 && errno == EINTR) { err = 0; continue; } if (err > 0) { char buffer[128]; size_t offset = 0; memcpy(buffer, &err, sizeof(err)); while (offset < sizeof(buffer)) { ssize_t len; len = write(info->fd, buffer + offset, sizeof(buffer) - offset); if (len == -1 && errno == EINTR) continue; if (len <= 0) { err = -1; break; } offset += len; } } } while (err >= 0); return NULL; }
true
qemu
9e472e101f37233f4e32d181d2fee29014c1cf2f
static void *sigwait_compat(void *opaque) { struct sigfd_compat_info *info = opaque; int err; sigset_t all; sigfillset(&all); sigprocmask(SIG_BLOCK, &all, NULL); do { siginfo_t siginfo; err = sigwaitinfo(&info->mask, &siginfo); if (err == -1 && errno == EINTR) { err = 0; continue; } if (err > 0) { char buffer[128]; size_t offset = 0; memcpy(buffer, &err, sizeof(err)); while (offset < sizeof(buffer)) { ssize_t len; len = write(info->fd, buffer + offset, sizeof(buffer) - offset); if (len == -1 && errno == EINTR) continue; if (len <= 0) { err = -1; break; } offset += len; } } } while (err >= 0); return NULL; }
{ "code": [ "static void *sigwait_compat(void *opaque)", " struct sigfd_compat_info *info = opaque;", " int err;", " sigset_t all;", " sigfillset(&all);", " sigprocmask(SIG_BLOCK, &all, NULL);", " do {", " siginfo_t siginfo;", " err = sigwaitinfo(&info->mask, &siginfo);", " if (err == -1 && errno == EINTR) {", " err = 0;", " continue;", " if (err > 0) {", " char buffer[128];", " size_t offset = 0;", " memcpy(buffer, &err, sizeof(err));", " while (offset < sizeof(buffer)) {", " ssize_t len;", " len = write(info->fd, buffer + offset,", " sizeof(buffer) - offset);", " if (len == -1 && errno == EINTR)", " continue;", " if (len <= 0) {", " err = -1;", " break;", " offset += len;", " } while (err >= 0);", " return NULL;" ], "line_no": [ 1, 5, 7, 9, 13, 15, 19, 21, 25, 27, 29, 31, 37, 39, 41, 45, 47, 49, 53, 55, 57, 59, 63, 65, 67, 73, 79, 83 ] }
static void *FUNC_0(void *VAR_0) { struct sigfd_compat_info *VAR_1 = VAR_0; int VAR_2; sigset_t all; sigfillset(&all); sigprocmask(SIG_BLOCK, &all, NULL); do { siginfo_t siginfo; VAR_2 = sigwaitinfo(&VAR_1->mask, &siginfo); if (VAR_2 == -1 && errno == EINTR) { VAR_2 = 0; continue; } if (VAR_2 > 0) { char VAR_3[128]; size_t offset = 0; memcpy(VAR_3, &VAR_2, sizeof(VAR_2)); while (offset < sizeof(VAR_3)) { ssize_t len; len = write(VAR_1->fd, VAR_3 + offset, sizeof(VAR_3) - offset); if (len == -1 && errno == EINTR) continue; if (len <= 0) { VAR_2 = -1; break; } offset += len; } } } while (VAR_2 >= 0); return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "struct sigfd_compat_info *VAR_1 = VAR_0;", "int VAR_2;", "sigset_t all;", "sigfillset(&all);", "sigprocmask(SIG_BLOCK, &all, NULL);", "do {", "siginfo_t siginfo;", "VAR_2 = sigwaitinfo(&VAR_1->mask, &siginfo);", "if (VAR_2 == -1 && errno == EINTR) {", "VAR_2 = 0;", "continue;", "}", "if (VAR_2 > 0) {", "char VAR_3[128];", "size_t offset = 0;", "memcpy(VAR_3, &VAR_2, sizeof(VAR_2));", "while (offset < sizeof(VAR_3)) {", "ssize_t len;", "len = write(VAR_1->fd, VAR_3 + offset,\nsizeof(VAR_3) - offset);", "if (len == -1 && errno == EINTR)\ncontinue;", "if (len <= 0) {", "VAR_2 = -1;", "break;", "}", "offset += len;", "}", "}", "} while (VAR_2 >= 0);", "return NULL;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
4,148
static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; QVirtQueuePCI *vqpci = (QVirtQueuePCI *)vq; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(vqpci->msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, vqpci->msix_entry)) { /* No ISR checking should be done if masked, but read anyway */ return qpci_msix_pending(dev->pdev, vqpci->msix_entry); } else { data = readl(vqpci->msix_addr); writel(vqpci->msix_addr, 0); return data == vqpci->msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 1; } }
true
qemu
1e34cf9681ec549e26f30daaabc1ce58d60446f7
static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; QVirtQueuePCI *vqpci = (QVirtQueuePCI *)vq; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(vqpci->msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, vqpci->msix_entry)) { return qpci_msix_pending(dev->pdev, vqpci->msix_entry); } else { data = readl(vqpci->msix_addr); writel(vqpci->msix_addr, 0); return data == vqpci->msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 1; } }
{ "code": [ " writel(vqpci->msix_addr, 0);", " return data == vqpci->msix_data;" ], "line_no": [ 27, 29 ] }
static bool FUNC_0(QVirtioDevice *d, QVirtQueue *vq) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; QVirtQueuePCI *vqpci = (QVirtQueuePCI *)vq; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(vqpci->msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, vqpci->msix_entry)) { return qpci_msix_pending(dev->pdev, vqpci->msix_entry); } else { data = readl(vqpci->msix_addr); writel(vqpci->msix_addr, 0); return data == vqpci->msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 1; } }
[ "static bool FUNC_0(QVirtioDevice *d, QVirtQueue *vq)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "QVirtQueuePCI *vqpci = (QVirtQueuePCI *)vq;", "uint32_t data;", "if (dev->pdev->msix_enabled) {", "g_assert_cmpint(vqpci->msix_entry, !=, -1);", "if (qpci_msix_masked(dev->pdev, vqpci->msix_entry)) {", "return qpci_msix_pending(dev->pdev, vqpci->msix_entry);", "} else {", "data = readl(vqpci->msix_addr);", "writel(vqpci->msix_addr, 0);", "return data == vqpci->msix_data;", "}", "} else {", "return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
4,149
static void pxa2xx_pcmcia_realize(DeviceState *dev, Error **errp) { PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(dev); pcmcia_socket_register(&s->slot); }
true
qemu
7797a73947d5c0e63dd5552b348cf66c384b4555
static void pxa2xx_pcmcia_realize(DeviceState *dev, Error **errp) { PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(dev); pcmcia_socket_register(&s->slot); }
{ "code": [ "static void pxa2xx_pcmcia_realize(DeviceState *dev, Error **errp)", " PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(dev);", " pcmcia_socket_register(&s->slot);" ], "line_no": [ 1, 5, 9 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(VAR_0); pcmcia_socket_register(&s->slot); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(VAR_0);", "pcmcia_socket_register(&s->slot);", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
4,150
static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun, MegasasCmd *cmd) { struct mfi_ld_info *info = cmd->iov_buf; size_t dcmd_size = sizeof(struct mfi_ld_info); uint8_t cdb[6]; SCSIRequest *req; ssize_t len, resid; uint16_t sdev_id = ((sdev->id & 0xFF) << 8) | (lun & 0xFF); uint64_t ld_size; if (!cmd->iov_buf) { cmd->iov_buf = g_malloc0(dcmd_size); info = cmd->iov_buf; megasas_setup_inquiry(cdb, 0x83, sizeof(info->vpd_page83)); req = scsi_req_new(sdev, cmd->index, lun, cdb, cmd); if (!req) { trace_megasas_dcmd_req_alloc_failed(cmd->index, "LD get info vpd inquiry"); g_free(cmd->iov_buf); cmd->iov_buf = NULL; return MFI_STAT_FLASH_ALLOC_FAIL; } trace_megasas_dcmd_internal_submit(cmd->index, "LD get info vpd inquiry", lun); len = scsi_req_enqueue(req); if (len > 0) { cmd->iov_size = len; scsi_req_continue(req); } return MFI_STAT_INVALID_STATUS; } info->ld_config.params.state = MFI_LD_STATE_OPTIMAL; info->ld_config.properties.ld.v.target_id = lun; info->ld_config.params.stripe_size = 3; info->ld_config.params.num_drives = 1; info->ld_config.params.is_consistent = 1; /* Logical device size is in blocks */ blk_get_geometry(sdev->conf.blk, &ld_size); info->size = cpu_to_le64(ld_size); memset(info->ld_config.span, 0, sizeof(info->ld_config.span)); info->ld_config.span[0].start_block = 0; info->ld_config.span[0].num_blocks = info->size; info->ld_config.span[0].array_ref = cpu_to_le16(sdev_id); resid = dma_buf_read(cmd->iov_buf, dcmd_size, &cmd->qsg); g_free(cmd->iov_buf); cmd->iov_size = dcmd_size - resid; cmd->iov_buf = NULL; return MFI_STAT_OK; }
true
qemu
87e459a810d7b1ec1638085b5a80ea3d9b43119a
static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun, MegasasCmd *cmd) { struct mfi_ld_info *info = cmd->iov_buf; size_t dcmd_size = sizeof(struct mfi_ld_info); uint8_t cdb[6]; SCSIRequest *req; ssize_t len, resid; uint16_t sdev_id = ((sdev->id & 0xFF) << 8) | (lun & 0xFF); uint64_t ld_size; if (!cmd->iov_buf) { cmd->iov_buf = g_malloc0(dcmd_size); info = cmd->iov_buf; megasas_setup_inquiry(cdb, 0x83, sizeof(info->vpd_page83)); req = scsi_req_new(sdev, cmd->index, lun, cdb, cmd); if (!req) { trace_megasas_dcmd_req_alloc_failed(cmd->index, "LD get info vpd inquiry"); g_free(cmd->iov_buf); cmd->iov_buf = NULL; return MFI_STAT_FLASH_ALLOC_FAIL; } trace_megasas_dcmd_internal_submit(cmd->index, "LD get info vpd inquiry", lun); len = scsi_req_enqueue(req); if (len > 0) { cmd->iov_size = len; scsi_req_continue(req); } return MFI_STAT_INVALID_STATUS; } info->ld_config.params.state = MFI_LD_STATE_OPTIMAL; info->ld_config.properties.ld.v.target_id = lun; info->ld_config.params.stripe_size = 3; info->ld_config.params.num_drives = 1; info->ld_config.params.is_consistent = 1; blk_get_geometry(sdev->conf.blk, &ld_size); info->size = cpu_to_le64(ld_size); memset(info->ld_config.span, 0, sizeof(info->ld_config.span)); info->ld_config.span[0].start_block = 0; info->ld_config.span[0].num_blocks = info->size; info->ld_config.span[0].array_ref = cpu_to_le16(sdev_id); resid = dma_buf_read(cmd->iov_buf, dcmd_size, &cmd->qsg); g_free(cmd->iov_buf); cmd->iov_size = dcmd_size - resid; cmd->iov_buf = NULL; return MFI_STAT_OK; }
{ "code": [ " SCSIRequest *req;", " if (!req) {", " len = scsi_req_enqueue(req);", " scsi_req_continue(req);", " if (!req) {", " len = scsi_req_enqueue(req);", " scsi_req_continue(req);", " SCSIRequest *req;", " req = scsi_req_new(sdev, cmd->index, lun, cdb, cmd);", " if (!req) {", " len = scsi_req_enqueue(req);", " scsi_req_continue(req);" ], "line_no": [ 13, 33, 51, 57, 33, 51, 57, 13, 31, 33, 51, 57 ] }
static int FUNC_0(SCSIDevice *VAR_0, int VAR_1, MegasasCmd *VAR_2) { struct mfi_ld_info *VAR_3 = VAR_2->iov_buf; size_t dcmd_size = sizeof(struct mfi_ld_info); uint8_t cdb[6]; SCSIRequest *req; ssize_t len, resid; uint16_t sdev_id = ((VAR_0->id & 0xFF) << 8) | (VAR_1 & 0xFF); uint64_t ld_size; if (!VAR_2->iov_buf) { VAR_2->iov_buf = g_malloc0(dcmd_size); VAR_3 = VAR_2->iov_buf; megasas_setup_inquiry(cdb, 0x83, sizeof(VAR_3->vpd_page83)); req = scsi_req_new(VAR_0, VAR_2->index, VAR_1, cdb, VAR_2); if (!req) { trace_megasas_dcmd_req_alloc_failed(VAR_2->index, "LD get VAR_3 vpd inquiry"); g_free(VAR_2->iov_buf); VAR_2->iov_buf = NULL; return MFI_STAT_FLASH_ALLOC_FAIL; } trace_megasas_dcmd_internal_submit(VAR_2->index, "LD get VAR_3 vpd inquiry", VAR_1); len = scsi_req_enqueue(req); if (len > 0) { VAR_2->iov_size = len; scsi_req_continue(req); } return MFI_STAT_INVALID_STATUS; } VAR_3->ld_config.params.state = MFI_LD_STATE_OPTIMAL; VAR_3->ld_config.properties.ld.v.target_id = VAR_1; VAR_3->ld_config.params.stripe_size = 3; VAR_3->ld_config.params.num_drives = 1; VAR_3->ld_config.params.is_consistent = 1; blk_get_geometry(VAR_0->conf.blk, &ld_size); VAR_3->size = cpu_to_le64(ld_size); memset(VAR_3->ld_config.span, 0, sizeof(VAR_3->ld_config.span)); VAR_3->ld_config.span[0].start_block = 0; VAR_3->ld_config.span[0].num_blocks = VAR_3->size; VAR_3->ld_config.span[0].array_ref = cpu_to_le16(sdev_id); resid = dma_buf_read(VAR_2->iov_buf, dcmd_size, &VAR_2->qsg); g_free(VAR_2->iov_buf); VAR_2->iov_size = dcmd_size - resid; VAR_2->iov_buf = NULL; return MFI_STAT_OK; }
[ "static int FUNC_0(SCSIDevice *VAR_0, int VAR_1,\nMegasasCmd *VAR_2)\n{", "struct mfi_ld_info *VAR_3 = VAR_2->iov_buf;", "size_t dcmd_size = sizeof(struct mfi_ld_info);", "uint8_t cdb[6];", "SCSIRequest *req;", "ssize_t len, resid;", "uint16_t sdev_id = ((VAR_0->id & 0xFF) << 8) | (VAR_1 & 0xFF);", "uint64_t ld_size;", "if (!VAR_2->iov_buf) {", "VAR_2->iov_buf = g_malloc0(dcmd_size);", "VAR_3 = VAR_2->iov_buf;", "megasas_setup_inquiry(cdb, 0x83, sizeof(VAR_3->vpd_page83));", "req = scsi_req_new(VAR_0, VAR_2->index, VAR_1, cdb, VAR_2);", "if (!req) {", "trace_megasas_dcmd_req_alloc_failed(VAR_2->index,\n\"LD get VAR_3 vpd inquiry\");", "g_free(VAR_2->iov_buf);", "VAR_2->iov_buf = NULL;", "return MFI_STAT_FLASH_ALLOC_FAIL;", "}", "trace_megasas_dcmd_internal_submit(VAR_2->index,\n\"LD get VAR_3 vpd inquiry\", VAR_1);", "len = scsi_req_enqueue(req);", "if (len > 0) {", "VAR_2->iov_size = len;", "scsi_req_continue(req);", "}", "return MFI_STAT_INVALID_STATUS;", "}", "VAR_3->ld_config.params.state = MFI_LD_STATE_OPTIMAL;", "VAR_3->ld_config.properties.ld.v.target_id = VAR_1;", "VAR_3->ld_config.params.stripe_size = 3;", "VAR_3->ld_config.params.num_drives = 1;", "VAR_3->ld_config.params.is_consistent = 1;", "blk_get_geometry(VAR_0->conf.blk, &ld_size);", "VAR_3->size = cpu_to_le64(ld_size);", "memset(VAR_3->ld_config.span, 0, sizeof(VAR_3->ld_config.span));", "VAR_3->ld_config.span[0].start_block = 0;", "VAR_3->ld_config.span[0].num_blocks = VAR_3->size;", "VAR_3->ld_config.span[0].array_ref = cpu_to_le16(sdev_id);", "resid = dma_buf_read(VAR_2->iov_buf, dcmd_size, &VAR_2->qsg);", "g_free(VAR_2->iov_buf);", "VAR_2->iov_size = dcmd_size - resid;", "VAR_2->iov_buf = NULL;", "return MFI_STAT_OK;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 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 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ] ]
4,151
static void *migration_thread(void *opaque) { MigrationState *s = opaque; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t initial_bytes = 0; int64_t max_size = 0; int64_t start_time = initial_time; bool old_vm_running = false; DPRINTF("beginning savevm\n"); qemu_savevm_state_begin(s->file, &s->params); while (s->state == MIG_STATE_ACTIVE) { int64_t current_time; uint64_t pending_size; if (!qemu_file_rate_limit(s->file)) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { qemu_savevm_state_iterate(s->file); } else { int ret; DPRINTF("done iterating\n"); qemu_mutex_lock_iothread(); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); old_vm_running = runstate_is_running(); ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); if (ret >= 0) { qemu_file_set_rate_limit(s->file, INT_MAX); qemu_savevm_state_complete(s->file); } qemu_mutex_unlock_iothread(); if (ret < 0) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } if (!qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_COMPLETED); break; } } } if (qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes; uint64_t time_spent = current_time - initial_time; double bandwidth = transferred_bytes / time_spent; max_size = bandwidth * migrate_max_downtime() / 1000000; s->mbps = time_spent ? (((double) transferred_bytes * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0 : -1; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64 "\n", transferred_bytes, time_spent, bandwidth, max_size); /* if we haven't sent anything, we don't want to recalculate 10000 is a small enough number for our purposes */ if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / bandwidth; } qemu_file_reset_rate_limit(s->file); initial_time = current_time; initial_bytes = qemu_ftell(s->file); } if (qemu_file_rate_limit(s->file)) { /* usleep expects microseconds */ g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); } } qemu_mutex_lock_iothread(); if (s->state == MIG_STATE_COMPLETED) { int64_t end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; runstate_set(RUN_STATE_POSTMIGRATE); } else { if (old_vm_running) { vm_start(); } } qemu_bh_schedule(s->cleanup_bh); qemu_mutex_unlock_iothread(); return NULL; }
true
qemu
d58f574bf39796ed2396dfd1e308352fbb03f944
static void *migration_thread(void *opaque) { MigrationState *s = opaque; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t initial_bytes = 0; int64_t max_size = 0; int64_t start_time = initial_time; bool old_vm_running = false; DPRINTF("beginning savevm\n"); qemu_savevm_state_begin(s->file, &s->params); while (s->state == MIG_STATE_ACTIVE) { int64_t current_time; uint64_t pending_size; if (!qemu_file_rate_limit(s->file)) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { qemu_savevm_state_iterate(s->file); } else { int ret; DPRINTF("done iterating\n"); qemu_mutex_lock_iothread(); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); old_vm_running = runstate_is_running(); ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); if (ret >= 0) { qemu_file_set_rate_limit(s->file, INT_MAX); qemu_savevm_state_complete(s->file); } qemu_mutex_unlock_iothread(); if (ret < 0) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } if (!qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_COMPLETED); break; } } } if (qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes; uint64_t time_spent = current_time - initial_time; double bandwidth = transferred_bytes / time_spent; max_size = bandwidth * migrate_max_downtime() / 1000000; s->mbps = time_spent ? (((double) transferred_bytes * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0 : -1; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64 "\n", transferred_bytes, time_spent, bandwidth, max_size); if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / bandwidth; } qemu_file_reset_rate_limit(s->file); initial_time = current_time; initial_bytes = qemu_ftell(s->file); } if (qemu_file_rate_limit(s->file)) { g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); } } qemu_mutex_lock_iothread(); if (s->state == MIG_STATE_COMPLETED) { int64_t end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; runstate_set(RUN_STATE_POSTMIGRATE); } else { if (old_vm_running) { vm_start(); } } qemu_bh_schedule(s->cleanup_bh); qemu_mutex_unlock_iothread(); return NULL; }
{ "code": [ " migrate_finish_set_state(s, MIG_STATE_ERROR);", " migrate_finish_set_state(s, MIG_STATE_COMPLETED);", " migrate_finish_set_state(s, MIG_STATE_ERROR);" ], "line_no": [ 79, 89, 103 ] }
static void *FUNC_0(void *VAR_0) { MigrationState *s = VAR_0; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t initial_bytes = 0; int64_t max_size = 0; int64_t start_time = initial_time; bool old_vm_running = false; DPRINTF("beginning savevm\n"); qemu_savevm_state_begin(s->file, &s->params); while (s->state == MIG_STATE_ACTIVE) { int64_t current_time; uint64_t pending_size; if (!qemu_file_rate_limit(s->file)) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { qemu_savevm_state_iterate(s->file); } else { int VAR_1; DPRINTF("done iterating\n"); qemu_mutex_lock_iothread(); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); old_vm_running = runstate_is_running(); VAR_1 = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); if (VAR_1 >= 0) { qemu_file_set_rate_limit(s->file, INT_MAX); qemu_savevm_state_complete(s->file); } qemu_mutex_unlock_iothread(); if (VAR_1 < 0) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } if (!qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_COMPLETED); break; } } } if (qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes; uint64_t time_spent = current_time - initial_time; double VAR_2 = transferred_bytes / time_spent; max_size = VAR_2 * migrate_max_downtime() / 1000000; s->mbps = time_spent ? (((double) transferred_bytes * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0 : -1; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " VAR_2 %g max_size %" PRId64 "\n", transferred_bytes, time_spent, VAR_2, max_size); if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / VAR_2; } qemu_file_reset_rate_limit(s->file); initial_time = current_time; initial_bytes = qemu_ftell(s->file); } if (qemu_file_rate_limit(s->file)) { g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); } } qemu_mutex_lock_iothread(); if (s->state == MIG_STATE_COMPLETED) { int64_t end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; runstate_set(RUN_STATE_POSTMIGRATE); } else { if (old_vm_running) { vm_start(); } } qemu_bh_schedule(s->cleanup_bh); qemu_mutex_unlock_iothread(); return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "MigrationState *s = VAR_0;", "int64_t initial_time = qemu_get_clock_ms(rt_clock);", "int64_t initial_bytes = 0;", "int64_t max_size = 0;", "int64_t start_time = initial_time;", "bool old_vm_running = false;", "DPRINTF(\"beginning savevm\\n\");", "qemu_savevm_state_begin(s->file, &s->params);", "while (s->state == MIG_STATE_ACTIVE) {", "int64_t current_time;", "uint64_t pending_size;", "if (!qemu_file_rate_limit(s->file)) {", "DPRINTF(\"iterate\\n\");", "pending_size = qemu_savevm_state_pending(s->file, max_size);", "DPRINTF(\"pending size %lu max %lu\\n\", pending_size, max_size);", "if (pending_size && pending_size >= max_size) {", "qemu_savevm_state_iterate(s->file);", "} else {", "int VAR_1;", "DPRINTF(\"done iterating\\n\");", "qemu_mutex_lock_iothread();", "start_time = qemu_get_clock_ms(rt_clock);", "qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);", "old_vm_running = runstate_is_running();", "VAR_1 = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);", "if (VAR_1 >= 0) {", "qemu_file_set_rate_limit(s->file, INT_MAX);", "qemu_savevm_state_complete(s->file);", "}", "qemu_mutex_unlock_iothread();", "if (VAR_1 < 0) {", "migrate_finish_set_state(s, MIG_STATE_ERROR);", "break;", "}", "if (!qemu_file_get_error(s->file)) {", "migrate_finish_set_state(s, MIG_STATE_COMPLETED);", "break;", "}", "}", "}", "if (qemu_file_get_error(s->file)) {", "migrate_finish_set_state(s, MIG_STATE_ERROR);", "break;", "}", "current_time = qemu_get_clock_ms(rt_clock);", "if (current_time >= initial_time + BUFFER_DELAY) {", "uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes;", "uint64_t time_spent = current_time - initial_time;", "double VAR_2 = transferred_bytes / time_spent;", "max_size = VAR_2 * migrate_max_downtime() / 1000000;", "s->mbps = time_spent ? (((double) transferred_bytes * 8.0) /\n((double) time_spent / 1000.0)) / 1000.0 / 1000.0 : -1;", "DPRINTF(\"transferred %\" PRIu64 \" time_spent %\" PRIu64\n\" VAR_2 %g max_size %\" PRId64 \"\\n\",\ntransferred_bytes, time_spent, VAR_2, max_size);", "if (s->dirty_bytes_rate && transferred_bytes > 10000) {", "s->expected_downtime = s->dirty_bytes_rate / VAR_2;", "}", "qemu_file_reset_rate_limit(s->file);", "initial_time = current_time;", "initial_bytes = qemu_ftell(s->file);", "}", "if (qemu_file_rate_limit(s->file)) {", "g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);", "}", "}", "qemu_mutex_lock_iothread();", "if (s->state == MIG_STATE_COMPLETED) {", "int64_t end_time = qemu_get_clock_ms(rt_clock);", "s->total_time = end_time - s->total_time;", "s->downtime = end_time - start_time;", "runstate_set(RUN_STATE_POSTMIGRATE);", "} else {", "if (old_vm_running) {", "vm_start();", "}", "}", "qemu_bh_schedule(s->cleanup_bh);", "qemu_mutex_unlock_iothread();", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 129, 131, 133 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ] ]
4,152
static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx, RowContext *row, int n, int index_bits, int level_bias, int level_shift) { int i, j, index1, index2, len, flags; int level, component, sign; const int *scale; const uint8_t *weight_matrix; const uint8_t *ac_level = ctx->cid_table->ac_level; const uint8_t *ac_flags = ctx->cid_table->ac_flags; int16_t *block = row->blocks[n]; const int eob_index = ctx->cid_table->eob_index; OPEN_READER(bs, &row->gb); ctx->bdsp.clear_block(block); if (!ctx->is_444) { if (n & 2) { component = 1 + (n & 1); scale = row->chroma_scale; weight_matrix = ctx->cid_table->chroma_weight; } else { component = 0; scale = row->luma_scale; weight_matrix = ctx->cid_table->luma_weight; } } else { component = (n >> 1) % 3; if (component) { scale = row->chroma_scale; weight_matrix = ctx->cid_table->chroma_weight; } else { scale = row->luma_scale; weight_matrix = ctx->cid_table->luma_weight; } } UPDATE_CACHE(bs, &row->gb); GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1); if (len) { level = GET_CACHE(bs, &row->gb); LAST_SKIP_BITS(bs, &row->gb, len); sign = ~level >> 31; level = (NEG_USR32(sign ^ level, len) ^ sign) - sign; row->last_dc[component] += level; } block[0] = row->last_dc[component]; i = 0; UPDATE_CACHE(bs, &row->gb); GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); while (index1 != eob_index) { level = ac_level[index1]; flags = ac_flags[index1]; sign = SHOW_SBITS(bs, &row->gb, 1); SKIP_BITS(bs, &row->gb, 1); if (flags & 1) { level += SHOW_UBITS(bs, &row->gb, index_bits) << 7; SKIP_BITS(bs, &row->gb, index_bits); } if (flags & 2) { UPDATE_CACHE(bs, &row->gb); GET_VLC(index2, bs, &row->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2); i += ctx->cid_table->run[index2]; } if (++i > 63) { av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i); break; } j = ctx->scantable.permutated[i]; level *= scale[i]; if (level_bias < 32 || weight_matrix[i] != level_bias) level += level_bias; level >>= level_shift; block[j] = (level ^ sign) - sign; UPDATE_CACHE(bs, &row->gb); GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); } CLOSE_READER(bs, &row->gb); }
true
FFmpeg
b8b8e82ea14016b2cb04b49ecea57f836e6ee7f8
static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx, RowContext *row, int n, int index_bits, int level_bias, int level_shift) { int i, j, index1, index2, len, flags; int level, component, sign; const int *scale; const uint8_t *weight_matrix; const uint8_t *ac_level = ctx->cid_table->ac_level; const uint8_t *ac_flags = ctx->cid_table->ac_flags; int16_t *block = row->blocks[n]; const int eob_index = ctx->cid_table->eob_index; OPEN_READER(bs, &row->gb); ctx->bdsp.clear_block(block); if (!ctx->is_444) { if (n & 2) { component = 1 + (n & 1); scale = row->chroma_scale; weight_matrix = ctx->cid_table->chroma_weight; } else { component = 0; scale = row->luma_scale; weight_matrix = ctx->cid_table->luma_weight; } } else { component = (n >> 1) % 3; if (component) { scale = row->chroma_scale; weight_matrix = ctx->cid_table->chroma_weight; } else { scale = row->luma_scale; weight_matrix = ctx->cid_table->luma_weight; } } UPDATE_CACHE(bs, &row->gb); GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1); if (len) { level = GET_CACHE(bs, &row->gb); LAST_SKIP_BITS(bs, &row->gb, len); sign = ~level >> 31; level = (NEG_USR32(sign ^ level, len) ^ sign) - sign; row->last_dc[component] += level; } block[0] = row->last_dc[component]; i = 0; UPDATE_CACHE(bs, &row->gb); GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); while (index1 != eob_index) { level = ac_level[index1]; flags = ac_flags[index1]; sign = SHOW_SBITS(bs, &row->gb, 1); SKIP_BITS(bs, &row->gb, 1); if (flags & 1) { level += SHOW_UBITS(bs, &row->gb, index_bits) << 7; SKIP_BITS(bs, &row->gb, index_bits); } if (flags & 2) { UPDATE_CACHE(bs, &row->gb); GET_VLC(index2, bs, &row->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2); i += ctx->cid_table->run[index2]; } if (++i > 63) { av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i); break; } j = ctx->scantable.permutated[i]; level *= scale[i]; if (level_bias < 32 || weight_matrix[i] != level_bias) level += level_bias; level >>= level_shift; block[j] = (level ^ sign) - sign; UPDATE_CACHE(bs, &row->gb); GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); } CLOSE_READER(bs, &row->gb); }
{ "code": [ "static av_always_inline void dnxhd_decode_dct_block(const DNXHDContext *ctx," ], "line_no": [ 1 ] }
static av_always_inline void FUNC_0(const DNXHDContext *ctx, RowContext *row, int n, int index_bits, int level_bias, int level_shift) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7, VAR_8; const int *VAR_9; const uint8_t *VAR_10; const uint8_t *VAR_11 = ctx->cid_table->VAR_11; const uint8_t *VAR_12 = ctx->cid_table->VAR_12; int16_t *block = row->blocks[n]; const int VAR_13 = ctx->cid_table->VAR_13; OPEN_READER(bs, &row->gb); ctx->bdsp.clear_block(block); if (!ctx->is_444) { if (n & 2) { VAR_7 = 1 + (n & 1); VAR_9 = row->chroma_scale; VAR_10 = ctx->cid_table->chroma_weight; } else { VAR_7 = 0; VAR_9 = row->luma_scale; VAR_10 = ctx->cid_table->luma_weight; } } else { VAR_7 = (n >> 1) % 3; if (VAR_7) { VAR_9 = row->chroma_scale; VAR_10 = ctx->cid_table->chroma_weight; } else { VAR_9 = row->luma_scale; VAR_10 = ctx->cid_table->luma_weight; } } UPDATE_CACHE(bs, &row->gb); GET_VLC(VAR_4, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1); if (VAR_4) { VAR_6 = GET_CACHE(bs, &row->gb); LAST_SKIP_BITS(bs, &row->gb, VAR_4); VAR_8 = ~VAR_6 >> 31; VAR_6 = (NEG_USR32(VAR_8 ^ VAR_6, VAR_4) ^ VAR_8) - VAR_8; row->last_dc[VAR_7] += VAR_6; } block[0] = row->last_dc[VAR_7]; VAR_0 = 0; UPDATE_CACHE(bs, &row->gb); GET_VLC(VAR_2, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); while (VAR_2 != VAR_13) { VAR_6 = VAR_11[VAR_2]; VAR_5 = VAR_12[VAR_2]; VAR_8 = SHOW_SBITS(bs, &row->gb, 1); SKIP_BITS(bs, &row->gb, 1); if (VAR_5 & 1) { VAR_6 += SHOW_UBITS(bs, &row->gb, index_bits) << 7; SKIP_BITS(bs, &row->gb, index_bits); } if (VAR_5 & 2) { UPDATE_CACHE(bs, &row->gb); GET_VLC(VAR_3, bs, &row->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2); VAR_0 += ctx->cid_table->run[VAR_3]; } if (++VAR_0 > 63) { av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, VAR_0); break; } VAR_1 = ctx->scantable.permutated[VAR_0]; VAR_6 *= VAR_9[VAR_0]; if (level_bias < 32 || VAR_10[VAR_0] != level_bias) VAR_6 += level_bias; VAR_6 >>= level_shift; block[VAR_1] = (VAR_6 ^ VAR_8) - VAR_8; UPDATE_CACHE(bs, &row->gb); GET_VLC(VAR_2, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); } CLOSE_READER(bs, &row->gb); }
[ "static av_always_inline void FUNC_0(const DNXHDContext *ctx,\nRowContext *row,\nint n,\nint index_bits,\nint level_bias,\nint level_shift)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "int VAR_6, VAR_7, VAR_8;", "const int *VAR_9;", "const uint8_t *VAR_10;", "const uint8_t *VAR_11 = ctx->cid_table->VAR_11;", "const uint8_t *VAR_12 = ctx->cid_table->VAR_12;", "int16_t *block = row->blocks[n];", "const int VAR_13 = ctx->cid_table->VAR_13;", "OPEN_READER(bs, &row->gb);", "ctx->bdsp.clear_block(block);", "if (!ctx->is_444) {", "if (n & 2) {", "VAR_7 = 1 + (n & 1);", "VAR_9 = row->chroma_scale;", "VAR_10 = ctx->cid_table->chroma_weight;", "} else {", "VAR_7 = 0;", "VAR_9 = row->luma_scale;", "VAR_10 = ctx->cid_table->luma_weight;", "}", "} else {", "VAR_7 = (n >> 1) % 3;", "if (VAR_7) {", "VAR_9 = row->chroma_scale;", "VAR_10 = ctx->cid_table->chroma_weight;", "} else {", "VAR_9 = row->luma_scale;", "VAR_10 = ctx->cid_table->luma_weight;", "}", "}", "UPDATE_CACHE(bs, &row->gb);", "GET_VLC(VAR_4, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);", "if (VAR_4) {", "VAR_6 = GET_CACHE(bs, &row->gb);", "LAST_SKIP_BITS(bs, &row->gb, VAR_4);", "VAR_8 = ~VAR_6 >> 31;", "VAR_6 = (NEG_USR32(VAR_8 ^ VAR_6, VAR_4) ^ VAR_8) - VAR_8;", "row->last_dc[VAR_7] += VAR_6;", "}", "block[0] = row->last_dc[VAR_7];", "VAR_0 = 0;", "UPDATE_CACHE(bs, &row->gb);", "GET_VLC(VAR_2, bs, &row->gb, ctx->ac_vlc.table,\nDNXHD_VLC_BITS, 2);", "while (VAR_2 != VAR_13) {", "VAR_6 = VAR_11[VAR_2];", "VAR_5 = VAR_12[VAR_2];", "VAR_8 = SHOW_SBITS(bs, &row->gb, 1);", "SKIP_BITS(bs, &row->gb, 1);", "if (VAR_5 & 1) {", "VAR_6 += SHOW_UBITS(bs, &row->gb, index_bits) << 7;", "SKIP_BITS(bs, &row->gb, index_bits);", "}", "if (VAR_5 & 2) {", "UPDATE_CACHE(bs, &row->gb);", "GET_VLC(VAR_3, bs, &row->gb, ctx->run_vlc.table,\nDNXHD_VLC_BITS, 2);", "VAR_0 += ctx->cid_table->run[VAR_3];", "}", "if (++VAR_0 > 63) {", "av_log(ctx->avctx, AV_LOG_ERROR, \"ac tex damaged %d, %d\\n\", n, VAR_0);", "break;", "}", "VAR_1 = ctx->scantable.permutated[VAR_0];", "VAR_6 *= VAR_9[VAR_0];", "if (level_bias < 32 || VAR_10[VAR_0] != level_bias)\nVAR_6 += level_bias;", "VAR_6 >>= level_shift;", "block[VAR_1] = (VAR_6 ^ VAR_8) - VAR_8;", "UPDATE_CACHE(bs, &row->gb);", "GET_VLC(VAR_2, bs, &row->gb, ctx->ac_vlc.table,\nDNXHD_VLC_BITS, 2);", "}", "CLOSE_READER(bs, &row->gb);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 109, 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 175 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 189 ], [ 191 ] ]
4,153
static void coroutine_fn qed_co_pwrite_zeroes_cb(void *opaque, int ret) { QEDWriteZeroesCB *cb = opaque; cb->done = true; cb->ret = ret; if (cb->co) { qemu_coroutine_enter(cb->co, NULL); } }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static void coroutine_fn qed_co_pwrite_zeroes_cb(void *opaque, int ret) { QEDWriteZeroesCB *cb = opaque; cb->done = true; cb->ret = ret; if (cb->co) { qemu_coroutine_enter(cb->co, NULL); } }
{ "code": [ " qemu_coroutine_enter(cb->co, NULL);", " qemu_coroutine_enter(cb->co, NULL);" ], "line_no": [ 15, 15 ] }
static void VAR_0 qed_co_pwrite_zeroes_cb(void *opaque, int ret) { QEDWriteZeroesCB *cb = opaque; cb->done = true; cb->ret = ret; if (cb->co) { qemu_coroutine_enter(cb->co, NULL); } }
[ "static void VAR_0 qed_co_pwrite_zeroes_cb(void *opaque, int ret)\n{", "QEDWriteZeroesCB *cb = opaque;", "cb->done = true;", "cb->ret = ret;", "if (cb->co) {", "qemu_coroutine_enter(cb->co, NULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
4,154
static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size, AVSubtitle *sub) { DVBSubContext *ctx = avctx->priv_data; DVBSubDisplayDefinition *display_def = ctx->display_definition; DVBSubRegion *region; DVBSubRegionDisplay *display; AVSubtitleRect *rect; DVBSubCLUT *clut; uint32_t *clut_table; int i; int offset_x=0, offset_y=0; sub->rects = NULL; sub->start_display_time = 0; sub->end_display_time = ctx->time_out * 1000; sub->format = 0; if (display_def) { offset_x = display_def->x; offset_y = display_def->y; } sub->num_rects = ctx->display_list_size; if (sub->num_rects <= 0) return AVERROR_INVALIDDATA; sub->rects = av_mallocz_array(sub->num_rects * sub->num_rects, sizeof(*sub->rects)); if (!sub->rects) return AVERROR(ENOMEM); i = 0; for (display = ctx->display_list; display; display = display->next) { region = get_region(ctx, display->region_id); rect = sub->rects[i]; if (!region) continue; rect->x = display->x_pos + offset_x; rect->y = display->y_pos + offset_y; rect->w = region->width; rect->h = region->height; rect->nb_colors = 16; rect->type = SUBTITLE_BITMAP; rect->linesize[0] = region->width; clut = get_clut(ctx, region->clut); if (!clut) clut = &default_clut; switch (region->depth) { case 2: clut_table = clut->clut4; break; case 8: clut_table = clut->clut256; break; case 4: default: clut_table = clut->clut16; break; } rect->data[1] = av_mallocz(AVPALETTE_SIZE); if (!rect->data[1]) { av_free(sub->rects); return AVERROR(ENOMEM); } memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); rect->data[0] = av_malloc(region->buf_size); if (!rect->data[0]) { av_free(rect->data[1]); av_free(sub->rects); return AVERROR(ENOMEM); } memcpy(rect->data[0], region->pbuf, region->buf_size); #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS { int j; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } } FF_ENABLE_DEPRECATION_WARNINGS #endif i++; } sub->num_rects = i; #ifdef DEBUG save_display_set(ctx); #endif return 1; }
true
FFmpeg
1cfd566324f4a9be066ea400685b81c0695e64d9
static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size, AVSubtitle *sub) { DVBSubContext *ctx = avctx->priv_data; DVBSubDisplayDefinition *display_def = ctx->display_definition; DVBSubRegion *region; DVBSubRegionDisplay *display; AVSubtitleRect *rect; DVBSubCLUT *clut; uint32_t *clut_table; int i; int offset_x=0, offset_y=0; sub->rects = NULL; sub->start_display_time = 0; sub->end_display_time = ctx->time_out * 1000; sub->format = 0; if (display_def) { offset_x = display_def->x; offset_y = display_def->y; } sub->num_rects = ctx->display_list_size; if (sub->num_rects <= 0) return AVERROR_INVALIDDATA; sub->rects = av_mallocz_array(sub->num_rects * sub->num_rects, sizeof(*sub->rects)); if (!sub->rects) return AVERROR(ENOMEM); i = 0; for (display = ctx->display_list; display; display = display->next) { region = get_region(ctx, display->region_id); rect = sub->rects[i]; if (!region) continue; rect->x = display->x_pos + offset_x; rect->y = display->y_pos + offset_y; rect->w = region->width; rect->h = region->height; rect->nb_colors = 16; rect->type = SUBTITLE_BITMAP; rect->linesize[0] = region->width; clut = get_clut(ctx, region->clut); if (!clut) clut = &default_clut; switch (region->depth) { case 2: clut_table = clut->clut4; break; case 8: clut_table = clut->clut256; break; case 4: default: clut_table = clut->clut16; break; } rect->data[1] = av_mallocz(AVPALETTE_SIZE); if (!rect->data[1]) { av_free(sub->rects); return AVERROR(ENOMEM); } memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); rect->data[0] = av_malloc(region->buf_size); if (!rect->data[0]) { av_free(rect->data[1]); av_free(sub->rects); return AVERROR(ENOMEM); } memcpy(rect->data[0], region->pbuf, region->buf_size); #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS { int j; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } } FF_ENABLE_DEPRECATION_WARNINGS #endif i++; } sub->num_rects = i; #ifdef DEBUG save_display_set(ctx); #endif return 1; }
{ "code": [ " if (sub->num_rects <= 0)", " return AVERROR_INVALIDDATA;", " sub->rects = av_mallocz_array(sub->num_rects * sub->num_rects,", " sizeof(*sub->rects));", " if (!sub->rects)", " return AVERROR(ENOMEM);" ], "line_no": [ 51, 53, 57, 59, 61, 63 ] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, int VAR_2, AVSubtitle *VAR_3) { DVBSubContext *ctx = VAR_0->priv_data; DVBSubDisplayDefinition *display_def = ctx->display_definition; DVBSubRegion *region; DVBSubRegionDisplay *display; AVSubtitleRect *rect; DVBSubCLUT *clut; uint32_t *clut_table; int VAR_4; int VAR_5=0, VAR_6=0; VAR_3->rects = NULL; VAR_3->start_display_time = 0; VAR_3->end_display_time = ctx->time_out * 1000; VAR_3->format = 0; if (display_def) { VAR_5 = display_def->x; VAR_6 = display_def->y; } VAR_3->num_rects = ctx->display_list_size; if (VAR_3->num_rects <= 0) return AVERROR_INVALIDDATA; VAR_3->rects = av_mallocz_array(VAR_3->num_rects * VAR_3->num_rects, sizeof(*VAR_3->rects)); if (!VAR_3->rects) return AVERROR(ENOMEM); VAR_4 = 0; for (display = ctx->display_list; display; display = display->next) { region = get_region(ctx, display->region_id); rect = VAR_3->rects[VAR_4]; if (!region) continue; rect->x = display->x_pos + VAR_5; rect->y = display->y_pos + VAR_6; rect->w = region->width; rect->h = region->height; rect->nb_colors = 16; rect->type = SUBTITLE_BITMAP; rect->linesize[0] = region->width; clut = get_clut(ctx, region->clut); if (!clut) clut = &default_clut; switch (region->depth) { case 2: clut_table = clut->clut4; break; case 8: clut_table = clut->clut256; break; case 4: default: clut_table = clut->clut16; break; } rect->data[1] = av_mallocz(AVPALETTE_SIZE); if (!rect->data[1]) { av_free(VAR_3->rects); return AVERROR(ENOMEM); } memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); rect->data[0] = av_malloc(region->VAR_2); if (!rect->data[0]) { av_free(rect->data[1]); av_free(VAR_3->rects); return AVERROR(ENOMEM); } memcpy(rect->data[0], region->pbuf, region->VAR_2); #if FF_API_AVPICTURE FF_DISABLE_DEPRECATION_WARNINGS { int j; for (j = 0; j < 4; j++) { rect->pict.data[j] = rect->data[j]; rect->pict.linesize[j] = rect->linesize[j]; } } FF_ENABLE_DEPRECATION_WARNINGS #endif VAR_4++; } VAR_3->num_rects = VAR_4; #ifdef DEBUG save_display_set(ctx); #endif return 1; }
[ "static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2, AVSubtitle *VAR_3)\n{", "DVBSubContext *ctx = VAR_0->priv_data;", "DVBSubDisplayDefinition *display_def = ctx->display_definition;", "DVBSubRegion *region;", "DVBSubRegionDisplay *display;", "AVSubtitleRect *rect;", "DVBSubCLUT *clut;", "uint32_t *clut_table;", "int VAR_4;", "int VAR_5=0, VAR_6=0;", "VAR_3->rects = NULL;", "VAR_3->start_display_time = 0;", "VAR_3->end_display_time = ctx->time_out * 1000;", "VAR_3->format = 0;", "if (display_def) {", "VAR_5 = display_def->x;", "VAR_6 = display_def->y;", "}", "VAR_3->num_rects = ctx->display_list_size;", "if (VAR_3->num_rects <= 0)\nreturn AVERROR_INVALIDDATA;", "VAR_3->rects = av_mallocz_array(VAR_3->num_rects * VAR_3->num_rects,\nsizeof(*VAR_3->rects));", "if (!VAR_3->rects)\nreturn AVERROR(ENOMEM);", "VAR_4 = 0;", "for (display = ctx->display_list; display; display = display->next) {", "region = get_region(ctx, display->region_id);", "rect = VAR_3->rects[VAR_4];", "if (!region)\ncontinue;", "rect->x = display->x_pos + VAR_5;", "rect->y = display->y_pos + VAR_6;", "rect->w = region->width;", "rect->h = region->height;", "rect->nb_colors = 16;", "rect->type = SUBTITLE_BITMAP;", "rect->linesize[0] = region->width;", "clut = get_clut(ctx, region->clut);", "if (!clut)\nclut = &default_clut;", "switch (region->depth) {", "case 2:\nclut_table = clut->clut4;", "break;", "case 8:\nclut_table = clut->clut256;", "break;", "case 4:\ndefault:\nclut_table = clut->clut16;", "break;", "}", "rect->data[1] = av_mallocz(AVPALETTE_SIZE);", "if (!rect->data[1]) {", "av_free(VAR_3->rects);", "return AVERROR(ENOMEM);", "}", "memcpy(rect->data[1], clut_table, (1 << region->depth) * sizeof(uint32_t));", "rect->data[0] = av_malloc(region->VAR_2);", "if (!rect->data[0]) {", "av_free(rect->data[1]);", "av_free(VAR_3->rects);", "return AVERROR(ENOMEM);", "}", "memcpy(rect->data[0], region->pbuf, region->VAR_2);", "#if FF_API_AVPICTURE\nFF_DISABLE_DEPRECATION_WARNINGS\n{", "int j;", "for (j = 0; j < 4; j++) {", "rect->pict.data[j] = rect->data[j];", "rect->pict.linesize[j] = rect->linesize[j];", "}", "}", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nVAR_4++;", "}", "VAR_3->num_rects = VAR_4;", "#ifdef DEBUG\nsave_display_set(ctx);", "#endif\nreturn 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 57, 59 ], [ 61, 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105, 107 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127, 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187, 191 ], [ 193 ], [ 197 ], [ 201, 203 ], [ 205, 209 ], [ 211 ] ]
4,155
DisplayState *init_displaystate(void) { gchar *name; int i; if (!display_state) { display_state = g_new0(DisplayState, 1); } for (i = 0; i < nb_consoles; i++) { if (consoles[i]->console_type != GRAPHIC_CONSOLE && consoles[i]->ds == NULL) { text_console_do_init(consoles[i]->chr, display_state); } /* Hook up into the qom tree here (not in new_console()), once * all QemuConsoles are created and the order / numbering * doesn't change any more */ name = g_strdup_printf("console[%d]", i); object_property_add_child(container_get(object_get_root(), "/backend"), name, OBJECT(consoles[i]), &error_abort); g_free(name); } return display_state; }
true
qemu
333cb18ff4aaf249b2e81a376bee2b15370f4784
DisplayState *init_displaystate(void) { gchar *name; int i; if (!display_state) { display_state = g_new0(DisplayState, 1); } for (i = 0; i < nb_consoles; i++) { if (consoles[i]->console_type != GRAPHIC_CONSOLE && consoles[i]->ds == NULL) { text_console_do_init(consoles[i]->chr, display_state); } name = g_strdup_printf("console[%d]", i); object_property_add_child(container_get(object_get_root(), "/backend"), name, OBJECT(consoles[i]), &error_abort); g_free(name); } return display_state; }
{ "code": [ " if (!display_state) {", " display_state = g_new0(DisplayState, 1);" ], "line_no": [ 11, 13 ] }
DisplayState *FUNC_0(void) { gchar *name; int VAR_0; if (!display_state) { display_state = g_new0(DisplayState, 1); } for (VAR_0 = 0; VAR_0 < nb_consoles; VAR_0++) { if (consoles[VAR_0]->console_type != GRAPHIC_CONSOLE && consoles[VAR_0]->ds == NULL) { text_console_do_init(consoles[VAR_0]->chr, display_state); } name = g_strdup_printf("console[%d]", VAR_0); object_property_add_child(container_get(object_get_root(), "/backend"), name, OBJECT(consoles[VAR_0]), &error_abort); g_free(name); } return display_state; }
[ "DisplayState *FUNC_0(void)\n{", "gchar *name;", "int VAR_0;", "if (!display_state) {", "display_state = g_new0(DisplayState, 1);", "}", "for (VAR_0 = 0; VAR_0 < nb_consoles; VAR_0++) {", "if (consoles[VAR_0]->console_type != GRAPHIC_CONSOLE &&\nconsoles[VAR_0]->ds == NULL) {", "text_console_do_init(consoles[VAR_0]->chr, display_state);", "}", "name = g_strdup_printf(\"console[%d]\", VAR_0);", "object_property_add_child(container_get(object_get_root(), \"/backend\"),\nname, OBJECT(consoles[VAR_0]), &error_abort);", "g_free(name);", "}", "return display_state;", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
4,156
static void e1000e_device_init(QPCIBus *bus, e1000e_device *d) { uint32_t val; d->pci_dev = e1000e_device_find(bus); /* Enable the device */ qpci_device_enable(d->pci_dev); /* Map BAR0 (mac registers) */ d->mac_regs = qpci_iomap(d->pci_dev, 0, NULL); g_assert_nonnull(d->mac_regs); /* Reset the device */ val = e1000e_macreg_read(d, E1000E_CTRL); e1000e_macreg_write(d, E1000E_CTRL, val | E1000E_CTRL_RESET); /* Enable and configure MSI-X */ qpci_msix_enable(d->pci_dev); e1000e_macreg_write(d, E1000E_IVAR, E1000E_IVAR_TEST_CFG); /* Check the device status - link and speed */ val = e1000e_macreg_read(d, E1000E_STATUS); g_assert_cmphex(val & (E1000E_STATUS_LU | E1000E_STATUS_ASDV1000), ==, E1000E_STATUS_LU | E1000E_STATUS_ASDV1000); /* Initialize TX/RX logic */ e1000e_macreg_write(d, E1000E_RCTL, 0); e1000e_macreg_write(d, E1000E_TCTL, 0); /* Notify the device that the driver is ready */ val = e1000e_macreg_read(d, E1000E_CTRL_EXT); e1000e_macreg_write(d, E1000E_CTRL_EXT, val | E1000E_CTRL_EXT_DRV_LOAD | E1000E_CTRL_EXT_TXLSFLOW); /* Allocate and setup TX ring */ d->tx_ring = guest_alloc(test_alloc, E1000E_RING_LEN); g_assert(d->tx_ring != 0); e1000e_macreg_write(d, E1000E_TDBAL, (uint32_t) d->tx_ring); e1000e_macreg_write(d, E1000E_TDBAH, (uint32_t) (d->tx_ring >> 32)); e1000e_macreg_write(d, E1000E_TDLEN, E1000E_RING_LEN); e1000e_macreg_write(d, E1000E_TDT, 0); e1000e_macreg_write(d, E1000E_TDH, 0); /* Enable transmit */ e1000e_macreg_write(d, E1000E_TCTL, E1000E_TCTL_EN); /* Allocate and setup RX ring */ d->rx_ring = guest_alloc(test_alloc, E1000E_RING_LEN); g_assert(d->rx_ring != 0); e1000e_macreg_write(d, E1000E_RDBAL, (uint32_t)d->rx_ring); e1000e_macreg_write(d, E1000E_RDBAH, (uint32_t)(d->rx_ring >> 32)); e1000e_macreg_write(d, E1000E_RDLEN, E1000E_RING_LEN); e1000e_macreg_write(d, E1000E_RDT, 0); e1000e_macreg_write(d, E1000E_RDH, 0); /* Enable receive */ e1000e_macreg_write(d, E1000E_RFCTL, E1000E_RFCTL_EXTEN); e1000e_macreg_write(d, E1000E_RCTL, E1000E_RCTL_EN | E1000E_RCTL_UPE | E1000E_RCTL_MPE); /* Enable all interrupts */ e1000e_macreg_write(d, E1000E_IMS, 0xFFFFFFFF); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void e1000e_device_init(QPCIBus *bus, e1000e_device *d) { uint32_t val; d->pci_dev = e1000e_device_find(bus); qpci_device_enable(d->pci_dev); d->mac_regs = qpci_iomap(d->pci_dev, 0, NULL); g_assert_nonnull(d->mac_regs); val = e1000e_macreg_read(d, E1000E_CTRL); e1000e_macreg_write(d, E1000E_CTRL, val | E1000E_CTRL_RESET); qpci_msix_enable(d->pci_dev); e1000e_macreg_write(d, E1000E_IVAR, E1000E_IVAR_TEST_CFG); val = e1000e_macreg_read(d, E1000E_STATUS); g_assert_cmphex(val & (E1000E_STATUS_LU | E1000E_STATUS_ASDV1000), ==, E1000E_STATUS_LU | E1000E_STATUS_ASDV1000); e1000e_macreg_write(d, E1000E_RCTL, 0); e1000e_macreg_write(d, E1000E_TCTL, 0); val = e1000e_macreg_read(d, E1000E_CTRL_EXT); e1000e_macreg_write(d, E1000E_CTRL_EXT, val | E1000E_CTRL_EXT_DRV_LOAD | E1000E_CTRL_EXT_TXLSFLOW); d->tx_ring = guest_alloc(test_alloc, E1000E_RING_LEN); g_assert(d->tx_ring != 0); e1000e_macreg_write(d, E1000E_TDBAL, (uint32_t) d->tx_ring); e1000e_macreg_write(d, E1000E_TDBAH, (uint32_t) (d->tx_ring >> 32)); e1000e_macreg_write(d, E1000E_TDLEN, E1000E_RING_LEN); e1000e_macreg_write(d, E1000E_TDT, 0); e1000e_macreg_write(d, E1000E_TDH, 0); e1000e_macreg_write(d, E1000E_TCTL, E1000E_TCTL_EN); d->rx_ring = guest_alloc(test_alloc, E1000E_RING_LEN); g_assert(d->rx_ring != 0); e1000e_macreg_write(d, E1000E_RDBAL, (uint32_t)d->rx_ring); e1000e_macreg_write(d, E1000E_RDBAH, (uint32_t)(d->rx_ring >> 32)); e1000e_macreg_write(d, E1000E_RDLEN, E1000E_RING_LEN); e1000e_macreg_write(d, E1000E_RDT, 0); e1000e_macreg_write(d, E1000E_RDH, 0); e1000e_macreg_write(d, E1000E_RFCTL, E1000E_RFCTL_EXTEN); e1000e_macreg_write(d, E1000E_RCTL, E1000E_RCTL_EN | E1000E_RCTL_UPE | E1000E_RCTL_MPE); e1000e_macreg_write(d, E1000E_IMS, 0xFFFFFFFF); }
{ "code": [ " g_assert_nonnull(d->mac_regs);" ], "line_no": [ 23 ] }
static void FUNC_0(QPCIBus *VAR_0, e1000e_device *VAR_1) { uint32_t val; VAR_1->pci_dev = e1000e_device_find(VAR_0); qpci_device_enable(VAR_1->pci_dev); VAR_1->mac_regs = qpci_iomap(VAR_1->pci_dev, 0, NULL); g_assert_nonnull(VAR_1->mac_regs); val = e1000e_macreg_read(VAR_1, E1000E_CTRL); e1000e_macreg_write(VAR_1, E1000E_CTRL, val | E1000E_CTRL_RESET); qpci_msix_enable(VAR_1->pci_dev); e1000e_macreg_write(VAR_1, E1000E_IVAR, E1000E_IVAR_TEST_CFG); val = e1000e_macreg_read(VAR_1, E1000E_STATUS); g_assert_cmphex(val & (E1000E_STATUS_LU | E1000E_STATUS_ASDV1000), ==, E1000E_STATUS_LU | E1000E_STATUS_ASDV1000); e1000e_macreg_write(VAR_1, E1000E_RCTL, 0); e1000e_macreg_write(VAR_1, E1000E_TCTL, 0); val = e1000e_macreg_read(VAR_1, E1000E_CTRL_EXT); e1000e_macreg_write(VAR_1, E1000E_CTRL_EXT, val | E1000E_CTRL_EXT_DRV_LOAD | E1000E_CTRL_EXT_TXLSFLOW); VAR_1->tx_ring = guest_alloc(test_alloc, E1000E_RING_LEN); g_assert(VAR_1->tx_ring != 0); e1000e_macreg_write(VAR_1, E1000E_TDBAL, (uint32_t) VAR_1->tx_ring); e1000e_macreg_write(VAR_1, E1000E_TDBAH, (uint32_t) (VAR_1->tx_ring >> 32)); e1000e_macreg_write(VAR_1, E1000E_TDLEN, E1000E_RING_LEN); e1000e_macreg_write(VAR_1, E1000E_TDT, 0); e1000e_macreg_write(VAR_1, E1000E_TDH, 0); e1000e_macreg_write(VAR_1, E1000E_TCTL, E1000E_TCTL_EN); VAR_1->rx_ring = guest_alloc(test_alloc, E1000E_RING_LEN); g_assert(VAR_1->rx_ring != 0); e1000e_macreg_write(VAR_1, E1000E_RDBAL, (uint32_t)VAR_1->rx_ring); e1000e_macreg_write(VAR_1, E1000E_RDBAH, (uint32_t)(VAR_1->rx_ring >> 32)); e1000e_macreg_write(VAR_1, E1000E_RDLEN, E1000E_RING_LEN); e1000e_macreg_write(VAR_1, E1000E_RDT, 0); e1000e_macreg_write(VAR_1, E1000E_RDH, 0); e1000e_macreg_write(VAR_1, E1000E_RFCTL, E1000E_RFCTL_EXTEN); e1000e_macreg_write(VAR_1, E1000E_RCTL, E1000E_RCTL_EN | E1000E_RCTL_UPE | E1000E_RCTL_MPE); e1000e_macreg_write(VAR_1, E1000E_IMS, 0xFFFFFFFF); }
[ "static void FUNC_0(QPCIBus *VAR_0, e1000e_device *VAR_1)\n{", "uint32_t val;", "VAR_1->pci_dev = e1000e_device_find(VAR_0);", "qpci_device_enable(VAR_1->pci_dev);", "VAR_1->mac_regs = qpci_iomap(VAR_1->pci_dev, 0, NULL);", "g_assert_nonnull(VAR_1->mac_regs);", "val = e1000e_macreg_read(VAR_1, E1000E_CTRL);", "e1000e_macreg_write(VAR_1, E1000E_CTRL, val | E1000E_CTRL_RESET);", "qpci_msix_enable(VAR_1->pci_dev);", "e1000e_macreg_write(VAR_1, E1000E_IVAR, E1000E_IVAR_TEST_CFG);", "val = e1000e_macreg_read(VAR_1, E1000E_STATUS);", "g_assert_cmphex(val & (E1000E_STATUS_LU | E1000E_STATUS_ASDV1000),\n==, E1000E_STATUS_LU | E1000E_STATUS_ASDV1000);", "e1000e_macreg_write(VAR_1, E1000E_RCTL, 0);", "e1000e_macreg_write(VAR_1, E1000E_TCTL, 0);", "val = e1000e_macreg_read(VAR_1, E1000E_CTRL_EXT);", "e1000e_macreg_write(VAR_1, E1000E_CTRL_EXT,\nval | E1000E_CTRL_EXT_DRV_LOAD | E1000E_CTRL_EXT_TXLSFLOW);", "VAR_1->tx_ring = guest_alloc(test_alloc, E1000E_RING_LEN);", "g_assert(VAR_1->tx_ring != 0);", "e1000e_macreg_write(VAR_1, E1000E_TDBAL, (uint32_t) VAR_1->tx_ring);", "e1000e_macreg_write(VAR_1, E1000E_TDBAH, (uint32_t) (VAR_1->tx_ring >> 32));", "e1000e_macreg_write(VAR_1, E1000E_TDLEN, E1000E_RING_LEN);", "e1000e_macreg_write(VAR_1, E1000E_TDT, 0);", "e1000e_macreg_write(VAR_1, E1000E_TDH, 0);", "e1000e_macreg_write(VAR_1, E1000E_TCTL, E1000E_TCTL_EN);", "VAR_1->rx_ring = guest_alloc(test_alloc, E1000E_RING_LEN);", "g_assert(VAR_1->rx_ring != 0);", "e1000e_macreg_write(VAR_1, E1000E_RDBAL, (uint32_t)VAR_1->rx_ring);", "e1000e_macreg_write(VAR_1, E1000E_RDBAH, (uint32_t)(VAR_1->rx_ring >> 32));", "e1000e_macreg_write(VAR_1, E1000E_RDLEN, E1000E_RING_LEN);", "e1000e_macreg_write(VAR_1, E1000E_RDT, 0);", "e1000e_macreg_write(VAR_1, E1000E_RDH, 0);", "e1000e_macreg_write(VAR_1, E1000E_RFCTL, E1000E_RFCTL_EXTEN);", "e1000e_macreg_write(VAR_1, E1000E_RCTL, E1000E_RCTL_EN |\nE1000E_RCTL_UPE |\nE1000E_RCTL_MPE);", "e1000e_macreg_write(VAR_1, E1000E_IMS, 0xFFFFFFFF);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 15 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 45 ], [ 47, 49 ], [ 55 ], [ 57 ], [ 63 ], [ 65, 67 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121, 123, 125 ], [ 131 ], [ 133 ] ]
4,157
static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, uint8_t *outbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint64_t nb_sectors; int page, dbd, buflen, ret, page_control; uint8_t *p; uint8_t dev_specific_param; dbd = r->req.cmd.buf[1] & 0x8; page = r->req.cmd.buf[2] & 0x3f; page_control = (r->req.cmd.buf[2] & 0xc0) >> 6; DPRINTF("Mode Sense(%d) (page %d, xfer %zd, page_control %d)\n", (r->req.cmd.buf[0] == MODE_SENSE) ? 6 : 10, page, r->req.cmd.xfer, page_control); memset(outbuf, 0, r->req.cmd.xfer); p = outbuf; if (bdrv_is_read_only(s->qdev.conf.bs)) { dev_specific_param = 0x80; /* Readonly. */ } else { dev_specific_param = 0x00; } if (r->req.cmd.buf[0] == MODE_SENSE) { p[1] = 0; /* Default media type. */ p[2] = dev_specific_param; p[3] = 0; /* Block descriptor length. */ p += 4; } else { /* MODE_SENSE_10 */ p[2] = 0; /* Default media type. */ p[3] = dev_specific_param; p[6] = p[7] = 0; /* Block descriptor length. */ p += 8; } /* MMC prescribes that CD/DVD drives have no block descriptors. */ bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); if (!dbd && s->qdev.type == TYPE_DISK && nb_sectors) { if (r->req.cmd.buf[0] == MODE_SENSE) { outbuf[3] = 8; /* Block descriptor length */ } else { /* MODE_SENSE_10 */ outbuf[7] = 8; /* Block descriptor length */ } nb_sectors /= (s->qdev.blocksize / 512); if (nb_sectors > 0xffffff) { nb_sectors = 0; } p[0] = 0; /* media density code */ p[1] = (nb_sectors >> 16) & 0xff; p[2] = (nb_sectors >> 8) & 0xff; p[3] = nb_sectors & 0xff; p[4] = 0; /* reserved */ p[5] = 0; /* bytes 5-7 are the sector size in bytes */ p[6] = s->qdev.blocksize >> 8; p[7] = 0; p += 8; } if (page_control == 3) { /* Saved Values */ scsi_check_condition(r, SENSE_CODE(SAVING_PARAMS_NOT_SUPPORTED)); return -1; } if (page == 0x3f) { for (page = 0; page <= 0x3e; page++) { mode_sense_page(s, page, &p, page_control); } } else { ret = mode_sense_page(s, page, &p, page_control); if (ret == -1) { return -1; } } buflen = p - outbuf; /* * The mode data length field specifies the length in bytes of the * following data that is available to be transferred. The mode data * length does not include itself. */ if (r->req.cmd.buf[0] == MODE_SENSE) { outbuf[0] = buflen - 1; } else { /* MODE_SENSE_10 */ outbuf[0] = ((buflen - 2) >> 8) & 0xff; outbuf[1] = (buflen - 2) & 0xff; } if (buflen > r->req.cmd.xfer) { buflen = r->req.cmd.xfer; } return buflen; }
true
qemu
e2f0c49ffae8d3a00272c3cbc68850cc5aafbffa
static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, uint8_t *outbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint64_t nb_sectors; int page, dbd, buflen, ret, page_control; uint8_t *p; uint8_t dev_specific_param; dbd = r->req.cmd.buf[1] & 0x8; page = r->req.cmd.buf[2] & 0x3f; page_control = (r->req.cmd.buf[2] & 0xc0) >> 6; DPRINTF("Mode Sense(%d) (page %d, xfer %zd, page_control %d)\n", (r->req.cmd.buf[0] == MODE_SENSE) ? 6 : 10, page, r->req.cmd.xfer, page_control); memset(outbuf, 0, r->req.cmd.xfer); p = outbuf; if (bdrv_is_read_only(s->qdev.conf.bs)) { dev_specific_param = 0x80; } else { dev_specific_param = 0x00; } if (r->req.cmd.buf[0] == MODE_SENSE) { p[1] = 0; p[2] = dev_specific_param; p[3] = 0; p += 4; } else { p[2] = 0; p[3] = dev_specific_param; p[6] = p[7] = 0; p += 8; } bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); if (!dbd && s->qdev.type == TYPE_DISK && nb_sectors) { if (r->req.cmd.buf[0] == MODE_SENSE) { outbuf[3] = 8; } else { outbuf[7] = 8; } nb_sectors /= (s->qdev.blocksize / 512); if (nb_sectors > 0xffffff) { nb_sectors = 0; } p[0] = 0; p[1] = (nb_sectors >> 16) & 0xff; p[2] = (nb_sectors >> 8) & 0xff; p[3] = nb_sectors & 0xff; p[4] = 0; p[5] = 0; p[6] = s->qdev.blocksize >> 8; p[7] = 0; p += 8; } if (page_control == 3) { scsi_check_condition(r, SENSE_CODE(SAVING_PARAMS_NOT_SUPPORTED)); return -1; } if (page == 0x3f) { for (page = 0; page <= 0x3e; page++) { mode_sense_page(s, page, &p, page_control); } } else { ret = mode_sense_page(s, page, &p, page_control); if (ret == -1) { return -1; } } buflen = p - outbuf; if (r->req.cmd.buf[0] == MODE_SENSE) { outbuf[0] = buflen - 1; } else { outbuf[0] = ((buflen - 2) >> 8) & 0xff; outbuf[1] = (buflen - 2) & 0xff; } if (buflen > r->req.cmd.xfer) { buflen = r->req.cmd.xfer; } return buflen; }
{ "code": [ " if (buflen > r->req.cmd.xfer) {", " buflen = r->req.cmd.xfer;" ], "line_no": [ 173, 175 ] }
static int FUNC_0(SCSIDiskReq *VAR_0, uint8_t *VAR_1) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->req.dev); uint64_t nb_sectors; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; uint8_t *p; uint8_t dev_specific_param; VAR_3 = VAR_0->req.cmd.buf[1] & 0x8; VAR_2 = VAR_0->req.cmd.buf[2] & 0x3f; VAR_6 = (VAR_0->req.cmd.buf[2] & 0xc0) >> 6; DPRINTF("Mode Sense(%d) (VAR_2 %d, xfer %zd, VAR_6 %d)\n", (VAR_0->req.cmd.buf[0] == MODE_SENSE) ? 6 : 10, VAR_2, VAR_0->req.cmd.xfer, VAR_6); memset(VAR_1, 0, VAR_0->req.cmd.xfer); p = VAR_1; if (bdrv_is_read_only(s->qdev.conf.bs)) { dev_specific_param = 0x80; } else { dev_specific_param = 0x00; } if (VAR_0->req.cmd.buf[0] == MODE_SENSE) { p[1] = 0; p[2] = dev_specific_param; p[3] = 0; p += 4; } else { p[2] = 0; p[3] = dev_specific_param; p[6] = p[7] = 0; p += 8; } bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); if (!VAR_3 && s->qdev.type == TYPE_DISK && nb_sectors) { if (VAR_0->req.cmd.buf[0] == MODE_SENSE) { VAR_1[3] = 8; } else { VAR_1[7] = 8; } nb_sectors /= (s->qdev.blocksize / 512); if (nb_sectors > 0xffffff) { nb_sectors = 0; } p[0] = 0; p[1] = (nb_sectors >> 16) & 0xff; p[2] = (nb_sectors >> 8) & 0xff; p[3] = nb_sectors & 0xff; p[4] = 0; p[5] = 0; p[6] = s->qdev.blocksize >> 8; p[7] = 0; p += 8; } if (VAR_6 == 3) { scsi_check_condition(VAR_0, SENSE_CODE(SAVING_PARAMS_NOT_SUPPORTED)); return -1; } if (VAR_2 == 0x3f) { for (VAR_2 = 0; VAR_2 <= 0x3e; VAR_2++) { mode_sense_page(s, VAR_2, &p, VAR_6); } } else { VAR_5 = mode_sense_page(s, VAR_2, &p, VAR_6); if (VAR_5 == -1) { return -1; } } VAR_4 = p - VAR_1; if (VAR_0->req.cmd.buf[0] == MODE_SENSE) { VAR_1[0] = VAR_4 - 1; } else { VAR_1[0] = ((VAR_4 - 2) >> 8) & 0xff; VAR_1[1] = (VAR_4 - 2) & 0xff; } if (VAR_4 > VAR_0->req.cmd.xfer) { VAR_4 = VAR_0->req.cmd.xfer; } return VAR_4; }
[ "static int FUNC_0(SCSIDiskReq *VAR_0, uint8_t *VAR_1)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->req.dev);", "uint64_t nb_sectors;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "uint8_t *p;", "uint8_t dev_specific_param;", "VAR_3 = VAR_0->req.cmd.buf[1] & 0x8;", "VAR_2 = VAR_0->req.cmd.buf[2] & 0x3f;", "VAR_6 = (VAR_0->req.cmd.buf[2] & 0xc0) >> 6;", "DPRINTF(\"Mode Sense(%d) (VAR_2 %d, xfer %zd, VAR_6 %d)\\n\",\n(VAR_0->req.cmd.buf[0] == MODE_SENSE) ? 6 : 10, VAR_2, VAR_0->req.cmd.xfer, VAR_6);", "memset(VAR_1, 0, VAR_0->req.cmd.xfer);", "p = VAR_1;", "if (bdrv_is_read_only(s->qdev.conf.bs)) {", "dev_specific_param = 0x80;", "} else {", "dev_specific_param = 0x00;", "}", "if (VAR_0->req.cmd.buf[0] == MODE_SENSE) {", "p[1] = 0;", "p[2] = dev_specific_param;", "p[3] = 0;", "p += 4;", "} else {", "p[2] = 0;", "p[3] = dev_specific_param;", "p[6] = p[7] = 0;", "p += 8;", "}", "bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);", "if (!VAR_3 && s->qdev.type == TYPE_DISK && nb_sectors) {", "if (VAR_0->req.cmd.buf[0] == MODE_SENSE) {", "VAR_1[3] = 8;", "} else {", "VAR_1[7] = 8;", "}", "nb_sectors /= (s->qdev.blocksize / 512);", "if (nb_sectors > 0xffffff) {", "nb_sectors = 0;", "}", "p[0] = 0;", "p[1] = (nb_sectors >> 16) & 0xff;", "p[2] = (nb_sectors >> 8) & 0xff;", "p[3] = nb_sectors & 0xff;", "p[4] = 0;", "p[5] = 0;", "p[6] = s->qdev.blocksize >> 8;", "p[7] = 0;", "p += 8;", "}", "if (VAR_6 == 3) {", "scsi_check_condition(VAR_0, SENSE_CODE(SAVING_PARAMS_NOT_SUPPORTED));", "return -1;", "}", "if (VAR_2 == 0x3f) {", "for (VAR_2 = 0; VAR_2 <= 0x3e; VAR_2++) {", "mode_sense_page(s, VAR_2, &p, VAR_6);", "}", "} else {", "VAR_5 = mode_sense_page(s, VAR_2, &p, VAR_6);", "if (VAR_5 == -1) {", "return -1;", "}", "}", "VAR_4 = p - VAR_1;", "if (VAR_0->req.cmd.buf[0] == MODE_SENSE) {", "VAR_1[0] = VAR_4 - 1;", "} else {", "VAR_1[0] = ((VAR_4 - 2) >> 8) & 0xff;", "VAR_1[1] = (VAR_4 - 2) & 0xff;", "}", "if (VAR_4 > VAR_0->req.cmd.xfer) {", "VAR_4 = VAR_0->req.cmd.xfer;", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ] ]
4,158
static int decode_block(MJpegDecodeContext *s, DCTELEM *block, int component, int dc_index, int ac_index, int16_t *quant_matrix) { int code, i, j, level, val; /* DC coef */ val = mjpeg_decode_dc(s, dc_index); if (val == 0xffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return -1; } val = val * quant_matrix[0] + s->last_dc[component]; s->last_dc[component] = val; block[0] = val; /* AC coefs */ i = 0; {OPEN_READER(re, &s->gb) for(;;) { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) /* EOB */ if (code == 0x10) break; i += ((unsigned)code) >> 4; code &= 0xf; if(code){ if(code > MIN_CACHE_BITS - 16){ UPDATE_CACHE(re, &s->gb) } { int cache=GET_CACHE(re,&s->gb); int sign=(~cache)>>31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code) if (i >= 63) { if(i == 63){ j = s->scantable.permutated[63]; block[j] = level * quant_matrix[j]; break; } av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return -1; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[j]; } } CLOSE_READER(re, &s->gb)} return 0; }
true
FFmpeg
2111a191ebec422cf7781225cbcfdd69e71afce1
static int decode_block(MJpegDecodeContext *s, DCTELEM *block, int component, int dc_index, int ac_index, int16_t *quant_matrix) { int code, i, j, level, val; val = mjpeg_decode_dc(s, dc_index); if (val == 0xffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return -1; } val = val * quant_matrix[0] + s->last_dc[component]; s->last_dc[component] = val; block[0] = val; i = 0; {OPEN_READER(re, &s->gb) for(;;) { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) if (code == 0x10) break; i += ((unsigned)code) >> 4; code &= 0xf; if(code){ if(code > MIN_CACHE_BITS - 16){ UPDATE_CACHE(re, &s->gb) } { int cache=GET_CACHE(re,&s->gb); int sign=(~cache)>>31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code) if (i >= 63) { if(i == 63){ j = s->scantable.permutated[63]; block[j] = level * quant_matrix[j]; break; } av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return -1; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[j]; } } CLOSE_READER(re, &s->gb)} return 0; }
{ "code": [ " for(;;) {" ], "line_no": [ 35 ] }
static int FUNC_0(MJpegDecodeContext *VAR_0, DCTELEM *VAR_1, int VAR_2, int VAR_3, int VAR_4, int16_t *VAR_5) { int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3); if (VAR_10 == 0xffff) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error dc\n"); return -1; } VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2]; VAR_0->last_dc[VAR_2] = VAR_10; VAR_1[0] = VAR_10; VAR_7 = 0; {OPEN_READER(re, &VAR_0->gb) for(;;) { UPDATE_CACHE(re, &VAR_0->gb); GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2) if (VAR_6 == 0x10) break; VAR_7 += ((unsigned)VAR_6) >> 4; VAR_6 &= 0xf; if(VAR_6){ if(VAR_6 > MIN_CACHE_BITS - 16){ UPDATE_CACHE(re, &VAR_0->gb) } { int cache=GET_CACHE(re,&VAR_0->gb); int sign=(~cache)>>31; VAR_9 = (NEG_USR32(sign ^ cache,VAR_6) ^ sign) - sign; } LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6) if (VAR_7 >= 63) { if(VAR_7 == 63){ VAR_8 = VAR_0->scantable.permutated[63]; VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_8]; break; } av_log(VAR_0->avctx, AV_LOG_ERROR, "error count: %d\n", VAR_7); return -1; } VAR_8 = VAR_0->scantable.permutated[VAR_7]; VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_8]; } } CLOSE_READER(re, &VAR_0->gb)} return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0, DCTELEM *VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int16_t *VAR_5)\n{", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3);", "if (VAR_10 == 0xffff) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error dc\\n\");", "return -1;", "}", "VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2];", "VAR_0->last_dc[VAR_2] = VAR_10;", "VAR_1[0] = VAR_10;", "VAR_7 = 0;", "{OPEN_READER(re, &VAR_0->gb)", "for(;;) {", "UPDATE_CACHE(re, &VAR_0->gb);", "GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2)\nif (VAR_6 == 0x10)\nbreak;", "VAR_7 += ((unsigned)VAR_6) >> 4;", "VAR_6 &= 0xf;", "if(VAR_6){", "if(VAR_6 > MIN_CACHE_BITS - 16){", "UPDATE_CACHE(re, &VAR_0->gb)\n}", "{", "int cache=GET_CACHE(re,&VAR_0->gb);", "int sign=(~cache)>>31;", "VAR_9 = (NEG_USR32(sign ^ cache,VAR_6) ^ sign) - sign;", "}", "LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6)\nif (VAR_7 >= 63) {", "if(VAR_7 == 63){", "VAR_8 = VAR_0->scantable.permutated[63];", "VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_8];", "break;", "}", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"error count: %d\\n\", VAR_7);", "return -1;", "}", "VAR_8 = VAR_0->scantable.permutated[VAR_7];", "VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_8];", "}", "}", "CLOSE_READER(re, &VAR_0->gb)}", "return 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ] ]
4,160
static int decode_ext_header(Wmv2Context *w){ MpegEncContext * const s= &w->s; GetBitContext gb; int fps; int code; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); fps = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; w->mspel_bit = get_bits1(&gb); s->loop_filter = get_bits1(&gb); w->abt_flag = get_bits1(&gb); w->j_type_bit = get_bits1(&gb); w->top_left_mv_flag= get_bits1(&gb); w->per_mb_rl_bit = get_bits1(&gb); code = get_bits(&gb, 3); if(code==0) return -1; s->slice_height = s->mb_height / code; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, slices:%d\n", fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter, code); } return 0; }
true
FFmpeg
3b99e00c7549ccad90c57b5bcd6e3456650a994a
static int decode_ext_header(Wmv2Context *w){ MpegEncContext * const s= &w->s; GetBitContext gb; int fps; int code; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); fps = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; w->mspel_bit = get_bits1(&gb); s->loop_filter = get_bits1(&gb); w->abt_flag = get_bits1(&gb); w->j_type_bit = get_bits1(&gb); w->top_left_mv_flag= get_bits1(&gb); w->per_mb_rl_bit = get_bits1(&gb); code = get_bits(&gb, 3); if(code==0) return -1; s->slice_height = s->mb_height / code; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, slices:%d\n", fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter, code); } return 0; }
{ "code": [ " init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);" ], "line_no": [ 17 ] }
static int FUNC_0(Wmv2Context *VAR_0){ MpegEncContext * const s= &VAR_0->s; GetBitContext gb; int VAR_1; int VAR_2; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); VAR_1 = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; VAR_0->mspel_bit = get_bits1(&gb); s->loop_filter = get_bits1(&gb); VAR_0->abt_flag = get_bits1(&gb); VAR_0->j_type_bit = get_bits1(&gb); VAR_0->top_left_mv_flag= get_bits1(&gb); VAR_0->per_mb_rl_bit = get_bits1(&gb); VAR_2 = get_bits(&gb, 3); if(VAR_2==0) return -1; s->slice_height = s->mb_height / VAR_2; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "VAR_1:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, VAR_2:%d, loop_filter:%d, slices:%d\n", VAR_1, s->bit_rate, VAR_0->mspel_bit, VAR_0->abt_flag, VAR_0->j_type_bit, VAR_0->top_left_mv_flag, VAR_0->per_mb_rl_bit, VAR_2, s->loop_filter, VAR_2); } return 0; }
[ "static int FUNC_0(Wmv2Context *VAR_0){", "MpegEncContext * const s= &VAR_0->s;", "GetBitContext gb;", "int VAR_1;", "int VAR_2;", "if(s->avctx->extradata_size<4) return -1;", "init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);", "VAR_1 = get_bits(&gb, 5);", "s->bit_rate = get_bits(&gb, 11)*1024;", "VAR_0->mspel_bit = get_bits1(&gb);", "s->loop_filter = get_bits1(&gb);", "VAR_0->abt_flag = get_bits1(&gb);", "VAR_0->j_type_bit = get_bits1(&gb);", "VAR_0->top_left_mv_flag= get_bits1(&gb);", "VAR_0->per_mb_rl_bit = get_bits1(&gb);", "VAR_2 = get_bits(&gb, 3);", "if(VAR_2==0) return -1;", "s->slice_height = s->mb_height / VAR_2;", "if(s->avctx->debug&FF_DEBUG_PICT_INFO){", "av_log(s->avctx, AV_LOG_DEBUG, \"VAR_1:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, VAR_2:%d, loop_filter:%d, slices:%d\\n\",\nVAR_1, s->bit_rate, VAR_0->mspel_bit, VAR_0->abt_flag, VAR_0->j_type_bit, VAR_0->top_left_mv_flag, VAR_0->per_mb_rl_bit, VAR_2, s->loop_filter,\nVAR_2);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ] ]
4,161
static void tlb_flush_nocheck(CPUState *cpu) { CPUArchState *env = cpu->env_ptr; /* The QOM tests will trigger tlb_flushes without setting up TCG * so we bug out here in that case. */ if (!tcg_enabled()) { return; } assert_cpu_is_self(cpu); tlb_debug("(count: %d)\n", tlb_flush_count++); tb_lock(); memset(env->tlb_table, -1, sizeof(env->tlb_table)); memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table)); memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); env->vtlb_index = 0; env->tlb_flush_addr = -1; env->tlb_flush_mask = 0; tb_unlock(); atomic_mb_set(&cpu->pending_tlb_flush, 0); }
true
qemu
f3ced3c59287dabc253f83f0c70aa4934470c15e
static void tlb_flush_nocheck(CPUState *cpu) { CPUArchState *env = cpu->env_ptr; if (!tcg_enabled()) { return; } assert_cpu_is_self(cpu); tlb_debug("(count: %d)\n", tlb_flush_count++); tb_lock(); memset(env->tlb_table, -1, sizeof(env->tlb_table)); memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table)); memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); env->vtlb_index = 0; env->tlb_flush_addr = -1; env->tlb_flush_mask = 0; tb_unlock(); atomic_mb_set(&cpu->pending_tlb_flush, 0); }
{ "code": [ " memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache));", " memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache));" ], "line_no": [ 37, 37 ] }
static void FUNC_0(CPUState *VAR_0) { CPUArchState *env = VAR_0->env_ptr; if (!tcg_enabled()) { return; } assert_cpu_is_self(VAR_0); tlb_debug("(count: %d)\n", tlb_flush_count++); tb_lock(); memset(env->tlb_table, -1, sizeof(env->tlb_table)); memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table)); memset(VAR_0->tb_jmp_cache, 0, sizeof(VAR_0->tb_jmp_cache)); env->vtlb_index = 0; env->tlb_flush_addr = -1; env->tlb_flush_mask = 0; tb_unlock(); atomic_mb_set(&VAR_0->pending_tlb_flush, 0); }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "CPUArchState *env = VAR_0->env_ptr;", "if (!tcg_enabled()) {", "return;", "}", "assert_cpu_is_self(VAR_0);", "tlb_debug(\"(count: %d)\\n\", tlb_flush_count++);", "tb_lock();", "memset(env->tlb_table, -1, sizeof(env->tlb_table));", "memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table));", "memset(VAR_0->tb_jmp_cache, 0, sizeof(VAR_0->tb_jmp_cache));", "env->vtlb_index = 0;", "env->tlb_flush_addr = -1;", "env->tlb_flush_mask = 0;", "tb_unlock();", "atomic_mb_set(&VAR_0->pending_tlb_flush, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ] ]
4,162
static void liveness_pass_1(TCGContext *s) { int nb_globals = s->nb_globals; int oi, oi_prev; tcg_la_func_end(s); for (oi = s->gen_op_buf[0].prev; oi != 0; oi = oi_prev) { int i, nb_iargs, nb_oargs; TCGOpcode opc_new, opc_new2; bool have_opc_new2; TCGLifeData arg_life = 0; TCGTemp *arg_ts; TCGOp * const op = &s->gen_op_buf[oi]; TCGOpcode opc = op->opc; const TCGOpDef *def = &tcg_op_defs[opc]; oi_prev = op->prev; switch (opc) { case INDEX_op_call: { int call_flags; nb_oargs = op->callo; nb_iargs = op->calli; call_flags = op->args[nb_oargs + nb_iargs + 1]; /* pure functions can be removed if their result is unused */ if (call_flags & TCG_CALL_NO_SIDE_EFFECTS) { for (i = 0; i < nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state != TS_DEAD) { goto do_not_remove_call; } } goto do_remove; } else { do_not_remove_call: /* output args are dead */ for (i = 0; i < nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } if (arg_ts->state & TS_MEM) { arg_life |= SYNC_ARG << i; } arg_ts->state = TS_DEAD; } if (!(call_flags & (TCG_CALL_NO_WRITE_GLOBALS | TCG_CALL_NO_READ_GLOBALS))) { /* globals should go back to memory */ for (i = 0; i < nb_globals; i++) { s->temps[i].state = TS_DEAD | TS_MEM; } } else if (!(call_flags & TCG_CALL_NO_READ_GLOBALS)) { /* globals should be synced to memory */ for (i = 0; i < nb_globals; i++) { s->temps[i].state |= TS_MEM; } } /* record arguments that die in this helper */ for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts && arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } } /* input arguments are live for preceding opcodes */ for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts) { arg_ts->state &= ~TS_DEAD; } } } } break; case INDEX_op_insn_start: break; case INDEX_op_discard: /* mark the temporary as dead */ arg_temp(op->args[0])->state = TS_DEAD; break; case INDEX_op_add2_i32: opc_new = INDEX_op_add_i32; goto do_addsub2; case INDEX_op_sub2_i32: opc_new = INDEX_op_sub_i32; goto do_addsub2; case INDEX_op_add2_i64: opc_new = INDEX_op_add_i64; goto do_addsub2; case INDEX_op_sub2_i64: opc_new = INDEX_op_sub_i64; do_addsub2: nb_iargs = 4; nb_oargs = 2; /* Test if the high part of the operation is dead, but not the low part. The result can be optimized to a simple add or sub. This happens often for x86_64 guest when the cpu mode is set to 32 bit. */ if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { goto do_remove; } /* Replace the opcode and adjust the args in place, leaving 3 unused args at the end. */ op->opc = opc = opc_new; op->args[1] = op->args[2]; op->args[2] = op->args[4]; /* Fall through and mark the single-word operation live. */ nb_iargs = 2; nb_oargs = 1; } goto do_not_remove; case INDEX_op_mulu2_i32: opc_new = INDEX_op_mul_i32; opc_new2 = INDEX_op_muluh_i32; have_opc_new2 = TCG_TARGET_HAS_muluh_i32; goto do_mul2; case INDEX_op_muls2_i32: opc_new = INDEX_op_mul_i32; opc_new2 = INDEX_op_mulsh_i32; have_opc_new2 = TCG_TARGET_HAS_mulsh_i32; goto do_mul2; case INDEX_op_mulu2_i64: opc_new = INDEX_op_mul_i64; opc_new2 = INDEX_op_muluh_i64; have_opc_new2 = TCG_TARGET_HAS_muluh_i64; goto do_mul2; case INDEX_op_muls2_i64: opc_new = INDEX_op_mul_i64; opc_new2 = INDEX_op_mulsh_i64; have_opc_new2 = TCG_TARGET_HAS_mulsh_i64; goto do_mul2; do_mul2: nb_iargs = 2; nb_oargs = 2; if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { /* Both parts of the operation are dead. */ goto do_remove; } /* The high part of the operation is dead; generate the low. */ op->opc = opc = opc_new; op->args[1] = op->args[2]; op->args[2] = op->args[3]; } else if (arg_temp(op->args[0])->state == TS_DEAD && have_opc_new2) { /* The low part of the operation is dead; generate the high. */ op->opc = opc = opc_new2; op->args[0] = op->args[1]; op->args[1] = op->args[2]; op->args[2] = op->args[3]; } else { goto do_not_remove; } /* Mark the single-word operation live. */ nb_oargs = 1; goto do_not_remove; default: /* XXX: optimize by hardcoding common cases (e.g. triadic ops) */ nb_iargs = def->nb_iargs; nb_oargs = def->nb_oargs; /* Test if the operation can be removed because all its outputs are dead. We assume that nb_oargs == 0 implies side effects */ if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) { for (i = 0; i < nb_oargs; i++) { if (arg_temp(op->args[i])->state != TS_DEAD) { goto do_not_remove; } } do_remove: tcg_op_remove(s, op); } else { do_not_remove: /* output args are dead */ for (i = 0; i < nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } if (arg_ts->state & TS_MEM) { arg_life |= SYNC_ARG << i; } arg_ts->state = TS_DEAD; } /* if end of basic block, update */ if (def->flags & TCG_OPF_BB_END) { tcg_la_bb_end(s); } else if (def->flags & TCG_OPF_SIDE_EFFECTS) { /* globals should be synced to memory */ for (i = 0; i < nb_globals; i++) { s->temps[i].state |= TS_MEM; } } /* record arguments that die in this opcode */ for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } } /* input arguments are live for preceding opcodes */ for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { arg_temp(op->args[i])->state &= ~TS_DEAD; } } break; } op->life = arg_life; } }
true
qemu
15fa08f8451babc88d733bd411d4c94976f9d0f8
static void liveness_pass_1(TCGContext *s) { int nb_globals = s->nb_globals; int oi, oi_prev; tcg_la_func_end(s); for (oi = s->gen_op_buf[0].prev; oi != 0; oi = oi_prev) { int i, nb_iargs, nb_oargs; TCGOpcode opc_new, opc_new2; bool have_opc_new2; TCGLifeData arg_life = 0; TCGTemp *arg_ts; TCGOp * const op = &s->gen_op_buf[oi]; TCGOpcode opc = op->opc; const TCGOpDef *def = &tcg_op_defs[opc]; oi_prev = op->prev; switch (opc) { case INDEX_op_call: { int call_flags; nb_oargs = op->callo; nb_iargs = op->calli; call_flags = op->args[nb_oargs + nb_iargs + 1]; if (call_flags & TCG_CALL_NO_SIDE_EFFECTS) { for (i = 0; i < nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state != TS_DEAD) { goto do_not_remove_call; } } goto do_remove; } else { do_not_remove_call: for (i = 0; i < nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } if (arg_ts->state & TS_MEM) { arg_life |= SYNC_ARG << i; } arg_ts->state = TS_DEAD; } if (!(call_flags & (TCG_CALL_NO_WRITE_GLOBALS | TCG_CALL_NO_READ_GLOBALS))) { for (i = 0; i < nb_globals; i++) { s->temps[i].state = TS_DEAD | TS_MEM; } } else if (!(call_flags & TCG_CALL_NO_READ_GLOBALS)) { for (i = 0; i < nb_globals; i++) { s->temps[i].state |= TS_MEM; } } for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts && arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } } for (i = nb_oargs; i < nb_iargs + nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts) { arg_ts->state &= ~TS_DEAD; } } } } break; case INDEX_op_insn_start: break; case INDEX_op_discard: arg_temp(op->args[0])->state = TS_DEAD; break; case INDEX_op_add2_i32: opc_new = INDEX_op_add_i32; goto do_addsub2; case INDEX_op_sub2_i32: opc_new = INDEX_op_sub_i32; goto do_addsub2; case INDEX_op_add2_i64: opc_new = INDEX_op_add_i64; goto do_addsub2; case INDEX_op_sub2_i64: opc_new = INDEX_op_sub_i64; do_addsub2: nb_iargs = 4; nb_oargs = 2; if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { goto do_remove; } op->opc = opc = opc_new; op->args[1] = op->args[2]; op->args[2] = op->args[4]; nb_iargs = 2; nb_oargs = 1; } goto do_not_remove; case INDEX_op_mulu2_i32: opc_new = INDEX_op_mul_i32; opc_new2 = INDEX_op_muluh_i32; have_opc_new2 = TCG_TARGET_HAS_muluh_i32; goto do_mul2; case INDEX_op_muls2_i32: opc_new = INDEX_op_mul_i32; opc_new2 = INDEX_op_mulsh_i32; have_opc_new2 = TCG_TARGET_HAS_mulsh_i32; goto do_mul2; case INDEX_op_mulu2_i64: opc_new = INDEX_op_mul_i64; opc_new2 = INDEX_op_muluh_i64; have_opc_new2 = TCG_TARGET_HAS_muluh_i64; goto do_mul2; case INDEX_op_muls2_i64: opc_new = INDEX_op_mul_i64; opc_new2 = INDEX_op_mulsh_i64; have_opc_new2 = TCG_TARGET_HAS_mulsh_i64; goto do_mul2; do_mul2: nb_iargs = 2; nb_oargs = 2; if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { goto do_remove; } op->opc = opc = opc_new; op->args[1] = op->args[2]; op->args[2] = op->args[3]; } else if (arg_temp(op->args[0])->state == TS_DEAD && have_opc_new2) { op->opc = opc = opc_new2; op->args[0] = op->args[1]; op->args[1] = op->args[2]; op->args[2] = op->args[3]; } else { goto do_not_remove; } nb_oargs = 1; goto do_not_remove; default: nb_iargs = def->nb_iargs; nb_oargs = def->nb_oargs; if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) { for (i = 0; i < nb_oargs; i++) { if (arg_temp(op->args[i])->state != TS_DEAD) { goto do_not_remove; } } do_remove: tcg_op_remove(s, op); } else { do_not_remove: for (i = 0; i < nb_oargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } if (arg_ts->state & TS_MEM) { arg_life |= SYNC_ARG << i; } arg_ts->state = TS_DEAD; } if (def->flags & TCG_OPF_BB_END) { tcg_la_bb_end(s); } else if (def->flags & TCG_OPF_SIDE_EFFECTS) { for (i = 0; i < nb_globals; i++) { s->temps[i].state |= TS_MEM; } } for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { arg_ts = arg_temp(op->args[i]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << i; } } for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { arg_temp(op->args[i])->state &= ~TS_DEAD; } } break; } op->life = arg_life; } }
{ "code": [ " TCGOp * const op = &s->gen_op_buf[oi];", " int oi, oi_prev;", " for (oi = s->gen_op_buf[0].prev; oi != 0; oi = oi_prev) {", " TCGOp * const op = &s->gen_op_buf[oi];", " oi_prev = op->prev;", " TCGOp * const op = &s->gen_op_buf[oi];" ], "line_no": [ 29, 7, 15, 29, 37, 29 ] }
static void FUNC_0(TCGContext *VAR_0) { int VAR_1 = VAR_0->VAR_1; int VAR_2, VAR_3; tcg_la_func_end(VAR_0); for (VAR_2 = VAR_0->gen_op_buf[0].prev; VAR_2 != 0; VAR_2 = VAR_3) { int VAR_4, VAR_5, VAR_6; TCGOpcode opc_new, opc_new2; bool have_opc_new2; TCGLifeData arg_life = 0; TCGTemp *arg_ts; TCGOp * const op = &VAR_0->gen_op_buf[VAR_2]; TCGOpcode opc = op->opc; const TCGOpDef *VAR_7 = &tcg_op_defs[opc]; VAR_3 = op->prev; switch (opc) { case INDEX_op_call: { int VAR_8; VAR_6 = op->callo; VAR_5 = op->calli; VAR_8 = op->args[VAR_6 + VAR_5 + 1]; if (VAR_8 & TCG_CALL_NO_SIDE_EFFECTS) { for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) { arg_ts = arg_temp(op->args[VAR_4]); if (arg_ts->state != TS_DEAD) { goto do_not_remove_call; } } goto do_remove; } else { do_not_remove_call: for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) { arg_ts = arg_temp(op->args[VAR_4]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << VAR_4; } if (arg_ts->state & TS_MEM) { arg_life |= SYNC_ARG << VAR_4; } arg_ts->state = TS_DEAD; } if (!(VAR_8 & (TCG_CALL_NO_WRITE_GLOBALS | TCG_CALL_NO_READ_GLOBALS))) { for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) { VAR_0->temps[VAR_4].state = TS_DEAD | TS_MEM; } } else if (!(VAR_8 & TCG_CALL_NO_READ_GLOBALS)) { for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) { VAR_0->temps[VAR_4].state |= TS_MEM; } } for (VAR_4 = VAR_6; VAR_4 < VAR_5 + VAR_6; VAR_4++) { arg_ts = arg_temp(op->args[VAR_4]); if (arg_ts && arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << VAR_4; } } for (VAR_4 = VAR_6; VAR_4 < VAR_5 + VAR_6; VAR_4++) { arg_ts = arg_temp(op->args[VAR_4]); if (arg_ts) { arg_ts->state &= ~TS_DEAD; } } } } break; case INDEX_op_insn_start: break; case INDEX_op_discard: arg_temp(op->args[0])->state = TS_DEAD; break; case INDEX_op_add2_i32: opc_new = INDEX_op_add_i32; goto do_addsub2; case INDEX_op_sub2_i32: opc_new = INDEX_op_sub_i32; goto do_addsub2; case INDEX_op_add2_i64: opc_new = INDEX_op_add_i64; goto do_addsub2; case INDEX_op_sub2_i64: opc_new = INDEX_op_sub_i64; do_addsub2: VAR_5 = 4; VAR_6 = 2; if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { goto do_remove; } op->opc = opc = opc_new; op->args[1] = op->args[2]; op->args[2] = op->args[4]; VAR_5 = 2; VAR_6 = 1; } goto do_not_remove; case INDEX_op_mulu2_i32: opc_new = INDEX_op_mul_i32; opc_new2 = INDEX_op_muluh_i32; have_opc_new2 = TCG_TARGET_HAS_muluh_i32; goto do_mul2; case INDEX_op_muls2_i32: opc_new = INDEX_op_mul_i32; opc_new2 = INDEX_op_mulsh_i32; have_opc_new2 = TCG_TARGET_HAS_mulsh_i32; goto do_mul2; case INDEX_op_mulu2_i64: opc_new = INDEX_op_mul_i64; opc_new2 = INDEX_op_muluh_i64; have_opc_new2 = TCG_TARGET_HAS_muluh_i64; goto do_mul2; case INDEX_op_muls2_i64: opc_new = INDEX_op_mul_i64; opc_new2 = INDEX_op_mulsh_i64; have_opc_new2 = TCG_TARGET_HAS_mulsh_i64; goto do_mul2; do_mul2: VAR_5 = 2; VAR_6 = 2; if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { goto do_remove; } op->opc = opc = opc_new; op->args[1] = op->args[2]; op->args[2] = op->args[3]; } else if (arg_temp(op->args[0])->state == TS_DEAD && have_opc_new2) { op->opc = opc = opc_new2; op->args[0] = op->args[1]; op->args[1] = op->args[2]; op->args[2] = op->args[3]; } else { goto do_not_remove; } VAR_6 = 1; goto do_not_remove; default: VAR_5 = VAR_7->VAR_5; VAR_6 = VAR_7->VAR_6; if (!(VAR_7->flags & TCG_OPF_SIDE_EFFECTS) && VAR_6 != 0) { for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) { if (arg_temp(op->args[VAR_4])->state != TS_DEAD) { goto do_not_remove; } } do_remove: tcg_op_remove(VAR_0, op); } else { do_not_remove: for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) { arg_ts = arg_temp(op->args[VAR_4]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << VAR_4; } if (arg_ts->state & TS_MEM) { arg_life |= SYNC_ARG << VAR_4; } arg_ts->state = TS_DEAD; } if (VAR_7->flags & TCG_OPF_BB_END) { tcg_la_bb_end(VAR_0); } else if (VAR_7->flags & TCG_OPF_SIDE_EFFECTS) { for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) { VAR_0->temps[VAR_4].state |= TS_MEM; } } for (VAR_4 = VAR_6; VAR_4 < VAR_6 + VAR_5; VAR_4++) { arg_ts = arg_temp(op->args[VAR_4]); if (arg_ts->state & TS_DEAD) { arg_life |= DEAD_ARG << VAR_4; } } for (VAR_4 = VAR_6; VAR_4 < VAR_6 + VAR_5; VAR_4++) { arg_temp(op->args[VAR_4])->state &= ~TS_DEAD; } } break; } op->life = arg_life; } }
[ "static void FUNC_0(TCGContext *VAR_0)\n{", "int VAR_1 = VAR_0->VAR_1;", "int VAR_2, VAR_3;", "tcg_la_func_end(VAR_0);", "for (VAR_2 = VAR_0->gen_op_buf[0].prev; VAR_2 != 0; VAR_2 = VAR_3) {", "int VAR_4, VAR_5, VAR_6;", "TCGOpcode opc_new, opc_new2;", "bool have_opc_new2;", "TCGLifeData arg_life = 0;", "TCGTemp *arg_ts;", "TCGOp * const op = &VAR_0->gen_op_buf[VAR_2];", "TCGOpcode opc = op->opc;", "const TCGOpDef *VAR_7 = &tcg_op_defs[opc];", "VAR_3 = op->prev;", "switch (opc) {", "case INDEX_op_call:\n{", "int VAR_8;", "VAR_6 = op->callo;", "VAR_5 = op->calli;", "VAR_8 = op->args[VAR_6 + VAR_5 + 1];", "if (VAR_8 & TCG_CALL_NO_SIDE_EFFECTS) {", "for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) {", "arg_ts = arg_temp(op->args[VAR_4]);", "if (arg_ts->state != TS_DEAD) {", "goto do_not_remove_call;", "}", "}", "goto do_remove;", "} else {", "do_not_remove_call:\nfor (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) {", "arg_ts = arg_temp(op->args[VAR_4]);", "if (arg_ts->state & TS_DEAD) {", "arg_life |= DEAD_ARG << VAR_4;", "}", "if (arg_ts->state & TS_MEM) {", "arg_life |= SYNC_ARG << VAR_4;", "}", "arg_ts->state = TS_DEAD;", "}", "if (!(VAR_8 & (TCG_CALL_NO_WRITE_GLOBALS |\nTCG_CALL_NO_READ_GLOBALS))) {", "for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) {", "VAR_0->temps[VAR_4].state = TS_DEAD | TS_MEM;", "}", "} else if (!(VAR_8 & TCG_CALL_NO_READ_GLOBALS)) {", "for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) {", "VAR_0->temps[VAR_4].state |= TS_MEM;", "}", "}", "for (VAR_4 = VAR_6; VAR_4 < VAR_5 + VAR_6; VAR_4++) {", "arg_ts = arg_temp(op->args[VAR_4]);", "if (arg_ts && arg_ts->state & TS_DEAD) {", "arg_life |= DEAD_ARG << VAR_4;", "}", "}", "for (VAR_4 = VAR_6; VAR_4 < VAR_5 + VAR_6; VAR_4++) {", "arg_ts = arg_temp(op->args[VAR_4]);", "if (arg_ts) {", "arg_ts->state &= ~TS_DEAD;", "}", "}", "}", "}", "break;", "case INDEX_op_insn_start:\nbreak;", "case INDEX_op_discard:\narg_temp(op->args[0])->state = TS_DEAD;", "break;", "case INDEX_op_add2_i32:\nopc_new = INDEX_op_add_i32;", "goto do_addsub2;", "case INDEX_op_sub2_i32:\nopc_new = INDEX_op_sub_i32;", "goto do_addsub2;", "case INDEX_op_add2_i64:\nopc_new = INDEX_op_add_i64;", "goto do_addsub2;", "case INDEX_op_sub2_i64:\nopc_new = INDEX_op_sub_i64;", "do_addsub2:\nVAR_5 = 4;", "VAR_6 = 2;", "if (arg_temp(op->args[1])->state == TS_DEAD) {", "if (arg_temp(op->args[0])->state == TS_DEAD) {", "goto do_remove;", "}", "op->opc = opc = opc_new;", "op->args[1] = op->args[2];", "op->args[2] = op->args[4];", "VAR_5 = 2;", "VAR_6 = 1;", "}", "goto do_not_remove;", "case INDEX_op_mulu2_i32:\nopc_new = INDEX_op_mul_i32;", "opc_new2 = INDEX_op_muluh_i32;", "have_opc_new2 = TCG_TARGET_HAS_muluh_i32;", "goto do_mul2;", "case INDEX_op_muls2_i32:\nopc_new = INDEX_op_mul_i32;", "opc_new2 = INDEX_op_mulsh_i32;", "have_opc_new2 = TCG_TARGET_HAS_mulsh_i32;", "goto do_mul2;", "case INDEX_op_mulu2_i64:\nopc_new = INDEX_op_mul_i64;", "opc_new2 = INDEX_op_muluh_i64;", "have_opc_new2 = TCG_TARGET_HAS_muluh_i64;", "goto do_mul2;", "case INDEX_op_muls2_i64:\nopc_new = INDEX_op_mul_i64;", "opc_new2 = INDEX_op_mulsh_i64;", "have_opc_new2 = TCG_TARGET_HAS_mulsh_i64;", "goto do_mul2;", "do_mul2:\nVAR_5 = 2;", "VAR_6 = 2;", "if (arg_temp(op->args[1])->state == TS_DEAD) {", "if (arg_temp(op->args[0])->state == TS_DEAD) {", "goto do_remove;", "}", "op->opc = opc = opc_new;", "op->args[1] = op->args[2];", "op->args[2] = op->args[3];", "} else if (arg_temp(op->args[0])->state == TS_DEAD && have_opc_new2) {", "op->opc = opc = opc_new2;", "op->args[0] = op->args[1];", "op->args[1] = op->args[2];", "op->args[2] = op->args[3];", "} else {", "goto do_not_remove;", "}", "VAR_6 = 1;", "goto do_not_remove;", "default:\nVAR_5 = VAR_7->VAR_5;", "VAR_6 = VAR_7->VAR_6;", "if (!(VAR_7->flags & TCG_OPF_SIDE_EFFECTS) && VAR_6 != 0) {", "for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) {", "if (arg_temp(op->args[VAR_4])->state != TS_DEAD) {", "goto do_not_remove;", "}", "}", "do_remove:\ntcg_op_remove(VAR_0, op);", "} else {", "do_not_remove:\nfor (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) {", "arg_ts = arg_temp(op->args[VAR_4]);", "if (arg_ts->state & TS_DEAD) {", "arg_life |= DEAD_ARG << VAR_4;", "}", "if (arg_ts->state & TS_MEM) {", "arg_life |= SYNC_ARG << VAR_4;", "}", "arg_ts->state = TS_DEAD;", "}", "if (VAR_7->flags & TCG_OPF_BB_END) {", "tcg_la_bb_end(VAR_0);", "} else if (VAR_7->flags & TCG_OPF_SIDE_EFFECTS) {", "for (VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) {", "VAR_0->temps[VAR_4].state |= TS_MEM;", "}", "}", "for (VAR_4 = VAR_6; VAR_4 < VAR_6 + VAR_5; VAR_4++) {", "arg_ts = arg_temp(op->args[VAR_4]);", "if (arg_ts->state & TS_DEAD) {", "arg_life |= DEAD_ARG << VAR_4;", "}", "}", "for (VAR_4 = VAR_6; VAR_4 < VAR_6 + VAR_5; VAR_4++) {", "arg_temp(op->args[VAR_4])->state &= ~TS_DEAD;", "}", "}", "break;", "}", "op->life = arg_life;", "}", "}" ]
[ 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171, 175 ], [ 177 ], [ 181, 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199, 201 ], [ 203, 205 ], [ 207 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 337, 341 ], [ 343 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365, 367 ], [ 369 ], [ 371, 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 399 ], [ 401 ], [ 403 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ] ]
4,163
static uint64_t addrrange_end(AddrRange r) { return r.start + r.size; }
true
qemu
8417cebfda193c7f9ca70be5e308eaa92cf84b94
static uint64_t addrrange_end(AddrRange r) { return r.start + r.size; }
{ "code": [ "static uint64_t addrrange_end(AddrRange r)" ], "line_no": [ 1 ] }
static uint64_t FUNC_0(AddrRange r) { return r.start + r.size; }
[ "static uint64_t FUNC_0(AddrRange r)\n{", "return r.start + r.size;", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
4,164
static void cqueue_free(cqueue *q) { av_free(q->elements); av_free(q); }
true
FFmpeg
70df51112ccc8d281cdb96141f20b3fd8a5b11f8
static void cqueue_free(cqueue *q) { av_free(q->elements); av_free(q); }
{ "code": [ " av_free(q->elements);" ], "line_no": [ 5 ] }
static void FUNC_0(cqueue *VAR_0) { av_free(VAR_0->elements); av_free(VAR_0); }
[ "static void FUNC_0(cqueue *VAR_0)\n{", "av_free(VAR_0->elements);", "av_free(VAR_0);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
4,167
static int alloc_scratch_buffers(H264SliceContext *sl, int linesize) { const H264Context *h = sl->h264; int alloc_size = FFALIGN(FFABS(linesize) + 32, 32); av_fast_malloc(&sl->bipred_scratchpad, &sl->bipred_scratchpad_allocated, 16 * 6 * alloc_size); // edge emu needs blocksize + filter length - 1 // (= 21x21 for h264) av_fast_malloc(&sl->edge_emu_buffer, &sl->edge_emu_buffer_allocated, alloc_size * 2 * 21); av_fast_malloc(&sl->top_borders[0], &sl->top_borders_allocated[0], h->mb_width * 16 * 3 * sizeof(uint8_t) * 2); av_fast_malloc(&sl->top_borders[1], &sl->top_borders_allocated[1], h->mb_width * 16 * 3 * sizeof(uint8_t) * 2); if (!sl->bipred_scratchpad || !sl->edge_emu_buffer || !sl->top_borders[0] || !sl->top_borders[1]) { av_freep(&sl->bipred_scratchpad); av_freep(&sl->edge_emu_buffer); av_freep(&sl->top_borders[0]); av_freep(&sl->top_borders[1]); sl->bipred_scratchpad_allocated = 0; sl->edge_emu_buffer_allocated = 0; sl->top_borders_allocated[0] = 0; sl->top_borders_allocated[1] = 0; return AVERROR(ENOMEM); } return 0; }
true
FFmpeg
6f37226b687f969bcf6e47a4fb5c28a32d107aa3
static int alloc_scratch_buffers(H264SliceContext *sl, int linesize) { const H264Context *h = sl->h264; int alloc_size = FFALIGN(FFABS(linesize) + 32, 32); av_fast_malloc(&sl->bipred_scratchpad, &sl->bipred_scratchpad_allocated, 16 * 6 * alloc_size); av_fast_malloc(&sl->edge_emu_buffer, &sl->edge_emu_buffer_allocated, alloc_size * 2 * 21); av_fast_malloc(&sl->top_borders[0], &sl->top_borders_allocated[0], h->mb_width * 16 * 3 * sizeof(uint8_t) * 2); av_fast_malloc(&sl->top_borders[1], &sl->top_borders_allocated[1], h->mb_width * 16 * 3 * sizeof(uint8_t) * 2); if (!sl->bipred_scratchpad || !sl->edge_emu_buffer || !sl->top_borders[0] || !sl->top_borders[1]) { av_freep(&sl->bipred_scratchpad); av_freep(&sl->edge_emu_buffer); av_freep(&sl->top_borders[0]); av_freep(&sl->top_borders[1]); sl->bipred_scratchpad_allocated = 0; sl->edge_emu_buffer_allocated = 0; sl->top_borders_allocated[0] = 0; sl->top_borders_allocated[1] = 0; return AVERROR(ENOMEM); } return 0; }
{ "code": [ " av_fast_malloc(&sl->top_borders[0], &sl->top_borders_allocated[0],", " av_fast_malloc(&sl->top_borders[1], &sl->top_borders_allocated[1]," ], "line_no": [ 21, 25 ] }
static int FUNC_0(H264SliceContext *VAR_0, int VAR_1) { const H264Context *VAR_2 = VAR_0->h264; int VAR_3 = FFALIGN(FFABS(VAR_1) + 32, 32); av_fast_malloc(&VAR_0->bipred_scratchpad, &VAR_0->bipred_scratchpad_allocated, 16 * 6 * VAR_3); av_fast_malloc(&VAR_0->edge_emu_buffer, &VAR_0->edge_emu_buffer_allocated, VAR_3 * 2 * 21); av_fast_malloc(&VAR_0->top_borders[0], &VAR_0->top_borders_allocated[0], VAR_2->mb_width * 16 * 3 * sizeof(uint8_t) * 2); av_fast_malloc(&VAR_0->top_borders[1], &VAR_0->top_borders_allocated[1], VAR_2->mb_width * 16 * 3 * sizeof(uint8_t) * 2); if (!VAR_0->bipred_scratchpad || !VAR_0->edge_emu_buffer || !VAR_0->top_borders[0] || !VAR_0->top_borders[1]) { av_freep(&VAR_0->bipred_scratchpad); av_freep(&VAR_0->edge_emu_buffer); av_freep(&VAR_0->top_borders[0]); av_freep(&VAR_0->top_borders[1]); VAR_0->bipred_scratchpad_allocated = 0; VAR_0->edge_emu_buffer_allocated = 0; VAR_0->top_borders_allocated[0] = 0; VAR_0->top_borders_allocated[1] = 0; return AVERROR(ENOMEM); } return 0; }
[ "static int FUNC_0(H264SliceContext *VAR_0, int VAR_1)\n{", "const H264Context *VAR_2 = VAR_0->h264;", "int VAR_3 = FFALIGN(FFABS(VAR_1) + 32, 32);", "av_fast_malloc(&VAR_0->bipred_scratchpad, &VAR_0->bipred_scratchpad_allocated, 16 * 6 * VAR_3);", "av_fast_malloc(&VAR_0->edge_emu_buffer, &VAR_0->edge_emu_buffer_allocated, VAR_3 * 2 * 21);", "av_fast_malloc(&VAR_0->top_borders[0], &VAR_0->top_borders_allocated[0],\nVAR_2->mb_width * 16 * 3 * sizeof(uint8_t) * 2);", "av_fast_malloc(&VAR_0->top_borders[1], &VAR_0->top_borders_allocated[1],\nVAR_2->mb_width * 16 * 3 * sizeof(uint8_t) * 2);", "if (!VAR_0->bipred_scratchpad || !VAR_0->edge_emu_buffer ||\n!VAR_0->top_borders[0] || !VAR_0->top_borders[1]) {", "av_freep(&VAR_0->bipred_scratchpad);", "av_freep(&VAR_0->edge_emu_buffer);", "av_freep(&VAR_0->top_borders[0]);", "av_freep(&VAR_0->top_borders[1]);", "VAR_0->bipred_scratchpad_allocated = 0;", "VAR_0->edge_emu_buffer_allocated = 0;", "VAR_0->top_borders_allocated[0] = 0;", "VAR_0->top_borders_allocated[1] = 0;", "return AVERROR(ENOMEM);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ] ]
4,168
static inline void RENAME(nv21ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { RENAME(nvXXtoUV)(dstV, dstU, src1, width); }
true
FFmpeg
c3ab0004ae4dffc32494ae84dd15cfaa909a7884
static inline void RENAME(nv21ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { RENAME(nvXXtoUV)(dstV, dstU, src1, width); }
{ "code": [ " int width, uint32_t *unused)", " int width, uint32_t *unused)" ], "line_no": [ 5, 5 ] }
static inline void FUNC_0(nv21ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { FUNC_0(nvXXtoUV)(dstV, dstU, src1, width); }
[ "static inline void FUNC_0(nv21ToUV)(uint8_t *dstU, uint8_t *dstV,\nconst uint8_t *src1, const uint8_t *src2,\nint width, uint32_t *unused)\n{", "FUNC_0(nvXXtoUV)(dstV, dstU, src1, width);", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ] ]
4,169
static void ehci_advance_periodic_state(EHCIState *ehci) { uint32_t entry; uint32_t list; const int async = 0; // 4.6 switch(ehci_get_state(ehci, async)) { case EST_INACTIVE: if ( !(ehci->frindex & 7) && (ehci->usbcmd & USBCMD_PSE)) { ehci_set_usbsts(ehci, USBSTS_PSS); ehci_set_state(ehci, async, EST_ACTIVE); // No break, fall through to ACTIVE } else break; case EST_ACTIVE: if ( !(ehci->frindex & 7) && !(ehci->usbcmd & USBCMD_PSE)) { ehci_clear_usbsts(ehci, USBSTS_PSS); ehci_set_state(ehci, async, EST_INACTIVE); break; } list = ehci->periodiclistbase & 0xfffff000; /* check that register has been set */ if (list == 0) { break; } list |= ((ehci->frindex & 0x1ff8) >> 1); pci_dma_read(&ehci->dev, list, &entry, sizeof entry); entry = le32_to_cpu(entry); DPRINTF("PERIODIC state adv fr=%d. [%08X] -> %08X\n", ehci->frindex / 8, list, entry); ehci_set_fetch_addr(ehci, async,entry); ehci_set_state(ehci, async, EST_FETCHENTRY); ehci_advance_state(ehci, async); ehci_queues_rip_unused(ehci, async); break; default: /* this should only be due to a developer mistake */ fprintf(stderr, "ehci: Bad periodic state %d. " "Resetting to active\n", ehci->pstate); assert(0); } }
true
qemu
4be23939ab0d7019c7e59a37485b416fbbf0f073
static void ehci_advance_periodic_state(EHCIState *ehci) { uint32_t entry; uint32_t list; const int async = 0; switch(ehci_get_state(ehci, async)) { case EST_INACTIVE: if ( !(ehci->frindex & 7) && (ehci->usbcmd & USBCMD_PSE)) { ehci_set_usbsts(ehci, USBSTS_PSS); ehci_set_state(ehci, async, EST_ACTIVE); } else break; case EST_ACTIVE: if ( !(ehci->frindex & 7) && !(ehci->usbcmd & USBCMD_PSE)) { ehci_clear_usbsts(ehci, USBSTS_PSS); ehci_set_state(ehci, async, EST_INACTIVE); break; } list = ehci->periodiclistbase & 0xfffff000; if (list == 0) { break; } list |= ((ehci->frindex & 0x1ff8) >> 1); pci_dma_read(&ehci->dev, list, &entry, sizeof entry); entry = le32_to_cpu(entry); DPRINTF("PERIODIC state adv fr=%d. [%08X] -> %08X\n", ehci->frindex / 8, list, entry); ehci_set_fetch_addr(ehci, async,entry); ehci_set_state(ehci, async, EST_FETCHENTRY); ehci_advance_state(ehci, async); ehci_queues_rip_unused(ehci, async); break; default: fprintf(stderr, "ehci: Bad periodic state %d. " "Resetting to active\n", ehci->pstate); assert(0); } }
{ "code": [ " break;", " ehci_queues_rip_unused(ehci, async);" ], "line_no": [ 31, 79 ] }
static void FUNC_0(EHCIState *VAR_0) { uint32_t entry; uint32_t list; const int VAR_1 = 0; switch(ehci_get_state(VAR_0, VAR_1)) { case EST_INACTIVE: if ( !(VAR_0->frindex & 7) && (VAR_0->usbcmd & USBCMD_PSE)) { ehci_set_usbsts(VAR_0, USBSTS_PSS); ehci_set_state(VAR_0, VAR_1, EST_ACTIVE); } else break; case EST_ACTIVE: if ( !(VAR_0->frindex & 7) && !(VAR_0->usbcmd & USBCMD_PSE)) { ehci_clear_usbsts(VAR_0, USBSTS_PSS); ehci_set_state(VAR_0, VAR_1, EST_INACTIVE); break; } list = VAR_0->periodiclistbase & 0xfffff000; if (list == 0) { break; } list |= ((VAR_0->frindex & 0x1ff8) >> 1); pci_dma_read(&VAR_0->dev, list, &entry, sizeof entry); entry = le32_to_cpu(entry); DPRINTF("PERIODIC state adv fr=%d. [%08X] -> %08X\n", VAR_0->frindex / 8, list, entry); ehci_set_fetch_addr(VAR_0, VAR_1,entry); ehci_set_state(VAR_0, VAR_1, EST_FETCHENTRY); ehci_advance_state(VAR_0, VAR_1); ehci_queues_rip_unused(VAR_0, VAR_1); break; default: fprintf(stderr, "VAR_0: Bad periodic state %d. " "Resetting to active\n", VAR_0->pstate); assert(0); } }
[ "static void FUNC_0(EHCIState *VAR_0)\n{", "uint32_t entry;", "uint32_t list;", "const int VAR_1 = 0;", "switch(ehci_get_state(VAR_0, VAR_1)) {", "case EST_INACTIVE:\nif ( !(VAR_0->frindex & 7) && (VAR_0->usbcmd & USBCMD_PSE)) {", "ehci_set_usbsts(VAR_0, USBSTS_PSS);", "ehci_set_state(VAR_0, VAR_1, EST_ACTIVE);", "} else", "break;", "case EST_ACTIVE:\nif ( !(VAR_0->frindex & 7) && !(VAR_0->usbcmd & USBCMD_PSE)) {", "ehci_clear_usbsts(VAR_0, USBSTS_PSS);", "ehci_set_state(VAR_0, VAR_1, EST_INACTIVE);", "break;", "}", "list = VAR_0->periodiclistbase & 0xfffff000;", "if (list == 0) {", "break;", "}", "list |= ((VAR_0->frindex & 0x1ff8) >> 1);", "pci_dma_read(&VAR_0->dev, list, &entry, sizeof entry);", "entry = le32_to_cpu(entry);", "DPRINTF(\"PERIODIC state adv fr=%d. [%08X] -> %08X\\n\",\nVAR_0->frindex / 8, list, entry);", "ehci_set_fetch_addr(VAR_0, VAR_1,entry);", "ehci_set_state(VAR_0, VAR_1, EST_FETCHENTRY);", "ehci_advance_state(VAR_0, VAR_1);", "ehci_queues_rip_unused(VAR_0, VAR_1);", "break;", "default:\nfprintf(stderr, \"VAR_0: Bad periodic state %d. \"\n\"Resetting to active\\n\", VAR_0->pstate);", "assert(0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 89, 91 ], [ 93 ], [ 95 ], [ 97 ] ]
4,171
static void close_connection(HTTPContext *c) { HTTPContext **cp, *c1; int i, nb_streams; AVFormatContext *ctx; URLContext *h; AVStream *st; /* remove connection from list */ cp = &first_http_ctx; while ((*cp) != NULL) { c1 = *cp; if (c1 == c) { *cp = c->next; } else { cp = &c1->next; /* remove connection associated resources */ if (c->fd >= 0) close(c->fd); if (c->fmt_in) { /* close each frame parser */ for(i=0;i<c->fmt_in->nb_streams;i++) { st = c->fmt_in->streams[i]; if (st->codec.codec) { avcodec_close(&st->codec); av_close_input_file(c->fmt_in); /* free RTP output streams if any */ nb_streams = 0; if (c->stream) nb_streams = c->stream->nb_streams; for(i=0;i<nb_streams;i++) { ctx = c->rtp_ctx[i]; if (ctx) { av_free(ctx); h = c->rtp_handles[i]; if (h) { url_close(h); if (c->stream) current_bandwidth -= c->stream->bandwidth; av_freep(&c->pb_buffer); av_free(c->buffer); av_free(c); nb_connections--;
true
FFmpeg
87638494cac0e58178a445b2c6436264b3af31e9
static void close_connection(HTTPContext *c) { HTTPContext **cp, *c1; int i, nb_streams; AVFormatContext *ctx; URLContext *h; AVStream *st; cp = &first_http_ctx; while ((*cp) != NULL) { c1 = *cp; if (c1 == c) { *cp = c->next; } else { cp = &c1->next; if (c->fd >= 0) close(c->fd); if (c->fmt_in) { for(i=0;i<c->fmt_in->nb_streams;i++) { st = c->fmt_in->streams[i]; if (st->codec.codec) { avcodec_close(&st->codec); av_close_input_file(c->fmt_in); nb_streams = 0; if (c->stream) nb_streams = c->stream->nb_streams; for(i=0;i<nb_streams;i++) { ctx = c->rtp_ctx[i]; if (ctx) { av_free(ctx); h = c->rtp_handles[i]; if (h) { url_close(h); if (c->stream) current_bandwidth -= c->stream->bandwidth; av_freep(&c->pb_buffer); av_free(c->buffer); av_free(c); nb_connections--;
{ "code": [], "line_no": [] }
static void FUNC_0(HTTPContext *VAR_0) { HTTPContext **cp, *c1; int VAR_1, VAR_2; AVFormatContext *ctx; URLContext *h; AVStream *st; cp = &first_http_ctx; while ((*cp) != NULL) { c1 = *cp; if (c1 == VAR_0) { *cp = VAR_0->next; } else { cp = &c1->next; if (VAR_0->fd >= 0) close(VAR_0->fd); if (VAR_0->fmt_in) { for(VAR_1=0;VAR_1<VAR_0->fmt_in->VAR_2;VAR_1++) { st = VAR_0->fmt_in->streams[VAR_1]; if (st->codec.codec) { avcodec_close(&st->codec); av_close_input_file(VAR_0->fmt_in); VAR_2 = 0; if (VAR_0->stream) VAR_2 = VAR_0->stream->VAR_2; for(VAR_1=0;VAR_1<VAR_2;VAR_1++) { ctx = VAR_0->rtp_ctx[VAR_1]; if (ctx) { av_free(ctx); h = VAR_0->rtp_handles[VAR_1]; if (h) { url_close(h); if (VAR_0->stream) current_bandwidth -= VAR_0->stream->bandwidth; av_freep(&VAR_0->pb_buffer); av_free(VAR_0->buffer); av_free(VAR_0); nb_connections--;
[ "static void FUNC_0(HTTPContext *VAR_0)\n{", "HTTPContext **cp, *c1;", "int VAR_1, VAR_2;", "AVFormatContext *ctx;", "URLContext *h;", "AVStream *st;", "cp = &first_http_ctx;", "while ((*cp) != NULL) {", "c1 = *cp;", "if (c1 == VAR_0) {", "*cp = VAR_0->next;", "} else {", "cp = &c1->next;", "if (VAR_0->fd >= 0)\nclose(VAR_0->fd);", "if (VAR_0->fmt_in) {", "for(VAR_1=0;VAR_1<VAR_0->fmt_in->VAR_2;VAR_1++) {", "st = VAR_0->fmt_in->streams[VAR_1];", "if (st->codec.codec) {", "avcodec_close(&st->codec);", "av_close_input_file(VAR_0->fmt_in);", "VAR_2 = 0;", "if (VAR_0->stream)\nVAR_2 = VAR_0->stream->VAR_2;", "for(VAR_1=0;VAR_1<VAR_2;VAR_1++) {", "ctx = VAR_0->rtp_ctx[VAR_1];", "if (ctx) {", "av_free(ctx);", "h = VAR_0->rtp_handles[VAR_1];", "if (h) {", "url_close(h);", "if (VAR_0->stream)\ncurrent_bandwidth -= VAR_0->stream->bandwidth;", "av_freep(&VAR_0->pb_buffer);", "av_free(VAR_0->buffer);", "av_free(VAR_0);", "nb_connections--;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 17, 18 ], [ 19 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 27 ], [ 28, 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37, 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ] ]