void matchseg_write(FILE * fp, glist_t hyp, char *uttid, char *hdr, lm_t * lm, dict_t * dict, int32 num_frm, int32 * ascale, int32 unnorm) { gnode_t *gn; srch_hyp_t *h; int32 ascr, lscr, scl, hypscale, global_hypscale; int32 i; if (fp == NULL) return; ascr = 0; lscr = 0; scl = 0; hypscale = 0; global_hypscale = 0; for (gn = hyp; gn; gn = gnode_next(gn)) { h = (srch_hyp_t *) gnode_ptr(gn); if (h->sf != h->ef) { /* FSG outputs zero-width hyps */ ascr += h->ascr; lscr += lm ? lm_rawscore(lm, h->lscr) : h->lscr; if (unnorm) global_hypscale += compute_scale(h->sf, h->ef, ascale); } } for (i = 0; i < num_frm; i++) scl += ascale[i]; fprintf(fp, "%s%s S %d T %d A %d L %d", (hdr ? hdr : ""), uttid, scl, ascr + lscr + global_hypscale, ascr + global_hypscale, lscr); for (gn = hyp; gn; gn = gnode_next(gn)) { h = (srch_hyp_t *) gnode_ptr(gn); if (h->sf != h->ef) { /* FSG outputs zero-width hyps */ hypscale = 0; if (unnorm) hypscale += compute_scale(h->sf, h->ef, ascale); fprintf(fp, " %d %d %d %s", h->sf, h->ascr + hypscale, lm ? lm_rawscore(lm, h->lscr) : h->lscr, dict_wordstr(dict, h->id)); } } fprintf(fp, " %d\n", num_frm); fflush(fp); }
coeff_t multi_adag_node::compute_coeff() { if(is_input()) return c; ASSERT(scales.size() == src.size()); ASSERT(src.size() >= 2); coeff_t res = compute_scale(src[0]->c, scales[0]); for(size_t i = 1; i < src.size(); ++i) { res = res + compute_scale(src[i]->c, scales[i]); } return res >> rsh; }
static void bind_output (struct wl_client *client, void *data, guint32 version, guint32 id) { MetaWaylandOutput *wayland_output = data; MetaOutput *output = wayland_output->output; struct wl_resource *resource; guint mode_flags; resource = wl_resource_create (client, &wl_output_interface, MIN (META_WL_OUTPUT_VERSION, version), id); wayland_output->resources = g_list_prepend (wayland_output->resources, resource); wl_resource_set_user_data (resource, wayland_output); wl_resource_set_destructor (resource, output_resource_destroy); meta_verbose ("Binding output %p/%s (%u, %u, %u, %u) x %f\n", output, output->name, output->crtc->rect.x, output->crtc->rect.y, output->crtc->rect.width, output->crtc->rect.height, output->crtc->current_mode->refresh_rate); wl_resource_post_event (resource, WL_OUTPUT_GEOMETRY, (int)output->crtc->rect.x, (int)output->crtc->rect.y, output->width_mm, output->height_mm, /* Cogl values reflect XRandR values, and so does wayland */ output->subpixel_order, output->vendor, output->product, output->crtc->transform); g_assert (output->crtc->current_mode != NULL); mode_flags = WL_OUTPUT_MODE_CURRENT; if (output->crtc->current_mode == output->preferred_mode) mode_flags |= WL_OUTPUT_MODE_PREFERRED; wl_resource_post_event (resource, WL_OUTPUT_MODE, mode_flags, (int)output->crtc->current_mode->width, (int)output->crtc->current_mode->height, (int)output->crtc->current_mode->refresh_rate); output->scale = compute_scale (output); if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) wl_resource_post_event (resource, WL_OUTPUT_SCALE, output->scale); if (version >= WL_OUTPUT_DONE_SINCE_VERSION) wl_resource_post_event (resource, WL_OUTPUT_DONE); }
void tex_output::start_picture(double sc, const position &ll, const position &ur) { upper_left.x = ll.x; upper_left.y = ur.y; scale = compute_scale(sc, ll, ur); height = (ur.y - ll.y)/scale; width = (ur.x - ll.x)/scale; /* The point of \vskip 0pt is to ensure that the vtop gets a height of 0 rather than the height of the hbox; this might be non-zero if text from text attributes lies outside pic's idea of the bounding box of the picture. */ /* \newbox and \newdimen are defined with \outer in plain.tex and can't be used directly in an \if clause. */ printf("\\expandafter\\ifx\\csname %s\\endcsname\\relax\n" " \\csname newbox\\expandafter\\endcsname\\csname %s\\endcsname\n" "\\fi\n" "\\ifx\\graphtemp\\undefined\n" " \\csname newdimen\\endcsname\\graphtemp\n" "\\fi\n" "\\expandafter\\setbox\\csname %s\\endcsname\n" " =\\vtop{\\vskip 0pt\\hbox{%%\n", graphname, graphname, graphname); pen_size = -2.0; }
/* Log hypothesis in detail with word segmentations, acoustic and LM scores */ void log_hyp_detailed(FILE * fp, srch_hyp_t * hypptr, char *uttid, char *LBL, char *lbl, int32 * senscale) { srch_hyp_t *h; int32 scale, ascr, lscr; if (fp == NULL) return; ascr = 0; lscr = 0; if (senscale) { fprintf(fp, "%s:%s> %20s %5s %5s %12s %10s %10s %10s \n", LBL, uttid, "WORD", "SFrm", "EFrm", "AScr(UnNorm)", "LMScore", "AScr+LScr", "AScale"); } else { fprintf(fp, "%s:%s> %20s %5s %5s %12s %10s %10s %10s\n", LBL, uttid, "WORD", "SFrm", "EFrm", "AScr(Norm)", "LMScore", "AScr+LScr", "AScale"); } for (h = hypptr; h; h = h->next) { scale = 0; if (h->id < 0 || (h->sf == h->ef)) continue; if (senscale) scale = compute_scale(h->sf, h->ef, senscale); if (senscale) { fprintf(fp, "%s:%s> %20s %5d %5d %12d %10d %10d %10d\n", lbl, uttid, h->word, h->sf, h->ef, h->ascr + scale, h->lscr, h->ascr + scale + h->lscr, scale); } else { fprintf(fp, "%s:%s> %20s %5d %5d %12d %10d %10d %10d\n", lbl, uttid, h->word, h->sf, h->ef, h->ascr, h->lscr, h->ascr + h->lscr, scale); } ascr += h->ascr; if (senscale) ascr += scale; lscr += h->lscr; } fprintf(fp, "%s:%s> %20s %5s %5s %12d %10d\n", LBL, uttid, "TOTAL", "", "", ascr, lscr); }
static int get_output_scale (MetaMonitorManager *manager, MetaOutput *output) { MetaMonitorManagerKms *manager_kms = META_MONITOR_MANAGER_KMS (manager); int scale = g_settings_get_uint (manager_kms->desktop_settings, "scaling-factor"); if (scale > 0) return scale; else return compute_scale (output); }
coeff_t binary_adag_node::compute_coeff() { if(is_input()) return c; else return (compute_scale(src[0]->c, scales[0]) + compute_scale(src[1]->c, scales[1])) >> rsh; }
void match_detailed(FILE * fp, glist_t hyp, char *uttid, char *LBL, char *lbl, int32 * senscale, dict_t * dict) { int32 ascr, lscr; int32 scl; gnode_t *gn; srch_hyp_t *h; if (fp == NULL) return; ascr = lscr = scl = 0; assert(dict); if (senscale) { fprintf(fp, "%s:%s> %20s %5s %5s %12s %10s %10s %10s\n", LBL, uttid, "WORD", "SFrm", "EFrm", "AScr(UnNorm)", "LMScore", "AScr+LScr", "AScale"); } else { fprintf(fp, "%s:%s> %20s %5s %5s %12s %10s %10s %10s\n", LBL, uttid, "WORD", "SFrm", "EFrm", "AScr(Norm)", "LMScore", "AScr+LScr", "AScale"); } for (gn = hyp; gn; gn = gnode_next(gn)) { h = (srch_hyp_t *) gnode_ptr(gn); if (h->id != dict_finishwid(dict) && h->id != dict_startwid(dict)) { scl = 0; if (h->id < 0 || (h->sf == h->ef)) continue; scl += compute_scale(h->sf, h->ef, senscale); if (senscale) { fprintf(fp, "%s:%s> %20s %5d %5d %12d %10d %10d %10d \n", lbl, uttid, dict_wordstr(dict, h->id), h->sf, h->ef, h->ascr + scl, h->lscr, h->ascr + scl + h->lscr, scl); } else { fprintf(fp, "%s:%s> %20s %5d %5d %12d %10d %10d %10d\n", lbl, uttid, dict_wordstr(dict, h->id), h->sf, h->ef, h->ascr, h->lscr, h->ascr + h->lscr, scl); } ascr += h->ascr; if (senscale) ascr += scl; lscr += h->lscr; } } fprintf(fp, "%s:%s> %20s %5s %5s %12d %10d\n", LBL, uttid, "TOTAL", "", "", ascr, lscr); }