/********************************************************
  Function Name
  -------------
  Void wavelet_dc_encode(Int c)


  Arguments
  ---------
  Int c - color component.
  
  Description
  -----------
  Control program for encode DC information for one 
  color component.

  Functions Called
  ----------------
  None.
  DC_predict()
  put_param()
  cacll_encode()
  
  Return Value
  ------------
  None.

********************************************************/ 
Void CVTCEncoder::wavelet_dc_encode(Int c)
{

  noteDetail("Encoding DC (wavelet_dc_encode)....");
  color=c;

//Added by Sarnoff for error resilience, 3/5/99
#ifdef _DC_PACKET_
  if(!mzte_codec.m_usErrResiDisable)
    acmSGMK.Max_frequency = Bitplane_Max_frequency;
#endif
//End: Added by Sarnoff for error resilience, 3/5/99

  emit_bits((UShort)mzte_codec.m_iMean[color], 8);
  put_param((UShort)mzte_codec.m_iQDC[color], 7);
  /* emit_bits(mzte_codec.Qdc[color], 8); */

  DC_predict(color);
  put_param(-mzte_codec.m_iOffsetDC,7);
  put_param(mzte_codec.m_iMaxDC,7); /* hjlee */
  /* put_param(mzte_codec.m_iMaxDC+mzte_codec.m_iOffsetDC,7); */ /* hjlee */
  //printf("%d %d %d %d\n", mzte_codec.m_iMean[color],mzte_codec.m_iQDC[color],-mzte_codec.m_iOffsetDC,mzte_codec.m_iMaxDC);
  cacll_encode();
  noteDetail("Completed encoding DC.");

}
Esempio n. 2
0
/* Send the id of the given window's X window to seer. */
void write_xwindow_id(GtkWidget* gtk_window) {

	GdkWindow* gdk_window = gtk_window->window;
	GString* xwindow_string = g_string_new(NULL);

	if (gdk_window)
		g_string_printf(xwindow_string, "%lu", GDK_WINDOW_XID(gdk_window));
	else {
		g_warning("Couldn't find an id for the display's window.");
		xwindow_string = g_string_assign(xwindow_string, "0");
	}

	if (!put_param(STDOUT_FILENO, P_WIN_ID, xwindow_string->str)) {
		g_critical("Couldn't write window ID to stdout");
		exit(EXIT_FAILURE);
	}

	g_string_free(xwindow_string, TRUE);
}
Esempio n. 3
0
/* A key has been pressed -- write it to stdout. */
gboolean window_key_press_event(GtkWidget* window, GdkEventKey* event,
		gpointer data) {

	gsize  bytes_written;
	gchar* temp1;
	gchar* temp2;

	gboolean result = TRUE;

	switch (event->keyval) {
		case GDK_Home:
		case GDK_Left:
		case GDK_Up:
		case GDK_Right:
		case GDK_Down:
		case GDK_Page_Up:
		case GDK_Page_Down:
		case GDK_End:
			/* These keys we let the display interpret. */
			result = FALSE;
			break;

		default:
			/* The rest are passed to the terminal. */
			temp1 = g_malloc(2);
			*temp1 = event->keyval;
			*(temp1 + 1) = '\0';

			/* Convert out of utf8. */
			temp2 = g_locale_from_utf8(temp1, -1, NULL, &bytes_written, NULL);

			if (temp2) {
				if (event->state & GDK_CONTROL_MASK) {
					/* Control is being held.  Determine if it's a control
					   key and convert. */
					if (event->keyval >= 'a' && event->keyval <= 'z')
						*temp2 -= 96;
					else if (event->keyval >= '[' && event->keyval <= '_')
						*temp2 -= 64;
					else if (event->keyval == '@' || event->keyval == ' ')
						/* This will go out empty, but vgseer is smart enough
						   to interpret a value length of 0 as a NUL
						   character. */
						*temp2 = '\0';
				}

				if (!put_param(STDOUT_FILENO, P_KEY, temp2)) {
					g_critical("Couldn't write key to stdout");
					exit(EXIT_FAILURE);
				}

				g_free(temp2);
			}
			else
				result = FALSE;

			g_free(temp1);
			break;
	}

	return result;
}