summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp218
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp377
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp3223
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h617
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile1017
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp575
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.h161
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp494
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp995
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp937
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h480
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h36
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp150
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp398
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h33
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp300
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp312
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h35
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp96
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h67
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp85
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp237
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp360
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp85
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib78
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib229
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib324
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm9
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib305
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp1461
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp517
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h155
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp256
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp197
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h110
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp290
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp328
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp375
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp461
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp933
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h128
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp999
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h18
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp468
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h368
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp81
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp1129
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.h265
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp933
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp3761
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h285
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp921
58 files changed, 0 insertions, 26720 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp
deleted file mode 100644
index 87931de7f58..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "video.h"
-#include "dither.h"
-#include "proto.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, 24bit, "$Id$")
-
-/*
- * We'll define the "ConvertColor" macro here to do fixed point arithmetic
- * that'll convert from YCrCb to RGB using:
- * R = L + 1.40200*Cr;
- * G = L - 0.34414*Cb - 0.71414*Cr
- * B = L + 1.77200*Cb;
- *
- * We'll use fixed point by adding two extra bits after the decimal.
- */
-
-#define BITS 8
-#define ONE ((int) 1)
-#define CONST_SCALE (ONE << BITS)
-#define ROUND_FACTOR (ONE << (BITS-1))
-
-/* Macro to convert integer to fixed. */
-#define UP(x) (((int)(x)) << BITS)
-
-/* Macro to convert fixed to integer (with rounding). */
-#define DOWN(x) (((x) + ROUND_FACTOR) >> BITS)
-
-/* Macro to convert a float to a fixed */
-#define FIX(x) ((int) ((x)*CONST_SCALE + 0.5))
-
-#define CLAMP(ll,x,ul) ( ((x)<(ll)) ?(ll):( ((x)>(ul)) ?(ul):(x)))
-
-static int *Cb_r_tab, *Cr_g_tab, *Cb_g_tab, *Cr_b_tab;
-
-/*
- *--------------------------------------------------------------
- *
- * InitColorDither --
- *
- * To get rid of the multiply and other conversions in color
- * dither, we use a lookup table.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The lookup tables are initialized.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitColorDither()
-{
- int CR, CB, i;
-
- Cr_b_tab = (int *)ACE_OS::malloc(256*sizeof(int));
- Cr_g_tab = (int *)ACE_OS::malloc(256*sizeof(int));
- Cb_g_tab = (int *)ACE_OS::malloc(256*sizeof(int));
- Cb_r_tab = (int *)ACE_OS::malloc(256*sizeof(int));
-
- for (i=0; i<256; i++) {
- CB = CR = i;
-
- CB -= 128; CR -= 128;
-
- Cb_r_tab[i] = FIX(1.40200) * CB;
- Cr_g_tab[i] = -FIX(0.34414) * CR;
- Cb_g_tab[i] = -FIX(0.71414) * CB;
- Cr_b_tab[i] = FIX(1.77200) * CR;
- }
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * ColorDitherImage --
- *
- * Converts image into 24 bit color.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-ColorDitherImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int rows, int cols)
-{
- int L, CR, CB;
- unsigned int *row1, *row2;
- unsigned char *lum2;
- int x, y;
- unsigned int r, b, g;
- int cb_r;
- int cr_g;
- int cb_g;
- int cr_b;
-
- row1 = (unsigned int *)out;
- row2 = row1 + cols;
- lum2 = lum + cols;
- for (y=0; y<rows; y+=2) {
- for (x=0; x<cols; x+=2) {
- int R, G, B;
-
- CR = *cr++;
- CB = *cb++;
- cb_r = Cb_r_tab[CB];
- cr_g = Cr_g_tab[CR];
- cb_g = Cb_g_tab[CB];
- cr_b = Cr_b_tab[CR];
-
- L = *lum++;
- L = UP(L);
- R = L + cb_r;
- G = L + cr_g + cb_g;
- B = L + cr_b;
-#ifndef LITTLE_ENDIAN
- r = CLAMP(0,R,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS;
-#else
- b = CLAMP(0,B,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS;
-#endif
- *row1++ = r | g | b;
-
- L = *lum++;
- L = UP(L);
- R = L + cb_r;
- G = L + cr_g + cb_g;
- B = L + cr_b;
-#ifndef LITTLE_ENDIAN
- r = CLAMP(0,R,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS;
-#else
- b = CLAMP(0,B,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS;
-#endif
- *row1++ = r | g | b;
-
- /*
- * Now, do second row.
- */
- L = *lum2++;
- L = UP(L);
- R = L + cb_r;
- G = L + cr_g + cb_g;
- B = L + cr_b;
-#ifndef LITTLE_ENDIAN
- r = CLAMP(0,R,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS;
-#else
- b = CLAMP(0,B,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS;
-#endif
- *row2++ = r | g | b;
-
- L = *lum2++;
- L = UP(L);
- R = L + cb_r;
- G = L + cr_g + cb_g;
- B = L + cr_b;
-#ifndef LITTLE_ENDIAN
- r = CLAMP(0,R,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS;
-#else
- b = CLAMP(0,B,UP(255)) >> BITS;
- g = CLAMP(0,G,UP(255)) & 0xff00;
- r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS;
-#endif
- *row2++ = r | g | b;
- }
- lum += cols;
- lum2 += cols;
- row1 += cols;
- row2 += cols;
- }
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp
deleted file mode 100644
index 06bf6ab7fac..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp
+++ /dev/null
@@ -1,377 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include "video.h"
-#include "dither.h"
-#include "proto.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, 2x2, "$Id$")
-
-#define RAND_ERR_RANGE 7
-#define RAND_ERR_SUBVAL 3
-
-/* Array containing actual pixel values for each possible 2x2 dither pattern. */
-
-static unsigned char *dith_a;
-
-/* Arrays mapping lum, cr, and cb values to portions of dither pattern code.
- The addtion of one value from each array yields a valid dither pattern
- code.
-*/
-
-static int lval_a[256+RAND_ERR_RANGE-1];
-static int rval_a[256+RAND_ERR_RANGE-1];
-static int bval_a[256+RAND_ERR_RANGE-1];
-
-/* Range of possible dither patterns in each channel. */
-
-#define L_DITH_RANGE (((LUM_RANGE-1)*4)+1)
-#define CR_DITH_RANGE (((CR_RANGE-1)*4)+1)
-#define CB_DITH_RANGE (((CB_RANGE-1)*4)+1)
-
-/* Arrays of random error terms added to break up contours. */
-
-static int *randval_a;
-static int **randptr_a;
-
-
-/*
- *--------------------------------------------------------------
- *
- * Init2x2Dither--
- *
- * Initializes structures used for 2x2 dithering.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-Init2x2Dither()
-{
- unsigned char *dith_ca;
- int numcodes;
- int l_range, cr_range, cb_range;
- int p1, p2, p3, p4;
- int l_dith, cr_dith, cb_dith;
- int big_part, small_part;
- int i, j;
-
- l_range = L_DITH_RANGE;
- cr_range = CR_DITH_RANGE;
- cb_range = CB_DITH_RANGE;
-
- numcodes = l_range * cr_range * cb_range;
-
- dith_a = (unsigned char *) ACE_OS::malloc(numcodes*4);
-
- dith_ca = dith_a;
-
- for (i=0; i<numcodes; i++) {
- l_dith = i % l_range;
-
- big_part = l_dith / 4;
- small_part = l_dith % 4;
-
- p1 = big_part + ((small_part > 0) ? 1 : 0);
- p2 = big_part + ((small_part > 2) ? 1 : 0);
- p3 = big_part;
- p4 = big_part + ((small_part > 1) ? 1 : 0);
-
- p1 *= CR_RANGE * CB_RANGE;
- p2 *= CR_RANGE * CB_RANGE;
- p3 *= CR_RANGE * CB_RANGE;
- p4 *= CR_RANGE * CB_RANGE;
-
- cr_dith = (i/l_range) % cr_range;
-
- big_part = cr_dith / 4;
- small_part = cr_dith % 4;
-
- p1 += (big_part + ((small_part > 0) ? 1 : 0))*CB_RANGE;
- p2 += (big_part + ((small_part > 2) ? 1 : 0))*CB_RANGE;
- p3 += (big_part)*CB_RANGE;
- p4 += (big_part + ((small_part > 1) ? 1 : 0))*CB_RANGE;
-
- cb_dith = (i/(cr_range*l_range)) % cb_range;
-
- big_part = cb_dith / 4;
- small_part = cb_dith % 4;
-
- p1 += (big_part + ((small_part > 0) ? 1 : 0));
- p2 += (big_part + ((small_part > 2) ? 1 : 0));
- p3 += (big_part);
- p4 += (big_part + ((small_part > 1) ? 1 : 0));
-
- *dith_ca++ = p1;
- *dith_ca++ = p2;
- *dith_ca++ = p3;
- *dith_ca++ = p4;
- }
-
- for (i=RAND_ERR_SUBVAL; i<256+RAND_ERR_SUBVAL; i++) {
- j = i-RAND_ERR_SUBVAL;
- lval_a[i] = (j * L_DITH_RANGE)/256;
- rval_a[i] = (j * CR_DITH_RANGE)/256;
- bval_a[i] = (j * CB_DITH_RANGE)/256;
-
- bval_a[i] *= CR_DITH_RANGE * L_DITH_RANGE * 4;
- rval_a[i] *= L_DITH_RANGE * 4;
- lval_a[i] *= 4;
- }
-
- for (i=0; i<RAND_ERR_SUBVAL; i++) {
- lval_a[i] = lval_a[RAND_ERR_SUBVAL];
- rval_a[i] = rval_a[RAND_ERR_SUBVAL];
- bval_a[i] = bval_a[RAND_ERR_SUBVAL];
- }
-
- for(i=256+RAND_ERR_SUBVAL; i<256+RAND_ERR_RANGE-1; i++) {
- lval_a[i] = lval_a[255+RAND_ERR_SUBVAL];
- rval_a[i] = rval_a[255+RAND_ERR_SUBVAL];
- bval_a[i] = bval_a[255+RAND_ERR_SUBVAL];
- }
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * RandInit --
- *
- * Initializes the random values used for 2x2 dithering.
- *
- * Results:
- * randval_a filled with random values.
- * randptr_a filled with random pointers to random value arrays.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void RandInit(int h, int w)
-{
- int i;
-
- randval_a = (int *) ACE_OS::malloc(w*5*sizeof(int));
- randptr_a = (int **) ACE_OS::malloc(h*sizeof(int *));
-
-#ifdef NO_LRAND48
- for (i=0; i<w*5; i++) {
- long int random();
-
- randval_a[i] = random() % RAND_ERR_RANGE;
- }
-
- for (i=0; i<h; i++) {
- long int random();
-
- randptr_a[i] = randval_a + (random() % (w*2));
- }
-#else /* NO_LRAND48 */
-
- for (i=0; i<w*5; i++) {
-
- randval_a[i] = lrand48() % RAND_ERR_RANGE;
- }
-
- for (i=0; i<h; i++) {
-
- randptr_a[i] = randval_a + (lrand48() % (w*2));
- }
-#endif
-
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * PostInit2x2Dither--
- *
- * Remaps color numbers in dither patterns to actual pixel
- * values allocated by the X server.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-PostInit2x2Dither()
-{
- unsigned char *dith_ca;
- int i;
-
- dith_ca = dith_a;
-
- for (i=0; i < (L_DITH_RANGE * CR_DITH_RANGE * CB_DITH_RANGE); i++) {
-
- *dith_ca = pixel[*dith_ca];
- dith_ca++;
- *dith_ca = pixel[*dith_ca];
- dith_ca++;
- *dith_ca = pixel[*dith_ca];
- dith_ca++;
- *dith_ca = pixel[*dith_ca];
- dith_ca++;
- }
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * Twox2DitherImage --
- *
- * Dithers lum, cr, and cb channels togethor using predefined
- * and computed 2x2 dither patterns. Each possible combination of
- * lum, cr, and cb values combines to point to a particular dither
- * pattern (2x2) which is used to represent the pixel. This assumes
- * That the display plane is 4 times larger than the lumianance
- * plane.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-Twox2DitherImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- int i, j;
- unsigned short *o1, *o2, *o3, *o4;
- unsigned char *l1, *l2, *base;
- unsigned char B, R;
- unsigned short *dith_ca;
- int big_adv = 3*w;
- int b_val, r_val, l_val;
- int *randvalptr;
- int randval;
- static int first = 1;
-
- if (first) {
- RandInit(h, w);
- first = 0;
- }
-
- o1 = (unsigned short *)out;
- o2 = (unsigned short *)(out+(2*w));
- o3 = (unsigned short *)(out+(4*w));
- o4 = (unsigned short *)(out+(6*w));
- l1 = lum;
- l2 = lum+w;
-
- for (i=0; i<h; i+=2) {
- for(j=0; j<w; j+= 4) {
-
- B = cb[0];
- b_val = bval_a[B];
- R = cr[0];
- r_val = rval_a[R];
- base = dith_a + b_val + r_val;
-
- l_val = lval_a[l1[0]];
- dith_ca = (unsigned short *)(base + l_val);
- o1[0] = dith_ca[0];
- o2[0] = dith_ca[1];
-
- l_val = lval_a[l1[1]];
- dith_ca = (unsigned short *)(base + l_val);
- o1[1] = dith_ca[0];
- o2[1] = dith_ca[1];
-
- l_val = lval_a[l2[0]];
- dith_ca = (unsigned short *)(base + l_val);
- o3[0] = dith_ca[0];
- o4[0] = dith_ca[1];
-
- l_val = lval_a[l2[1]];
- dith_ca = (unsigned short *)(base + l_val);
- o3[1] = dith_ca[0];
- o4[1] = dith_ca[1];
-
- B = cb[1];
- b_val = bval_a[B];
- R = cr[1];
- r_val = rval_a[R];
- base = dith_a + b_val + r_val;
-
- l_val = lval_a[l1[2]];
- dith_ca = (unsigned short *)(base + l_val);
- o1[2] = dith_ca[0];
- o2[2] = dith_ca[1];
-
- l_val = lval_a[l1[3]];
- dith_ca = (unsigned short *)(base + l_val);
- o1[3] = dith_ca[0];
- o2[3] = dith_ca[1];
-
- l_val = lval_a[l2[2]];
- dith_ca = (unsigned short *)(base + l_val);
- o3[2] = dith_ca[0];
- o4[2] = dith_ca[1];
-
- l_val = lval_a[l2[3]];
- dith_ca = (unsigned short *)(base + l_val);
- o3[3] = dith_ca[0];
- o4[3] = dith_ca[1];
-
- o1 += 4;
- o2 += 4;
- o3 += 4;
- o4 += 4;
- l1 += 4;
- l2 += 4;
- cb += 2;
- cr += 2;
- }
-
- l1 += w;
- l2 += w;
- o1 += big_adv;
- o2 += big_adv;
- o3 += big_adv;
- o4 += big_adv;
- }
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
deleted file mode 100644
index bc7bfe20e15..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
+++ /dev/null
@@ -1,3223 +0,0 @@
-// $Id$
-
-#include "Command_Handler.h"
-#include "ctr.cpp"
-
-ACE_RCSID(mpeg_client, Command_Handler, "$Id$")
-
- static int temp_argc = 5;
-static char *temp_argv [] = {"Command_Handler",
- "-ORBobjrefstyle",
- "url",
- "-ORBport",
- "0"
- };
-
-Command_Handler::Command_Handler (ACE_HANDLE command_handle)
- :command_suspended_ (UNSUSPENDED),
- busy_ (0),
- video_data_handle_ (-1),
- audio_data_handle_ (-1),
- command_handle_ (command_handle),
- video_control_ (0),
- video_reactive_strategy_ (0),
- video_client_mmdevice_ (0),
- video_streamctrl_ (0),
- audio_control_ (0),
- audio_reactive_strategy_ (0),
- audio_client_mmdevice_ (0),
- audio_streamctrl_ (0),
- receiver_ (this),
- data_host_ (0),
- client_sig_handler_ (this),
- notification_handler_ (this)
-{
-}
-
-Command_Handler::~Command_Handler (void)
-{
- this->remove_handlers ();
- if (ACE_OS::getpid () == CTRpid)
- ::remove_all_semaphores ();
-}
-
-int
-Command_Handler::parse_args (int argc,char **argv)
-{
- ACE_Get_Opt get_opts (argc,argv,"h:");
- int c;
-
- while ((c= get_opts ()) != -1)
- switch (c)
- {
- case 'h':
- this->data_host_ = ACE_OS::strdup (get_opts.optarg);
- ACE_DEBUG ((LM_DEBUG,"data_host is %s\n",this->data_host_));
- break;
- case '?':
- default:
- ACE_ERROR_RETURN ((LM_ERROR,"Unknown argument %c\n",c),-1);
- }
- return 0;
-}
-
-TAO_ORB_Manager *
-Command_Handler::orb_manager (void)
-{
- return &this->orb_manager_;
-}
-
-void
-Command_Handler::wait_for_display (Suspended reason)
-{
- this->command_suspended_ = reason;
- TAO_ORB_Core_instance ()->reactor ()->suspend_handler (this->command_handle_);
-}
-
-// initialize the command handler.
-
-int
-Command_Handler::init (int argc,
- char *argv[])
-{
- this->argc_ = temp_argc;
- this->argv_ = temp_argv;
-
- // Increase the debug_level so that we can see the output
- this->parse_args (argc, argv);
- TAO_debug_level++;
- CORBA::String_var ior;
- TAO_TRY
- {
- this->orb_manager_.init_child_poa (this->argc_,
- this->argv_,
- "child_poa",
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- // activate the client video mmdevice under the child poa.
- ior = this->orb_manager_.activate (&this->receiver_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Initialize the naming services
- if (my_name_client_.init (orb_manager_.orb ()) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to initialize "
- "the TAO_Naming_Client. \n"),
- -1);
-
- char receiver_file[BUFSIZ];
-
- ACE_OS::sprintf (receiver_file,
- "/tmp/receiver_ior.%d",
- getuid ());
- // print the ior of the receiver to a file
- FILE *fp = ACE_OS::fopen (receiver_file,"w");
- if (fp != 0)
- {
- ACE_OS::fprintf (fp,"%s",ior.in ());
- ACE_OS::fclose (fp);
- }
-
- // initialize the client signal handler.
- if (this->client_sig_handler_.register_handler () < 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) register_handler for sig_handler failed\n"),
- -1);
-
- if (TAO_ORB_Core_instance ()->reactor ()->register_handler (&this->notification_handler_,
- ACE_Event_Handler::READ_MASK) < 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) register_handler for notification handler failed\n"),
- -1);
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Command_Handler::init");
- return -1;
- }
- TAO_ENDTRY;
- return 0;
-}
-
-// Runs the ORB event loop
-int
-Command_Handler::run (void)
-{
- int result;
- TAO_TRY
- {
- result = this->orb_manager_.run (TAO_TRY_ENV);
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("orb:run ()");
- return -1;
- }
- TAO_ENDTRY;
- return result;
-}
-
-
-int
-Command_Handler::handle_timeout (const ACE_Time_Value &,
- const void *arg)
-{
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t)Command_Handler::handle_timeout called \n"));
- return 0;
-}
-
-
-int
-Command_Handler::resolve_audio_reference (void)
-{
- TAO_TRY
- {
- if (this->audio_mmdevice_ior_.in ()!=0)
- {
- CORBA::Object_var mmdevice_obj = this->orb_manager_.orb ()->string_to_object (this->audio_mmdevice_ior_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (CORBA::is_nil (mmdevice_obj.in ()) == 0)
- {
- this->audio_server_mmdevice_ = AVStreams::MMDevice::_narrow (mmdevice_obj.in (),
- TAO_TRY_ENV);
- }
- this->audio_mmdevice_ior_ = (char *)0;
- return 0;
- }
-
- CosNaming::Name audio_server_mmdevice_name (1);
-
- audio_server_mmdevice_name.length (1);
- audio_server_mmdevice_name [0].id = CORBA::string_dup ("Audio_Server_MMDevice");
- CORBA::Object_var audio_server_mmdevice_obj =
- this->my_name_client_->resolve (audio_server_mmdevice_name,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- this->audio_server_mmdevice_ =
- AVStreams::MMDevice::_narrow (audio_server_mmdevice_obj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (CORBA::is_nil (this->audio_server_mmdevice_.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " could not resolve Audio_Server_Mmdevice in Naming service\n"),
- -1);
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Audio_MMDevice successfully resolved: %s\n",
- this->orb_manager_.orb ()->object_to_string (this->audio_server_mmdevice_.in (),
- TAO_TRY_ENV)));
- TAO_CHECK_ENV;
-
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Command_Handler::resolve_audio_reference");
- return -1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-int
-Command_Handler::resolve_video_reference (void)
-{
- TAO_TRY
- {
- if (this->video_mmdevice_ior_.in ()!= 0)
- {
- CORBA::Object_var mmdevice_obj = this->orb_manager_.orb ()->string_to_object (this->video_mmdevice_ior_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (CORBA::is_nil (mmdevice_obj.in ()) == 0)
- {
- this->video_server_mmdevice_ = AVStreams::MMDevice::_narrow (mmdevice_obj.in (),
- TAO_TRY_ENV);
- }
- this->video_mmdevice_ior_ = (char *) 0;
- return 0;
- }
- CosNaming::Name video_server_mmdevice_name (1);
-
- video_server_mmdevice_name.length (1);
- video_server_mmdevice_name [0].id = CORBA::string_dup ("Video_Server_MMDevice");
- CORBA::Object_var video_server_mmdevice_obj =
- this->my_name_client_->resolve (video_server_mmdevice_name,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- this->video_server_mmdevice_ =
- AVStreams::MMDevice::_narrow (video_server_mmdevice_obj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (CORBA::is_nil (this->video_server_mmdevice_.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " could not resolve Video_Server_Mmdevice in Naming service\n"),
- -1);
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Video_MMDevice successfully resolved: %s\n",
- this->orb_manager_.orb ()->object_to_string (this->video_server_mmdevice_.in (),
- TAO_TRY_ENV)));
- TAO_CHECK_ENV;
-
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Command_Handler::resolve_video_reference");
- return -1;
- }
- TAO_ENDTRY;
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) MMDevice successfully resolved.\n"));
- return 0;
-}
-
-ACE_HANDLE
-Command_Handler::get_handle (void) const
-{
- return this->command_handle_;
-}
-
-// handle the command sent to us by the GUI process
-// this is a reactor callback method
-int
-Command_Handler::handle_input (ACE_HANDLE fd)
-{
- unsigned char cmd;
- int val;
-
- // ACE_DEBUG ((LM_DEBUG, "handle_input, fd: %d\n", fd));
-
- if (!(this->busy_))
- {
- // Weird hack coming up:
- if (fd == cmdSocket)
- {
- val = OurCmdRead ((char*)&cmd, 1);
- this->busy_ = 1;
- this->client_sig_handler_.TimerProcessing ();
- }
- // ACE_DEBUG ((LM_DEBUG, "val: %d, cmd: %d\n", val, cmd));
- // if we get an interrupt while reading we go back to the event loop
- if (val == 1)
- {
- this->busy_ = 0;
- return 0;
- }
-
- // fprintf(stderr, "CTR: cmd received - %d\n", cmd);
- TAO_TRY
- {
- switch (cmd)
- {
- case CmdINIT:
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) command_handler:CmdINIT received\n"));
- if (this->init_av () == -1)
- {
- this->busy_ = 0;
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) init_av failed\n"),0);
- }
- // cerr << "init_av done\n";
- break;
- case CmdSTOP:
- this->stop();
- break;
- case CmdFF:
- this->fast_forward ();
- break;
- case CmdFB:
- this->fast_backward ();
- break;
- case CmdSTEP:
- this->step ();
- break;
- case CmdPLAY:
- if (this->play (0,
- TAO_TRY_ENV) < 0)
- {
- this->busy_ = 0;
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)play failed\n"),0);
- }
- TAO_CHECK_ENV;
- break;
- case CmdPOSITION:
- this->position ();
- break;
- case CmdPOSITIONrelease:
- this->position_release ();
- break;
- case CmdVOLUME:
- this->volume ();
- break;
- case CmdBALANCE:
- this->balance ();
- break;
- case CmdSPEED:
- this->speed ();
- break;
- case CmdLOOPenable:
- {
- shared->loopBack = 1;
- break;
- }
- case CmdLOOPdisable:
- {
- shared->loopBack = 0;
- break;
- }
- default:
- fprintf(stderr, "CTR: unexpected command from UI: cmd = %d.\n", cmd);
- ACE_OS::exit (1);
- break;
- }
- this->busy_ = 0;
- // unset the busy flag,done with processing the command.
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Command_Handler::handle_input ()");
- return 0;
- }
- TAO_ENDTRY;
- }
- return 0;
-}
-
-int
-Command_Handler::init_av (void)
-{
- cerr << "inside init_av \n";
- int i, j;
-
- /* try to stop and close previous playing */
- if (audioSocket >= 0 || videoSocket >= 0)
- {
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- // this may have to be taken care of afterwards.
- unsigned char tmp = CmdCLOSE;
- int result =
- this->stop_playing();
- if (result < 0)
- return result;
-
- if (audioSocket >= 0)
- {
- if (ABpid > 0) {
- ACE_DEBUG ((LM_DEBUG,"killing the abprocess\n"));
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (asp[0],&message,BUFSIZ);
- ABpid = -1;
- }
- usleep(10000);
- }
- if (videoSocket >= 0)
- {
- if (VBpid > 0) {
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (vsp[0],&message,BUFSIZ);
- VBpid = -1;
- }
- usleep(10000);
-
- videoSocket = -1;
- while ((!vbuffer->VBbufEmpty()) || !VDbufEmpty()) {
- while (VDpeekMsg() != NULL) {
- VDreclaimMsg(VDgetMsg());
- }
- usleep(10000);
- }
- usleep(10000);
- }
- }
- this->close ();
-
- int result;
- /* read in video/audio files */
- // set the vf and af to 0 , very important.
- vf [0]= 0;
- af [0]=0;
-
- NewCmd(CmdINIT);
-
- i = 0;
- result = OurCmdRead((char*)&i, 4);
- result = OurCmdRead(vf, i);
- vf[i] = 0;
- result = OurCmdRead((char*)&i, 4);
- result = OurCmdRead(af, i);
- af[i] = 0;
- /*
- fprintf(stderr, "INIT: vh-%s, vf-%s, ah-%s, af-%s\n", vh, vf, ah, af);
- */
-
- shared->live = 0;
- shared->audioMaxPktSize = !shared->config.audioConn;
- shared->videoMaxPktSize = !shared->config.videoConn;
-
- if (af[0] != 0)
- {
- int result;
- if ((result =init_audio_channel(af)) > 0)
- return result;
- else if (result < 0)
- {
- audioSocket = -1;
- shared->totalSamples = 0;
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Initialized audio\n"));
- shared->nextSample = 0;
- if (shared->config.maxSPS < shared->audioPara.samplesPerSecond)
- shared->config.maxSPS = shared->audioPara.samplesPerSecond;
- }
- }
- else
- {
- shared->totalSamples = 0;
- audioSocket = -1;
- }
- if (vf[0] != 0)
- {
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Initializing video\n"));
- if (this->init_video_channel(vf) > 0)
- return result;
- else if (result < 0)
- {
- shared->totalFrames = 0; /* disable video channel */
- videoSocket = -1;
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "%s %d\n",
- __FILE__,__LINE__));
- shared->nextFrame = 1;
- shared->nextGroup = 0;
- shared->currentFrame = shared->currentGroup = shared->currentDisplay = 0;
- if (shared->config.maxFPS < shared->framesPerSecond)
- shared->config.maxFPS = shared->framesPerSecond;
- }
- }
- else
- {
- videoSocket = -1;
- shared->totalFrames = 0; /* disable video channel */
- }
- if (audioSocket < 0 && videoSocket < 0) /* none of video/audio channels is setup */
- {
- unsigned char tmp = CmdFAIL;
- CmdWrite(&tmp, 1);
- /*
- fprintf(stderr, "CTR initialization failed.\n");
- */
- return -1;
- }
- else
- {
- unsigned char tmp = CmdDONE;
- set_speed();
- if (videoSocket >= 0)
- this->wait_for_display (INIT);
- }
- cerr << "returning from init_av \n";
- return 0;
-}
-
-int
-Command_Handler::init_java_av (char *audio_ior,
- char *video_ior,
- char *audio_file,
- char *video_file)
-{
- if (audio_file != 0)
- ACE_DEBUG ((LM_DEBUG,"%s\n",audio_file));
- if (video_file != 0)
- ACE_DEBUG ((LM_DEBUG,"%s\n",video_file));
- int j;
- this->audio_mmdevice_ior_ = audio_ior;
- this->video_mmdevice_ior_ = video_ior;
-
- /* try to stop and close previous playing */
- if (audioSocket >= 0 || videoSocket >= 0)
- {
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- // this may have to be taken care of afterwards.
- unsigned char tmp = CmdCLOSE;
- int result =
- this->stop_playing();
- if (result < 0)
- ACE_ERROR_RETURN ((LM_ERROR,"stop_playing failed\n"),result);
-
- if (audioSocket >= 0)
- {
- if (ABpid > 0) {
- ACE_DEBUG ((LM_DEBUG,"Killing AB Process\n"));
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (asp[0],&message,BUFSIZ);
- ABpid = -1;
- }
- usleep(10000);
- }
-
- if (videoSocket >= 0)
- {
- if (VBpid > 0) {
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (vsp[0],&message,BUFSIZ);
- VBpid = -1;
- }
- usleep(10000);
-
- videoSocket = -1;
- while ((!vbuffer->VBbufEmpty()) || !VDbufEmpty()) {
- while (VDpeekMsg() != NULL) {
- VDreclaimMsg(VDgetMsg());
- }
- usleep(10000);
- }
- usleep(10000);
- }
- }
- this->close ();
-
- int result;
- NewCmd(CmdINIT);
-
- shared->live = 0;
- shared->audioMaxPktSize = !shared->config.audioConn;
- shared->videoMaxPktSize = !shared->config.videoConn;
-
- if (audio_file!= 0)
- {
- if (init_audio_channel(audio_file))
- {
- audioSocket = -1;
- shared->totalSamples = 0;
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Initialized audio\n"));
- shared->nextSample = 0;
- if (shared->config.maxSPS < shared->audioPara.samplesPerSecond)
- shared->config.maxSPS = shared->audioPara.samplesPerSecond;
- }
- }
- else
- {
- shared->totalSamples = 0;
- audioSocket = -1;
- }
- if (video_file!= 0)
- {
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Initializing video\n"));
- if (this->init_video_channel(video_file))
- {
- shared->totalFrames = 0; /* disable video channel */
- videoSocket = -1;
- }
- else
- {
- ACE_DEBUG ((LM_DEBUG,
- "%s %d\n",
- __FILE__,__LINE__));
- shared->nextFrame = 1;
- shared->nextGroup = 0;
- shared->currentFrame = shared->currentGroup = shared->currentDisplay = 0;
- if (shared->config.maxFPS < shared->framesPerSecond)
- shared->config.maxFPS = shared->framesPerSecond;
- }
- }
- else
- {
- videoSocket = -1;
- shared->totalFrames = 0; /* disable video channel */
- }
- if (audioSocket < 0 && videoSocket < 0) /* none of video/audio channels is setup */
- {
- unsigned char tmp = CmdFAIL;
- CmdWrite(&tmp, 1);
-
- fprintf(stderr, "CTR initialization failed.\n");
-
- return -1;
- }
- else
- {
- unsigned char tmp = CmdDONE;
- set_speed();
- if (videoSocket >= 0)
- this->wait_for_display (INIT);
- CmdWrite(&tmp, 1);
- if (videoSocket < 0)
- {
- tmp = CmdVPclearScreen;
- CmdWrite(&tmp, 1);
- }
- return 0;
- }
- cerr << "returning from init_av \n";
- return 0;
-}
-
-
-int
-Command_Handler::init_audio_channel (char *audiofile)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) init_audio_channel called\n"));
- this->audio_data_handle_ = -1;
-
- if (!hasAudioDevice)
- {
- fprintf(stderr, "CTR warning: Audio device not available, Audio ignored.\n");
- return -1;
- }
-
- if (this->connect_to_audio_server() == -1)
- return -1;
-
- shared->audioMaxPktSize = -INET_SOCKET_BUFFER_SIZE;
- /* Initialize with AS */
- {
- Audio_Control::INITaudioPara_var para (new
- Audio_Control::INITaudioPara);
- Audio_Control::INITaudioReply_var reply (new Audio_Control::INITaudioReply);
-
-
- para->sn = shared->cmdsn;
- para->version = VERSION;
- para->para.encodeType = shared->AFPara.encodeType;
- para->para.channels = shared->AFPara.channels;
- para->para.samplesPerSecond = shared->AFPara.samplesPerSecond;
- para->para.bytesPerSample = shared->AFPara.bytesPerSample;
- para->nameLength =ACE_OS::strlen (audiofile)+1;
-
- para->audiofile.length (strlen(audiofile));
-
- for (u_int i=0;i<para->audiofile.length ();i++)
- para->audiofile [i] = audiofile [i];
-
- // CORBA call
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->audio_control_->init_audio (para.in (),
- reply.out (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%) init_audio failed\n"),
- -1);
- else
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) init_audio success \n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("audio_control_->init_audio (..)");
- return -1;
- }
- TAO_ENDTRY;
-
- /*
- fprintf(stderr, "AF Audio para: encode %d, ch %d, sps %d, bps %d.\n",
- para.para.encodeType, para.para.channels,
- para.para.samplesPerSecond, para.para.bytesPerSample);
- */
- {
- int flag = 1;
-
- shared->live += reply->live;
- shared->audioFormat = reply->format;
- shared->audioPara.encodeType = reply->para.encodeType;
- shared->audioPara.channels = reply->para.channels;
- shared->audioPara.samplesPerSecond = reply->para.samplesPerSecond;
- shared->audioPara.bytesPerSample = reply->para.bytesPerSample;
- shared->totalSamples = reply->totalSamples;
-
- fprintf(stderr, "Audio: samples %d, sps %d, bps %d\n",
- shared->totalSamples, shared->AFPara.samplesPerSecond,
- shared->AFPara.bytesPerSample);
-
- SetAudioParameter(&shared->audioPara);
- }
-
- /* create AB */
- {
- if (ABpid == -1)
- {
- switch (ABpid = ACE_OS::fork ())
- {
- case -1:
- ACE_OS::perror ("CTR error on forking AB process");
- ACE_OS::exit (1);
- break;
- case 0:
- {
- if (realTimeFlag) {
- SetRTpriority("AB", -1);
- }
- ACE_OS::free (vh);
- ACE_OS::free (vf);
- ACE_OS::free (ah);
- ACE_OS::free (audiofile);
- vbuffer->VBdeleteBuf();
- VDdeleteBuf();
- if (cmdSocket >= 0)
- ACE_OS::close(cmdSocket);
- if (realTimeFlag >= 2) {
-#ifdef __svr4__
- if (SetRTpriority("AB", 0)) realTimeFlag = 0;
-#elif defined(_HPUX_SOURCE)
- if (SetRTpriority("AB", 1)) realTimeFlag = 0;
-#endif
- }
- abuffer->ABprocess(this->audio_data_handle_);
- this->remove_handlers ();
- // Before shutting down the orb remove all the handlers registered with it.
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Before shutdown"));
- this->orb_manager_.orb ()->shutdown ();
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) After shutdown"));
- return 1;
- }
- break;
- default:
- abuffer->ABflushBuf(0);
- break;
- }
- }
- }
- }
- ACE_DEBUG ((LM_DEBUG,"(%P) Init_audio_channel done\n"));
- return 0;
-}
-
-int
-Command_Handler::remove_handlers (void)
-{
- int result;
- result = this->client_sig_handler_.remove_handler ();
-
- if (TAO_ORB_Core_instance ()->reactor ()->remove_handler (&this->notification_handler_,
- ACE_Event_Handler::READ_MASK) < 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) remove_handler for notification handler failed\n"),
- -1);
- return 0;
-
-}
-
-void
-Command_Handler::set_mmdevice (CORBA::Object_ptr audio_mmdevice,
- const char *audio_file,
- CORBA::Object_ptr video_mmdevice,
- const char *video_file)
-
-{
- CORBA::String audio_mmdevice_ior (0);
- CORBA::String video_mmdevice_ior (0);
- TAO_TRY
- {
- audio_mmdevice_ior =
- this->orb_manager_.orb ()->object_to_string (audio_mmdevice,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- ACE_DEBUG ((LM_DEBUG,"audio_mmdevice ior is %s\n",audio_mmdevice_ior));
- video_mmdevice_ior =
- this->orb_manager_.orb ()->object_to_string (video_mmdevice,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- ACE_DEBUG ((LM_DEBUG,"audio_mmdevice ior is %s\n",video_mmdevice_ior));
- }
- TAO_CATCHANY
- {
- ACE_ERROR ((LM_ERROR,"set_audio_mmdevice failed\n"));
- }
- TAO_ENDTRY;
- this->init_java_av (audio_mmdevice_ior,video_mmdevice_ior,(char *)audio_file,(char *)video_file);
- return;
-}
-
-void
-Command_Handler::set_video_data_handle (ACE_HANDLE data_fd)
-{
- videoSocket = this->video_data_handle_= data_fd;
-}
-
-void
-Command_Handler::set_video_control (Video_Control_ptr video_control)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Setting the video control\n"));
- this->video_control_ = video_control;
-}
-
-void
-Command_Handler::set_audio_data_handle (ACE_HANDLE data_fd)
-{
- audioSocket = this->audio_data_handle_= data_fd;
-}
-
-void
-Command_Handler::set_audio_control (Audio_Control_ptr audio_control)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) setting the audio control\n"));
- this->audio_control_ = audio_control;
-}
-
-char*
-Command_Handler::get_data_host (void)
-{
- return this->data_host_;
-}
-
-int
-Command_Handler::init_video_channel (char *videofile)
-{
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n",__LINE__, __FILE__,
-
- fprintf (stderr," File Name is %s\n",videofile);
-
- if (this->connect_to_video_server () == -1)
- return -1;
- // set the max_pkt size for video ?? very minimum
- shared->videoMaxPktSize = -INET_SOCKET_BUFFER_SIZE;
- /* Initialize with VS */
- {
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- Video_Control::INITvideoPara_var para (new
- Video_Control::INITvideoPara);
- Video_Control::INITvideoReply *reply_ptr = 0;
- Video_Control::INITvideoReply_out reply (reply_ptr);
-
- para->sn = shared->cmdsn;
- para->version = VERSION;
- para->videofile.length (strlen(videofile));
-
- // string to sequence <char>
- for (int i=0;i<para->videofile.length ();i++)
- para->videofile [i] = videofile [i];
-
- // CORBA call
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->video_control_->init_video (para.in (),
- reply,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- else
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) init_video success \n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->init_video (..)");
- return -1;
- }
- TAO_ENDTRY;
- shared->live += reply->live;
- shared->videoFormat = reply->format;
- shared->totalHeaders = reply->totalHeaders;
- shared->totalFrames = reply->totalFrames;
- shared->totalGroups = reply->totalGroups;
- shared->averageFrameSize = reply->averageFrameSize;
- shared->horizontalSize = reply->horizontalSize;
- shared->verticalSize = reply->verticalSize;
- shared->pelAspectRatio = reply->pelAspectRatio;
- shared->pictureRate = ((double)reply->pictureRate1000) / 1000.0;
- shared->vbvBufferSize = reply->vbvBufferSize;
- shared->firstGopFrames = reply->firstGopFrames;
- shared->patternSize = reply->pattern.length ();
- if (shared->patternSize == 0) {
-
- Fprintf(stderr, "CTR warning: patternsize %d\n", shared->patternSize);
-
- shared->patternSize = 1;
- shared->pattern[0] = 'I';
- shared->pattern[1] = 0;
- shared->IframeGap = 1;
- }
- else if (shared->patternSize < PATTERN_SIZE)
- {
- int i;
- char * ptr = shared->pattern + shared->patternSize;
- // strncpy(shared->pattern, reply->pattern, shared->patternSize);
- for (i=0;i<shared->patternSize;i++)
- shared->pattern[i] = reply->pattern [i];
- for (i = 1; i < PATTERN_SIZE / shared->patternSize; i ++) {
- // ACE_OS::memcpy (ptr, shared->pattern, shared->patternSize);
- for (int j=0; j < shared->patternSize ;j++)
- ptr [j] = shared->pattern [j];
- ptr += shared->patternSize;
- }
- shared->IframeGap = 1;
- while (shared->IframeGap < shared->patternSize)
- {
- if (shared->pattern[shared->IframeGap] == 'I')
- break;
- else
- shared->IframeGap ++;
- }
- }
- else
- {
- fprintf(stderr, "CTR Error: patternSize %d greater than PATTERN_SIZE %d.\n",
- shared->patternSize, PATTERN_SIZE);
- ACE_OS::exit (1);
- }
- fprintf(stderr, "Video: %s, %s\n",
- shared->videoFormat == VIDEO_SIF ? "SIF" :
- shared->videoFormat == VIDEO_JPEG ? "JPEG" :
- shared->videoFormat == VIDEO_MPEG1 ? "MPEG1" :
- shared->videoFormat == VIDEO_MPEG2 ? "MPEG2" : "UNKOWN format",
- reply->live ? "live source" : "stored source");
-
- fprintf(stderr, "Video: numS-%d, numG-%d, numF-%d, aveFrameSize-%d\n",
- reply->totalHeaders, reply->totalGroups, reply->totalFrames,
- reply->averageFrameSize);
- fprintf(stderr, "Video: maxS-%d, maxG-%d, maxI-%d, maxP-%d, maxB-%d\n",
- reply->sizeSystemHeader, reply->sizeGop,
- reply->sizeIFrame, reply->sizePFrame, reply->sizeBFrame);
- fprintf(stderr,
- "Video: SHinfo: hsize-%d, vsize-%d, pelAspect-%d, rate-%f, vbv-%d.\n",
- reply->horizontalSize, reply->verticalSize, reply->pelAspectRatio,
- shared->pictureRate, reply->vbvBufferSize);
- shared->pattern[shared->patternSize] = 0;
- fprintf(stderr, "Video: firstGopFrames %d, IframeGap %d\n",
- reply->firstGopFrames, shared->IframeGap);
- shared->pattern[shared->patternSize] = 'I';
- if (reply->totalFrames > MAX_FRAMES && (!shared->live))
- {
- fprintf(stderr,
- "Error: totalFrames %d > MAX_FRAMES %d, needs change and recompile.\n",
- reply->totalFrames, MAX_FRAMES);
- ComCloseConn(this->video_data_handle_);
- // ComCloseConn(videoSocket);
- videoSocket = -1;
- return -1;
- }
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
-
- /* create VB, and put INIT frame to VB*/
- {
- int sp[2]; /* sp[0] is for CTR and sp[1] is for VB */
-
- /* create command socket pair for sending INIT frame to VB, the pipe
- should be discard/non-discard in consistent with videoSocket*/
- if (socketpair(AF_UNIX,
- shared->videoMaxPktSize >= 0 ? SOCK_STREAM :
- SOCK_DGRAM, 0, sp) == -1)
- {
- ACE_OS::perror ("CTR error on open CTR-VB socketpair");
- ACE_OS::exit (1);
- }
-
- if (VBpid == -1)
- {
- switch (VBpid = ACE_OS::fork ())
- {
- case -1:
- ACE_OS::perror ("CTR error on forking VB process");
- ACE_OS::exit (1);
- break;
- case 0:
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- if (realTimeFlag) {
- SetRTpriority("VB", -1);
- }
- ACE_OS::free (vh);
- ACE_OS::free (videofile);
- ACE_OS::free (ah);
- ACE_OS::free (af);
- ::close(sp[0]);
- //::close (videoSocket);
- // if (audioSocket >= 0)
- // ComCloseFd(audioSocket);
- ::close (audioSocket);
- abuffer->ABdeleteBuf();
- VDdeleteBuf();
- if (cmdSocket >= 0)
- ::close(cmdSocket);
- if (realTimeFlag >= 2) {
-#ifdef __svr4__
- if (SetRTpriority("VB", 0)) realTimeFlag = 0;
-#elif defined(_HPUX_SOURCE)
- if (SetRTpriority("VB", 1)) realTimeFlag = 0;
-#endif
- }
- if (vbuffer->VBprocess(sp[1], this->video_data_handle_) == -1)
- {
- ACE_DEBUG ((LM_DEBUG,"VBprocess exiting as init failed\n"));
- ACE_OS::exit (2);
- }
- else
- {
- this->remove_handlers ();
- this->orb_manager_.orb ()->shutdown ();
- return 1;
- }
- break;
- default:
- ::close(sp[1]);
- // ::close(dataSocket);
- {
- int bytes, res;
- /* passing all messages of INIT frame to VB here. */
- char * buf = (char *)ACE_OS::malloc(INET_SOCKET_BUFFER_SIZE);
- VideoMessage *msg = (VideoMessage *)buf;
- int pkts = 1, msgo = 0, msgs = 0;
-
- if (buf == NULL) {
- ACE_OS::perror ("CTR error on ACE_OS::malloc() for INIT frame");
- ACE_OS::exit (1);
- }
- while (msgo + msgs < pkts) {
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- // cerr << "expecting a packet of size " << sizeof (*msg) << endl;
-
- VideoRead(buf, sizeof(*msg));
- //~~ we need to read the first frame from the
- // data socket instead of control socket.
- // SocketRecv(dataSocket, buf, size);
- // ACE_DEBUG ((LM_DEBUG,"packetsn = %d,msgsn = %d\n",msg->packetsn,msg->msgsn));
- pkts = ntohl(msg->packetSize);
- msgo = ntohl(msg->msgOffset);
- msgs = ntohl(msg->msgSize);
- if (shared->videoMaxPktSize >= 0) { /* non-discard mode */
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- write_bytes(sp[0], buf, sizeof(*msg));
- bytes = msgs;
- while (bytes > 0) {
- int size = min(bytes, INET_SOCKET_BUFFER_SIZE);
- VideoRead(buf, size);
- write_bytes(sp[0], buf, size);
- bytes -= size;
- }
- }
- else {
- // cerr << "expecting a packet of size " << msgs << endl;
-
- VideoRead(buf + sizeof(*msg), msgs);
- bytes = sizeof(*msg) + msgs;
- while ((res = ACE_OS::write (sp[0], buf, bytes)) == -1) {
- if (errno == EINTR || errno == ENOBUFS) continue;
- ACE_OS::perror ("CTR error on sending INIT frame to VB");
- ACE_OS::exit (1);
- }
- if (res < bytes) {
- fprintf(stderr, "CTR warn: send() res %dB < bytes %dB\n", res, bytes);
- }
- /*
- Fprintf(stderr,
- "CTR transferred INIT frame to VB: pkts %d, msgo %d, msgs %d\n",
- pkts, msgo, msgs);
- */
- }
- }
- ACE_OS::read (sp[0], buf, 1); /* read a garbage byte, to sync with VB */
- fprintf (stderr,"(%P|%t) Command process read a garbage bytes\n");
- ::close(sp[0]);
- ACE_OS::free (buf);
- }
- break;
- }
- }
- }
- }
- return 0;
-}
-
-
-int
-Command_Handler::stat_stream (CORBA::Char_out ch,
- CORBA::Long_out size)
-{
- return 0;
-}
-
-
-int
-Command_Handler::close (void)
-{
- TAO_TRY
- {
- if (CORBA::is_nil (this->audio_control_) == 0)
- {
- // one way function call.
- this->audio_control_->close (TAO_TRY_ENV);
-
- TAO_CHECK_ENV;
- if (ABpid > 0) {
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (asp[0],&message,BUFSIZ);
- ABpid = -1;
- }
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) audio close done \n"));
- }
-
- if (CORBA::is_nil (this->video_control_) == 0)
- {
- // one way function call.
- this->video_control_->close (TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (VBpid > 0) {
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (vsp[0],&message,BUFSIZ);
- VBpid = -1;
- }
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) video close done \n"));
- }
- this->orb_manager_.child_poa ()->destroy (1,0,TAO_TRY_ENV);
- TAO_CHECK_ENV;
- ACE_DEBUG ((LM_DEBUG,"(%P|%t)destroy childpoa done\n"));
-
- this->orb_manager_.init_child_poa (argc_,
- argv_,
- "child_poa",
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- ACE_DEBUG ((LM_DEBUG,"(%P)New child poa initialized\n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->close (..)");
- return -1;
- }
- TAO_ENDTRY;
- delete this->audio_reactive_strategy_;
- ACE_DEBUG ((LM_DEBUG,"(%P)%N,%l"));
- delete this->audio_client_mmdevice_;
- ACE_DEBUG ((LM_DEBUG,"(%P)%N,%l"));
- // delete this->audio_streamctrl_;
- ACE_DEBUG ((LM_DEBUG,"(%P)%N,%l"));
- delete this->video_reactive_strategy_;
- ACE_DEBUG ((LM_DEBUG,"(%P)%N,%l"));
- delete this->video_client_mmdevice_;
- ACE_DEBUG ((LM_DEBUG,"(%P)%N,%l"));
- // delete this->video_streamctrl_;
- ACE_DEBUG ((LM_DEBUG,"(%P)%N,%l"));
- return 0;
-}
-
-
-int
-Command_Handler::stat_sent (void)
-{
- return 0;
-}
-
-
-int
-Command_Handler::fast_forward (void)
-
-{
- // CORBA call
- unsigned char tmp;
- Video_Control::FFpara_var para (new Video_Control::FFpara);
- /*
- fprintf(stderr, "CTR: FF . . .\n");
- */
- if (shared->live) {
- beep();
- }
- else {
- this->stop_playing ();
- if (shared->nextGroup < 0)
- shared->nextGroup = 0;
- if (videoSocket >= 0 && shared->nextGroup < shared->totalGroups)
- {
- NewCmd(CmdFF);
- shared->needHeader = 0;
- shared->framesPerSecond = shared->config.ffFPS /
- shared->patternSize;
- shared->usecPerFrame = (int)(1000000.0 / (float)shared->config.ffFPS) *
- shared->patternSize;
-
- shared->VStimeAdvance =
- max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000;
- if (shared->VStimeAdvance < shared->usecPerFrame)
- shared->VStimeAdvance = shared->usecPerFrame;
-
- para->VStimeAdvance = shared->VStimeAdvance;
- para->sn = shared->cmdsn;
- para->nextGroup = shared->nextGroup;
- para->usecPerFrame = shared->usecPerFrame;
- para->framesPerSecond = shared->framesPerSecond;
- startTime = get_usec();
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->video_control_->fast_forward (para.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) fast_forward done \n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->fast_forward_video (..)");
- return -1;
- }
- TAO_ENDTRY;
- start_timer();
- }
- }
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- return 0;
-}
-
-
-int
-Command_Handler::fast_backward (void)
-
-{
- unsigned char tmp;
- Video_Control::FBpara_var para (new Video_Control::FBpara);
- /*
- fprintf(stderr, "CTR: FB . . .\n");
- */
- if (shared->live) {
- beep();
- }
- else {
- this->stop_playing();
- if (shared->nextGroup >= shared->totalGroups)
- shared->nextGroup = shared->totalGroups - 1;
- if (videoSocket >= 0 && shared->nextGroup >= 0)
- {
- NewCmd(CmdFB);
- shared->needHeader = 0;
- shared->framesPerSecond = shared->config.fbFPS /
- shared->patternSize;
- shared->usecPerFrame = (int)(1000000.0 / (float)shared->config.fbFPS) *
- shared->patternSize;
-
- shared->VStimeAdvance =
- max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000;
- if (shared->VStimeAdvance < shared->usecPerFrame)
- shared->VStimeAdvance = shared->usecPerFrame;
-
- para->VStimeAdvance = shared->VStimeAdvance;
- para->sn = shared->cmdsn;
- para->nextGroup = shared->nextGroup;
- para->usecPerFrame = shared->usecPerFrame;
- para->framesPerSecond = shared->framesPerSecond;
- startTime = get_usec();
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->video_control_->fast_backward (para.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) fast_backward done \n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->fast_forward_video (..)");
- return -1;
- }
- TAO_ENDTRY;
-
- start_timer();
- }
- }
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- return 0;
-}
-
-
-int
-Command_Handler::step (void)
-
-{
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) Command_Handler::step ()\n"));
- Video_Control::STEPpara_var para (new Video_Control::STEPpara);
- this->stop_playing ();
- NewCmd (CmdSTEP);
- if (videoSocket >= 0 && shared->nextFrame <= shared->totalFrames)
- { /* when shared->nextFrame == shared->totalFrame, it will force VS to send a ENDSEQ,
- to let VD give out the remaining frame in its ring[] buffer */
- para->sn = shared->cmdsn;
- para->nextFrame = shared->nextFrame;
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->video_control_->step (para.in (),
- TAO_TRY_ENV);
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) step done \n"));
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->step (..)");
- return -1;
- }
- TAO_ENDTRY;
- /*
- fprintf(stderr, "CTR: STEP . . . frame-%d\n", para.nextFrame);
- */
- this->wait_for_display (STEP);
- }
-// unsigned char tmp = CmdDONE;
-// CmdWrite(&tmp, 1);
- return 0;
-}
-
-int
-Command_Handler::play (int auto_exp,
- CORBA::Environment& env)
-{
- CORBA::Long vts;
- CORBA::Long ats;
- CORBA::Boolean result;
- unsigned char tmp;
- int cmdstarted = 0;
- int stuffsamples = 0;
-
- // this->timer_.start ();
- fprintf (stderr, "CTR: PLAY . . .\n");
-
- this->stop_playing ();
-
- if (!shared->live && !shared->config.rt && videoSocket >= 0) {
- /* rtplay turned off only when video avaible and not want RT play */
- rtplay = 0;
- fprintf (stderr, "VCR is not playing at in realtime mode, audio disabled\n");
- }
- else {
- rtplay = 1;
- }
-
- if (shared->live) {
- rtplay = 1;
- shared->nextFrame = 0;
- shared->nextSample = 0;
- }
-
- shared->rtplay = rtplay;
-
- if (shared->nextFrame < 0)
- shared->nextFrame = 0;
- else if (shared->nextFrame >= shared->totalFrames)
- {
- shared->nextFrame = shared->totalFrames - 1;
- }
-
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) nextFrame=%d,totalFrames=%d",
- // shared->nextFrame,shared->totalFrames));
- if (audioSocket >= 0 && shared->nextSample < shared->totalSamples && rtplay)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) %s,%d\n",__FILE__,__LINE__));
- Audio_Control::PLAYPara_var para (new Audio_Control::PLAYPara);
- if (cmdstarted == 0)
- {
- NewCmd (CmdPLAY);
- if (!auto_exp) set_speed ();
- cmdstarted = 1;
- }
-
- if (videoSocket >= 0 && rtplay && !shared->live) {
- /* video channel also active, recompute nextSample */
- shared->nextSample = (int) ( (double)shared->audioPara.samplesPerSecond *
- ( (double)shared->nextFrame / shared->pictureRate));
- shared->nextSample += shared->config.audioOffset;
- if (shared->nextSample < 0) {
- stuffsamples = (- shared->nextSample);
- shared->nextSample = 0;
- }
- else if (shared->nextSample >= shared->totalSamples)
- shared->nextSample = shared->totalSamples - 1;
- }
-
- abuffer->ABflushBuf (shared->nextSample);
-
- para->sn = shared->cmdsn;
- para->nextSample = shared->nextSample;
- para->samplesPerSecond = shared->samplesPerSecond;
- para->samplesPerPacket = 1024 / shared->audioPara.bytesPerSample;
- para->ABsamples = AB_BUF_SIZE / shared->audioPara.bytesPerSample;
- para->spslimit = 32000;
-
- startTime = get_usec ();
- // CORBA call.
-
- result =this->audio_control_->play (para.in (),
- ats,
- env);
-
- if (result == 0)
- return -1;
- TAO_CHECK_ENV_RETURN (env,-1);
- }
- if (videoSocket >= 0 && shared->nextFrame < shared->totalFrames)
- {
- Video_Control::PLAYpara_var para (new Video_Control::PLAYpara);
-
- if (cmdstarted == 0)
- {
- NewCmd (CmdPLAY);
- if (!auto_exp) set_speed ();
- cmdstarted = 1;
- }
- shared->VBheadFrame = -1;
- shared->needHeader = 0;
- {
- int i = shared->config.maxSPframes;
- i = (int) ( (double)i * (1000000.0 / (double)shared->usecPerFrame) /
- shared->pictureRate);
- shared->sendPatternGops = max (min (i, PATTERN_SIZE) / shared->patternSize, 1);
- }
- cmdstarted = 1;
-#ifdef STAT
- shared->collectStat = (shared->config.collectStat && (!shared->live));
- if (shared->collectStat)
- {
- int i;
- memset (& (shared->stat), 0, sizeof (shared->stat));
- shared->stat.VDlastFrameDecoded = (unsigned)-1;
- for (i = 0; i < MAX_FRAMES; i++)
- shared->stat.VBfillLevel[i] = SHRT_MIN;
- speedPtr = 0;
- }
-#endif
- shared->VStimeAdvance =
- max (shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000;
- if (shared->VStimeAdvance < shared->usecPerFrame)
- shared->VStimeAdvance = shared->usecPerFrame;
-
- para->VStimeAdvance = shared->VStimeAdvance;
- para->sn = shared->cmdsn;
- para->nextFrame = shared->nextFrame;
- para->usecPerFrame = shared->usecPerFrame;
- para->framesPerSecond = shared->framesPerSecond;
- para->collectStat = shared->collectStat;
- frate = shared->config.frameRateLimit;
- if (frate <= 0.0) {
- frate = 1.0;
- }
- shared->frameRateLimit = frate;
- para->frameRateLimit1000 =
- (long) (shared->frameRateLimit * 1000.0);
- compute_sendPattern ();
- para->sendPatternGops = shared->sendPatternGops;
- // memcpy (para->sendPattern, shared->sendPattern, PATTERN_SIZE);
-
- // Sequence of chars
-
- para->sendPattern.length (PATTERN_SIZE);
-
- for (int i=0; i<PATTERN_SIZE ; i++)
- para->sendPattern [i] = shared->sendPattern [i];
-
- startTime = get_usec ();
- // CORBA call
- result =this->video_control_->play (para.in (),
- vts,
- env);
- if (result == 0)
- return -1;
- TAO_CHECK_ENV_RETURN (env,-1);
- ACE_DEBUG ((LM_DEBUG,"(%P|%t)Reached line %d in %s",__LINE__,__FILE__));
- if (shared->config.qosEffective) {
- /*
- fprintf (stderr, "CTR start FeedBack with init frameRateLimit %lf\n",
- frate);
- */
- maxfr = frate; /* max frame rate all the time during one playback */
- minupf = (int) (1000000.0 / maxfr); /* min usec-per-frame all the time
- during one playback */
- maxrate = (double)minupf / (double)max (shared->usecPerFrame, minupf);
- /* this is current max frame rate in percentage against 'maxfr',
- current max frame rate is the lower of 'maxfr' and play speed */
- frate = 1.0; /* current sending frame rate, in percentage against 'maxfr'
- This value is set with init value as 1.0, so that if current
- speed is lower than frameRateLimit, no frames are dropped,
- then when play speed increases frame rate will increase
- accordingly until frames are dropped*/
- adjstep = ( (double)minupf / (double)shared->usecPerFrame) /
- (double)max (shared->patternSize * shared->sendPatternGops, 5);
- /* adjust step for current play speed, in percentage against
- 'maxfr' */
-
- fbstate = 1;
- fb_startup = 1;
-
-
- fprintf (stderr, "CTR init frate: %f minupf %d, shared->upf %d\n",
- frate, minupf, shared->usecPerFrame);
-
- }
- }
-
- if (shared->live && (videoSocket >= 0) && (audioSocket >= 0)) {
- int gap = get_duration (ats, vts);
- if (gap < 0 || gap >= 5000000) {
- Fprintf (stderr, "Error for live source: ats %u, vts %u, gap %d\n",
- ats, vts, gap);
- }
- else {
- int skipped = gap * shared->audioPara.samplesPerSecond / 1000000;
- skipped += shared->config.audioOffset;
- abuffer->ABskipSamples (skipped);
- Fprintf (stderr, "Live source: skipped %d audio samples\n", skipped);
- }
- }
- else if (stuffsamples) {
- abuffer->ABskipSamples (-stuffsamples);
- }
- if (cmdstarted)
- start_timer ();
- tmp = CmdDONE;
- CmdWrite (&tmp, 1);
- return 0;
-}
-
-int
-Command_Handler::position_action (int operation_tag)
-{
- int val;
- unsigned char tmp = CmdDONE;
- OurCmdRead ((char*)&val, 4);
-
- this->operation_tag_ = operation_tag;
- this->position_val_ = val;
-
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) position_action called\n"));
- if (shared->live) {
- beep();
- }
- else {
- shared->locationPosition = val;
- this->stop_playing ();
- NewCmd(CmdPOSITION);
- if (videoSocket >= 0)
- {
- int gop = shared->nextGroup;
- Video_Control::POSITIONpara_var para (new Video_Control::POSITIONpara);
- shared->nextGroup = ((shared->totalGroups-1) * val) / POSITION_RANGE;
- /*
- fprintf(stderr, "CTR: POSITION%s %d (nextGop %d). . .\n",
- operation_tag ? "_released" : "", val, shared->nextGroup);
- */
- if (gop != shared->nextGroup || operation_tag)
- {
- shared->nextFrame = ((shared->totalFrames-1) * val) / POSITION_RANGE;
- para->sn = shared->cmdsn;
- para->nextGroup = shared->nextGroup;
- tmp = CmdPOSITION;
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->video_control_->position (para.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) position done \n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->position (..)");
- return -1;
- }
- TAO_ENDTRY;
- if (operation_tag) /* release or LOOPrewind */
- this->wait_for_display (POSITION);
- }
-// if (operation_tag && audioSocket >= 0) /* needs to adjust audio position */
-// {
-
-// shared->nextSample = (int)((double)shared->audioPara.samplesPerSecond *
-// ((double)shared->nextFrame / shared->pictureRate));
-// // ACE_DEBUG ((LM_DEBUG,"shared->nextsample = %d\n",shared->nextSample));
-// }
- }
-// else if (audioSocket >= 0)
-// shared->nextSample = (shared->totalSamples-1) * val / POSITION_RANGE;
- }
-// tmp = CmdDONE;
-// CmdWrite(&tmp, 1);
- return 0;
-}
-
-int
-Command_Handler::position (void)
-
-{
- return this->position_action (0);
-}
-
-int
-Command_Handler::position_release (void)
-
-{
- return this->position_action (1);
-}
-
-int
-Command_Handler::volume (void)
-
-{
- OurCmdRead((char *)&shared->volumePosition, 4);
- if (audioSocket >= 0) {
- SetAudioGain();
- }
- /*
- unsigned char tmp = CmdDONE;
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- */
- return 0;
-}
-
-int
-Command_Handler::balance (void)
-
-{
- OurCmdRead((char *)&shared->balancePosition, 4);
- /*
- unsigned char tmp = CmdDONE;
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- */
- return 0;
-}
-
-int
-Command_Handler::speed (void)
-
-{
- ACE_DEBUG ((LM_DEBUG,"COmmand_Handler::speed ()\n"));
- unsigned char tmp;
- CORBA::Boolean result;
- OurCmdRead((char *)&shared->speedPosition, 4);
- set_speed();
- TAO_TRY
- {
- if (!shared->live && shared->cmd == CmdPLAY)
- {
- if (videoSocket >= 0)
- {
- Video_Control::SPEEDpara_var para (new Video_Control::SPEEDpara);
- para->sn = shared->cmdsn;
- para->usecPerFrame = shared->usecPerFrame;
- para->framesPerSecond = shared->framesPerSecond;
- para->frameRateLimit1000 =
- (long)(shared->frameRateLimit * 1000.0);
- {
- int i = shared->config.maxSPframes;
- i = (int) ((double)i * (1000000.0 / (double)shared->usecPerFrame) /
- shared->pictureRate);
- shared->sendPatternGops = max(min(i, PATTERN_SIZE) / shared->patternSize, 1);
- }
- compute_sendPattern();
- para->sendPatternGops = shared->sendPatternGops;
- para->sendPattern.length (PATTERN_SIZE);
- for (int i=0; i< PATTERN_SIZE ; i++)
- para->sendPattern[i]=shared->sendPattern[i];
- // CORBA call
- result = this->video_control_->speed (para.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- if (fbstate) {
- maxrate = (double)minupf / (double)max(shared->usecPerFrame, minupf);
- adjstep = ((double)minupf / (double)shared->usecPerFrame) /
- (double)max(shared->patternSize * shared->sendPatternGops, 5);
- fbstate = 1;
- }
- }
- if (audioSocket >= 0)
- {
- Audio_Control::SPEEDPara_var para (new Audio_Control::SPEEDPara);
- para->sn = shared->cmdsn;
- para->samplesPerSecond = shared->samplesPerSecond;
- para->samplesPerPacket = 1024 / shared->audioPara.bytesPerSample;
- para->spslimit = 32000;
- // CORBA call
- result =
- this->audio_control_->speed (para.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (0))
- return -1;
- }
- }
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("audio_control->speed ()");
- return -1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-
-int
-Command_Handler::stop (void)
-
-{
-#ifdef STAT
- unsigned char preCmd = shared->cmd;
-#endif
- /*
- fprintf(stderr, "CTR: STOP . . .\n");
- */
- this->stop_playing ();
-
- if (shared->live && videoSocket >= 0) {
- Fprintf(stderr, "CTR live video stat: average disp frame rate: %5.2f fps\n",
- shared->pictureRate * displayedFrames / shared->nextFrame);
- }
- unsigned char tmp = CmdDONE;
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) command_handler::Stop :nextFrame=%d\n",shared->nextFrame));
- CmdWrite(&tmp, 1);
-
- return 0;
-}
-
-int
-Command_Handler::stop_playing (void)
-{
- unsigned char precmd = shared->cmd;
-
- TAO_TRY
- {
- if (precmd == CmdFF || precmd == CmdFB || precmd == CmdPLAY)
- {
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- unsigned char tmp = CmdSTOP;
- NewCmd(CmdSTOP);
-
- /* notify AS and/or VS */
- if ((CORBA::is_nil (this->audio_control_) == 0)
- && precmd == CmdPLAY
- && rtplay)
- {
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- // CORBA call
- CORBA::Boolean result =
- this->audio_control_->stop (shared->cmdsn,
- TAO_TRY_ENV);
- // cerr << "audio_control_->stop result is " << result << endl;
- if (result == (0))
- return -1;
- TAO_CHECK_ENV;
- }
- if (CORBA::is_nil (this->video_control_) == 0)
- {
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
- // CORBA call
- CORBA::Boolean result =
- this->video_control_->stop (shared->cmdsn,
- TAO_TRY_ENV);
- if (result == (0))
- return -1;
- TAO_CHECK_ENV;
- }
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
-
- /* stop timer and sleep for a while */
- // cerr << "stopping timer" << endl;
- this->client_sig_handler_.stop_timer ();
- usleep(100000);
-
- /* purge VDbuf and audio channel from AS*/
- if (videoSocket >= 0)
- {
- while (VDpeekMsg() != NULL)
- VDreclaimMsg(VDgetMsg());
- /*
- Fprintf(stderr, "CTR: VDbuf purged.\n");
- */
- fbstate = 0;
-
- }
-
- /* adjust some info */
- if (precmd == CmdPLAY && videoSocket >= 0)
- shared->nextFrame = shared->currentFrame+1;
- else
- shared->nextGroup = shared->currentGroup + 1;
- }
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Command_Handler.stop(..)");
- return -1;
- }
- TAO_ENDTRY;
- return 0;
-}
-
-// connects and handshakes with the server
-int
-Command_Handler::connect_to_video_server (void)
-{
- // set the pointers to the correct values
- // *max_pkt_size = -INET_SOCKET_BUFFER_SIZE;
- // initialize the command handler , ORB
- TAO_TRY
- {
- if (this->resolve_video_reference () == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) command_handler: resolve_video_reference returned -1"),
- -1);
- AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS);
- AVStreams::flowSpec_var the_flows (new AVStreams::flowSpec);
- // Bind the client and server mmdevices.
-
- ACE_NEW_RETURN (this->video_reactive_strategy_,
- Video_Endpoint_Reactive_Strategy_A (&this->orb_manager_,
- this),
- -1);
- ACE_NEW_RETURN (this->video_client_mmdevice_,
- TAO_MMDevice (this->video_reactive_strategy_),
- -1);
-
- this->orb_manager_.activate_under_child_poa ("Video_Client_MMDevice",
- this->video_client_mmdevice_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- ACE_NEW_RETURN (this->video_streamctrl_,
- TAO_StreamCtrl,
- -1);
- this->video_streamctrl_->bind_devs
- (this->video_client_mmdevice_->_this (TAO_TRY_ENV),
- this->video_server_mmdevice_.in (),
- the_qos.inout (),
- the_flows.in (),
- TAO_TRY_ENV);
-
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_streamctrl.bind_devs:");
- return -1;
- }
- TAO_ENDTRY;
-
- return 0;
-
-}
-
-// connects and handshakes with the server
-int
-Command_Handler::connect_to_audio_server (void)
-{
-
- // // set the pointers to the correct values
- // *max_pkt_size = -INET_SOCKET_BUFFER_SIZE;
-
- TAO_TRY
- {
-
- if (this->resolve_audio_reference () == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) command_handler: resolve_audio_reference returned -1"),
- -1);
- AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS);
- AVStreams::flowSpec_var the_flows (new AVStreams::flowSpec);
-
- ACE_NEW_RETURN (this->audio_reactive_strategy_,
- Audio_Endpoint_Reactive_Strategy_A (&this->orb_manager_,
- this),
- -1);
-
- ACE_NEW_RETURN (this->audio_client_mmdevice_,
- TAO_MMDevice (this->audio_reactive_strategy_),
- -1);
-
- // activate the client audio mmdevice under the child poa.
- this->orb_manager_.activate_under_child_poa ("Audio_Client_MMDevice",
- this->audio_client_mmdevice_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- ACE_NEW_RETURN (this->audio_streamctrl_,
- TAO_StreamCtrl,
- -1);
-
- // Bind the client and server mmdevices.
- this->audio_streamctrl_->bind_devs
- (this->audio_client_mmdevice_->_this (TAO_TRY_ENV),
- this->audio_server_mmdevice_.in (),
- the_qos.inout (),
- the_flows.in (),
- TAO_TRY_ENV);
-
- TAO_CHECK_ENV;
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("audio_streamctrl.bind_devs:");
- return -1;
- }
- TAO_ENDTRY;
-
- return 0;
-}
-
-// ========================================
-// Decode_Notification_Handler methods.
-
-Decode_Notification_Handler::Decode_Notification_Handler (Command_Handler *command_handler)
- :command_handler_ (command_handler)
-{
-}
-
-ACE_HANDLE
-Decode_Notification_Handler::get_handle (void) const
-{
- return vdsp[0];
-}
-
-int
-Decode_Notification_Handler::handle_input (ACE_HANDLE fd)
-{
- ACE_DEBUG ((LM_DEBUG,"Decode_Notification_Handler::handle_input \n"));
- char message[BUFSIZ];
- int result =
- ACE_OS::read (fd,&message,BUFSIZ);
- if (result == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"Decode_Notification_Handler::handle_input read failed\n"),0);
- if (result == 0)
- ACE_ERROR_RETURN ((LM_ERROR,"Decode_Notification_Handler::handle_input socket closed\n"),0);
-
- if (message[0] != DECODED)
- ACE_ERROR_RETURN ((LM_ERROR,"Decode_Notification_Handler:: Not a decoded message\n"),0);
-
- // Resume the command handler.
- if (this->command_handler_->command_suspended_ != UNSUSPENDED)
- {
- unsigned char tmp;
- switch (this->command_handler_->command_suspended_)
- {
- case INIT:
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- if (videoSocket < 0)
- {
- tmp = CmdVPclearScreen;
- CmdWrite(&tmp, 1);
- }
- break;
- case STEP:
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- break;
- case POSITION:
- if (this->command_handler_->operation_tag_ && audioSocket >= 0) /* needs to adjust audio position */
- {
-
- shared->nextSample = (int)((double)shared->audioPara.samplesPerSecond *
- ((double)shared->nextFrame / shared->pictureRate));
- // ACE_DEBUG ((LM_DEBUG,"shared->nextsample = %d\n",shared->nextSample));
- }
- if (audioSocket >= 0)
- shared->nextSample = (shared->totalSamples-1) * (this->command_handler_->position_val_) / POSITION_RANGE;
- tmp = CmdDONE;
- CmdWrite(&tmp, 1);
- break;
- default:
- ACE_DEBUG ((LM_DEBUG,"INVALID STATE for command suspension\n"));
- break;
- }
- TAO_ORB_Core_instance ()->reactor ()->resume_handler (this->command_handler_->get_handle ());
- }
- ::usr1_handler (0);
- return 0;
-}
-
-
-// ----------------------------------------------------------------------
-// Client_Sig_Handler methods
-
-void
-Client_Sig_Handler::PlayAudioOnly(void)
-{
- int maxSize;
- int size, csize; /* all in samples */
- unsigned int AFtime;
-
- if (audioFirst)
- {
- audioFirst = 0;
- nextAFtime = GetAudioTime() + audioForward;
- }
- else
- if ((int)(nextAFtime - GetAudioTime()) >= bufferedSamples)
- return;
-
- if (timer_on >4)
- {
- // ~~we may need to uncomment this ??
- this->stop_timer ();
-
- // stop both the audio and video servers
- this->command_handler_->stop ();
- /* tries to rewind and play again */
- if (shared->loopBack)
- {
- /*
- fprintf(stderr, "CTR: trying loopBack().\n");
- */
- loopBack();
- }
-
- return;
- }
- if (nextASSample >= shared->totalSamples)
- {
- timer_on ++;
- return;
- }
- if (shared->samplesPerSecond >= shared->audioPara.samplesPerSecond)
- maxSize = (AudioBufSize/shared->audioPara.bytesPerSample);
- else
- maxSize = ((AudioBufSize/shared->audioPara.bytesPerSample) *
- shared->samplesPerSecond) /
- shared->audioPara.samplesPerSecond;
- for (;;)
- {
- size = abuffer->ABgetSamples(rawBuf, maxSize);
- csize = AudioConvert(size);
- AFtime = PlayAudioSamples(nextAFtime, convBuf, csize);
- nextASSample += size;
- shared->nextSample += size;
- nextAFtime += csize;
- if ((int)(nextAFtime - AFtime) < 0)
- nextAFtime = AFtime;
- if (nextASSample >= shared->totalSamples)
- {
- timer_on ++;
- break;
- }
- /*
- Fprintf(stderr, "CTR: nextAFtime:%d, AFtime:%d, bufferedSamples:%d\n",
- nextAFtime, AFtime, bufferedSamples);
- */
- if ((int)(nextAFtime - AFtime) >= bufferedSamples)
- break;
- }
- {
- unsigned char tmp = CmdVPaudioPosition;
- CmdWrite(&tmp, 1);
- }
-}
-
-// handles the timeout SIGALRM signal
-Client_Sig_Handler::Client_Sig_Handler (Command_Handler *command_handler)
- : command_handler_ (command_handler)
-{
-}
-
-Client_Sig_Handler::~Client_Sig_Handler (void)
-{
- TAO_ORB_Core_instance ()->reactor ()->remove_handler (this,
- ACE_Event_Handler::NULL_MASK);
-
- TAO_ORB_Core_instance ()->reactor ()->remove_handler (this->sig_set);
-}
-
-int
-Client_Sig_Handler::register_handler (void)
-{
- // Assign the Sig_Handler a dummy I/O descriptor. Note that even
- // though we open this file "Write Only" we still need to use the
- // ACE_Event_Handler::NULL_MASK when registering this with the
- // ACE_Reactor (see below).
- this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY);
- ACE_ASSERT (this->handle_ != -1);
-
- // Register signal handler object. Note that NULL_MASK is used to
- // keep the ACE_Reactor from calling us back on the "/dev/null"
- // descriptor.
- if (TAO_ORB_Core_instance ()->reactor ()->register_handler
- (this, ACE_Event_Handler::NULL_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p\n",
- "register_handler"),
- -1);
-
- // Create a sigset_t corresponding to the signals we want to catch.
-
- this->sig_set.sig_add (SIGINT);
- this->sig_set.sig_add (SIGQUIT);
- this->sig_set.sig_add (SIGALRM);
- this->sig_set.sig_add (SIGUSR2);
- this->sig_set.sig_add (SIGSEGV);
-
- // Register the signal handler object to catch the signals.
- if (TAO_ORB_Core_instance ()->reactor ()->register_handler (sig_set,
- this) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p\n",
- "register_handler"),
- -1);
- return 0;
-}
-
-int
-Client_Sig_Handler::remove_handler (void)
-{
- if (TAO_ORB_Core_instance ()->reactor ()->remove_handler (this,
- ACE_Event_Handler::NULL_MASK) == -1)
- ACE_DEBUG ((LM_DEBUG,"(%P)remove_handler failed for client_sig handler"));
-
- if (TAO_ORB_Core_instance ()->reactor ()->remove_handler (sig_set) == -1)
- ACE_DEBUG ((LM_DEBUG,"(%P)remove_handler failed for client_sig handler"));
- return 0;
-}
-
-// Called by the ACE_Reactor to extract the fd.
-ACE_HANDLE
-Client_Sig_Handler::get_handle (void) const
-{
- return this->handle_;
-}
-
-int
-Client_Sig_Handler::handle_input (ACE_HANDLE)
-{
- ACE_DEBUG ((LM_DEBUG, "(%t) handling asynchonrous input...\n"));
- return 0;
-}
-
-int
-Client_Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask)
-{
- ACE_DEBUG ((LM_DEBUG, "(%t) closing down Sig_Handler...\n"));
- return 0;
-}
-
-// This method handles all the signals that are being caught by this
-// object. In our simple example, we are simply catching SIGALRM,
-// SIGINT, and SIGQUIT. Anything else is logged and ignored.
-//
-// There are several advantages to using this approach. First,
-// the behavior triggered by the signal is handled in the main event
-// loop, rather than in the signal handler. Second, the ACE_Reactor's
-// signal handling mechanism eliminates the need to use global signal
-// handler functions and data.
-
-int
-Client_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *)
-{
- int status;
- pid_t pid;
- //ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum));
-
- switch (signum)
- {
- case SIGSEGV:
- ::remove_all_semaphores ();
- exit (0);
- case SIGALRM:
- // Handle the timeout
- this->TimerHandler (signum);
- // %% ??!!!
- break;
- case SIGCHLD:
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum));
- pid = ACE_OS::wait (&status);
- return 0;
- case SIGINT:
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S, removing signal handlers from the reactor\n", signum));
- this->command_handler_->close ();
- TAO_ORB_Core_instance ()->reactor ()->remove_handler (this->sig_set);
- TAO_ORB_Core_instance ()->orb ()->shutdown ();
- return 0;
- default:
- ACE_DEBUG ((LM_DEBUG,
- "(%t) %S: not handled, returning to program\n",
- signum));
- return 0;
- }
- this->TimerProcessing ();
- return 0;
-}
-
-void
-Client_Sig_Handler::TimerHandler(int sig)
-{
- int currentUPF = shared->currentUPF;
- /*
- Fprintf(stderr, "CTR in TimerHandler.\n");
- */
- if (videoSocket >= 0 && shared->cmd == CmdPLAY && currentUPF != timerUPF)
- {
- struct itimerval val;
- {
- val.it_interval.tv_sec = val.it_value.tv_sec = currentUPF / 1000000;
- val.it_interval.tv_usec = val.it_value.tv_usec = currentUPF % 1000000;
- setitimer(ITIMER_REAL, &val, NULL);
- /*
- fprintf(stderr, "CTR: timer speed changed to %d upf.\n", shared->currentUPF);
- */
- }
- timerUPF = currentUPF;
-#ifdef STAT
- if (shared->collectStat && speedPtr < SPEEDHIST_SIZE)
- {
- speedHistory[speedPtr].frameId = shared->nextFrame;
- speedHistory[speedPtr].usecPerFrame = timerUPF;
- speedHistory[speedPtr].frameRateLimit = shared->frameRateLimit;
- speedHistory[speedPtr].frames = shared->sendPatternGops * shared->patternSize;
- speedHistory[speedPtr].framesDropped = shared->framesDropped;
- }
- speedPtr ++;
-#endif
- }
- /*
- fprintf(stderr, "+\n");
- */
- if (!timerCount) {
- int addedVSwat;
- if (shared->cmd == CmdPLAY) {
- addedVSwat = shared->usecPerFrame * (shared->VBheadFrame - shared->nextFrame);
- }
- else if (shared->cmd == CmdFF) {
- addedVSwat = shared->usecPerFrame * (shared->VBheadFrame - shared->nextGroup);
- }
- else { /* shared->cmd == CmdFB */
- addedVSwat = shared->usecPerFrame * (shared->nextGroup - shared->VBheadFrame);
- }
- shared->VStimeAdvance += addedVSwat;
- }
- timerCount += timer_signals_skip + 1;
- timer_signals_skip = 0;
-
- if (shared->live ) {
- if (audioSocket <= 0) { /* video only */
- unsigned t = shared->VBheadFrame - startVSA;
- if (timerCount < t) {
- /*
- Fprintf(stderr, "CTR: (av) timerCount %d, t %d\n", timerCount, t);
- */
- timerCount = t;
- }
- }
- }
- double frames_per_group =
- (double)shared->totalFrames/shared->totalGroups;
- long nextframe = shared->nextGroup * frames_per_group;
-
- if (audioSocket > 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Adjusting audio nextsample value\n"));
- shared->nextSample = (int)((double)shared->audioPara.samplesPerSecond *
- ((double)nextframe / shared->pictureRate));
-
- /* audio involved, TimerProcessing() will adjust the rate automatically */
- }
- if ((shared->cmd == CmdFF) || (shared->cmd == CmdFB))
- shared->nextFrame = shared->nextGroup * frames_per_group;
-}
-
-void
-Client_Sig_Handler::stop_timer(void)
-{
- struct itimerval val;
-
- if (!timer_on)
- return;
-
- timer_on = 0;
-
- // setsignal(SIGALRM, SIG_IGN);
-
- val.it_interval.tv_sec = val.it_value.tv_sec = 0;
- val.it_interval.tv_usec = val.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &val, NULL);
-
- fprintf(stderr, "CTR: timer stopped.\n");
-
- // this->command_handler_->stop_timer ();
- /*
- usleep(200000);
- */
-}
-
-void
-Client_Sig_Handler::DisplayPicture(void)
-{
- // ACE_DEBUG ((LM_DEBUG,"inside DisplayPicture\n"));
- int toDisplay = 1;
- int count = timerCount;
-
- if ((shared->cmd != CmdPLAY &&
- shared->cmd != CmdFF &&
- shared->cmd != CmdFB) ||
- lastCount == count)
- ACE_ERROR ((LM_ERROR,"Returning from first if in DisplayPicture\n"));
- if (timer_on >4) /* 4 is a magic number */
- {
- this->stop_timer();
-
- // stop both the audio and video.
- this->command_handler_->stop ();
-
- /* tries to rewind and play again */
- if (shared->cmd == CmdPLAY && shared->loopBack)
- loopBack();
-
- ACE_ERROR ((LM_ERROR,"Returning because timer_on > 4\n"));
- }
- /*
- Fprintf(stderr, "CTR in diplayPicture().\n");
- */
- {
- int i, j;
- FrameBlock *buf, *next;
-#if 0
- if (shared->cmd == CmdPLAY && rtplay &&
- (i = shared->nextFrame - shared->firstGopFrames) > 0) {
- j = (i / shared->patternSize) % shared->sendPatternGops;
- i %= shared->patternSize;
- if (shared->pattern[i] != 'B') {
- while (i > 0) {
- if (shared->pattern[--i] != 'B') break;
- }
- }
- toDisplay = (shared->sendPattern + j * shared->patternSize)[i];
- }
- else if (shared->cmd != CmdPLAY) {
- if (last_disp_fid != shared->nextGroup) toDisplay = 1;
- else toDisplay = 0;
- }
- if (toDisplay)
-#endif
- {
- if (shared->cmd == CmdPLAY && !rtplay) { /* if play with best effort */
- while (VDcheckMsg() <= 0) /* keep sleeping for 10 millisec until a decoded
- frame show up in VD buffer */
- usleep(10000);
- }
-#ifdef STAT
- if (shared->collectStat)
- {
- shared->stat.VBfillLevel[shared->nextFrame] =
- shared->VBheadFrame - shared->nextFrame;
- i = VDcheckMsg();
- if (i < 0) i = 0;
- else if (i >= MAX_VDQUEUE_SIZE) i = MAX_VDQUEUE_SIZE - 1;
- shared->stat.VDqueue[i] ++;
- }
-#endif
- toDisplay = 0;
- for (;;)
- {
- buf = VDpeekMsg();
-
- if (buf == NULL) {
- // ACE_DEBUG ((LM_DEBUG,"Null buffer "));
- goto loop_end;
- }
-
- switch (shared->cmd)
- {
- // ACE_DEBUG ((LM_DEBUG,"nextFrame = %d,nextGroup\n",shared->nextFrame,shared->nextGroup));
- int position;
- case CmdPLAY:
- position = shared->nextFrame;
- // ACE_DEBUG ((LM_DEBUG,"nextFrame = %d,nextGroup\n",shared->nextFrame,shared->nextGroup));
- /*
- Fprintf(stderr, "CTR PLAY: buf->display %d, position %d\n",
- buf->display, position);
- */
- if (buf->display == position)
- { /* display it */
- buf = VDgetMsg();
- shared->nextGroup = buf->gop + 1;
-#ifdef STAT
- shared->stat.CTRdispOnTime ++;
-#endif
- goto display_picture;
- }
- else if (buf->display > position)
- { /* too early, wait for future display */
- goto loop_end;
- }
- else /* this picture too late */
- {
- // this line gets the buffer or dequeues from the shared memory queue
- buf = VDgetMsg();
- if (((next = VDpeekMsg()) == NULL || next->display > position) &&
- buf->display > last_disp_fid) {
-#ifdef STAT
- shared->stat.CTRdispLate ++;
-#endif
- /* buf is the last one, or next too to early, display it anyway */
- goto display_picture;
- }
- else /* next not too early, discard buf */
- {
-#ifdef STAT
- if (buf->display < last_disp_fid)
- shared->stat.CTRdropOutOrder ++;
- else
- shared->stat.CTRdropLate ++;
-#endif
- /*
- Fprintf(stderr, "CTR drops frame display=%d, shared->nextFrame=%d\n",
- buf->display, shared->nextFrame);
- */
- VDreclaimMsg(buf);
- continue;
- }
- }
- break;
- case CmdFF:
- position = shared->nextGroup;
- if (buf->gop == position)
- { /* display it */
- buf = VDgetMsg();
- shared->nextFrame = buf->display;
- // ACE_DEBUG ((LM_DEBUG,"nextFrame = %d\n",shared->nextFrame));
- goto display_picture;
- }
- else if (buf->gop > position)
- { /* hold it for future display */
- goto loop_end;
- }
- else /* discard late picture */
- {
- buf = VDgetMsg();
- if ((next = VDpeekMsg()) == NULL || next->gop > position)
- /* buf is the last one, or next too to early, display it anyway */
- goto display_picture;
- else /* next not too early, discard buf */
- {
- VDreclaimMsg(buf);
- continue;
- }
- }
- break;
- case CmdFB:
- position = shared->nextGroup;
- if (buf->gop == position)
- { /* display it */
- buf = VDgetMsg();
- shared->nextFrame = buf->display;
- // ACE_DEBUG ((LM_DEBUG,"nextFrame = %d\n",shared->nextFrame));
- goto display_picture;
- }
- else if (buf->gop < position)
- { /* hold it for future display */
- goto loop_end;
- }
- else /* discard late picture */
- {
- buf = VDgetMsg();
- if ((next = VDpeekMsg()) == NULL || next->gop < position)
- /* buf is the last one, or next too to early, display it anyway */
- goto display_picture;
- else /* next not too early, discard buf */
- {
- VDreclaimMsg(buf);
- continue;
- }
- }
- break;
- default:
- goto loop_end;
- }
- }
- display_picture:
- toDisplay = 1;
- if (shared->cmd == CmdPLAY) last_disp_fid = buf->display;
- else last_disp_fid = buf->gop;
-#ifdef STAT
- if (shared->live) displayedFrames ++;
- if (shared->collectStat)
- shared->stat.VPframesDisplayed[buf->display >> 3] |= 1 << (buf->display % 8);
-#endif
- {
- unsigned char tmp = CmdVPdisplayFrame;
- CmdWrite(&tmp, 1);
- }
- CmdWrite((unsigned char *)&buf, sizeof(char *));
- loop_end:;
- }
- }
-
- if (shared->cmd == CmdPLAY)
- {
- shared->nextFrame += rtplay ? count - lastCount : 1;
- if (shared->nextFrame >= shared->totalFrames)
- {
- timer_on ++;
- shared->nextFrame = shared->totalFrames;
- }
-
- /* following is frameRate feedback algorithm */
- if (fbstate && toDisplay && rtplay) {
- static Filter *fr = NULL; /* frame-rate filter */
- static int start; /* feedback action time, in microseconds */
- static int delay; /* time to delay after each action, and to charge
- the filter after action-delay */
- static int pretime; /* time of previous frame, in microseconds */
- static int throw_outlier = 0;
- /* tag to throw away outlier. In case there are outliers, this
- tag is flipped by the algorithm, so that If there are two
- consecutive sample deviating very much from the filtered mean
- value, the second is not considered outlier. This may mean
- that the frame rate has dropped significantly. */
- static double vr; /* filtered frame-rate value, in microseconds/frame */
- double r, nr;
- int t = get_usec();
-
- switch (fbstate) {
- case 3: /* working, monitoring */
- {
- int interval = get_duration(pretime, t);
- if (throw_outlier) {
- if (interval >> 2 >= vr) {
- /* at least four times the filtered mean value to be
- considered outlier */
- /* In case an outlier is detected and thrown away, then
- the following sample will never be classified as an
- outlier, and the current time is recorded */
- throw_outlier = 0;
- pretime = t;
- Fprintf(stderr, "CTR detected a gap %d (vr = %d) us\n",
- interval, (int)vr);
- break;
- }
- }
- else {
- throw_outlier = 1;
- }
- vr = DoFilter(fr, (double)interval);
- }
- pretime = t;
-
- r = minupf / vr; /* convert the display fps to percentage of maxfr */
-
- nr = 0; /* This variable contains the newly computed server frame rate */
-
- /* let nr oscillate around 1.5 ~ 2.5 */
- if (min(frate, maxrate) - r >= 3.0 * adjstep) {
- /* pipeline is considered overloaded if server fps is more than 3 adjsteps
- higher than display fps */
- nr = min(frate, maxrate) - adjstep; /* slow down server frame rate
- one step */
- if (fb_startup) { /* startup feedback action: jump set the server fps
- to a value close to actually measure display
- frame rate */
- fb_startup = 0;
- while (nr >= r + 2.5 * adjstep) {
- nr -= adjstep;
- }
- }
- }
- else if (frate - r <= 0.5 * adjstep && frate < maxrate) {
- /* pipeline load is considered too light if the server frame rate
- is less than 0.5fps higher than display frame rate, while the server
- fps is no maximum yet. The server fps then is stepped up. */
- nr = min(frate + adjstep, maxrate);
- }
- if (nr > 0) { /* nr = 0 if not feedback action needs to be taken */
- shared->frameRateLimit = maxfr * nr;
- compute_sendPattern();
- /*
- fprintf(stderr,
- "CTR adjust frameRate to %lf, vr=%lf minupf=%d, r=%lf, frate=%lf, nr=%lf\n",
- shared->frameRateLimit, vr, minupf, r, frate, nr);
- */
- frate = nr; /* remember new server frame rate */
- shared->qosRecomputes ++;
- start = t; /* remember the action time */
- /* delay for some time before restarts, to let feedback take effect */
- delay = shared->usecPerFrame * (shared->VBheadFrame - shared->nextFrame) +
- shared->playRoundTripDelay;
- if (delay < 0) delay = shared->usecPerFrame;
- fbstate = 4;
- }
- break;
- case 4: /* delay and reset after action*/
- if (get_duration(start, t) >= delay) {
- /*
- fprintf(stderr,
- "CTR VB from s2 to s3, vr %lf, frate %lf, maxrate %lf, step %lf\n",
- vr, frate, maxrate, adjstep);
- */
- fr = ResetFilter(fr, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- delay = shared->usecPerFrame *
- max(shared->sendPatternGops * shared->patternSize,
- shared->config.filterPara);
- /* charge filter for time */
- start = pretime = t;
- throw_outlier = 0;
- fbstate = 2;
- }
- break;
- case 2: /* charge the filter */
- {
- int interval = get_duration(pretime, t);
- if (throw_outlier) {
- if (interval >> 2 >= vr) { /* at least four times the previous average */
- throw_outlier = 0;
- pretime = t;
- Fprintf(stderr, "CTR detected a gap %d (vr = %d) us\n",
- interval, (int)vr);
- break;
- }
- }
- else {
- throw_outlier = 1;
- }
- vr = DoFilter(fr, (double)interval);
- }
- pretime = t;
- if (get_duration(start, t) >= delay) {
- /*
- fprintf(stderr,
- "CTR VB from s2 to s3, vr %lf, frate %lf, maxrate %lf, step %lf\n",
- vr, frate, maxrate, adjstep);
- */
- fbstate = 3;
- }
- break;
- case 1: /* start or speed change, wait until speed data consistant */
- if (shared->currentUPF == shared->usecPerFrame) {
- if (fr == NULL) {
- fr = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- }
- else {
- fr = ResetFilter(fr, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- }
- if (fr == NULL) {
- ACE_OS::perror ("CTR failed to allocate space for fr filter");
- fbstate = 0;
- }
- vr = DoFilter(fr, (double)shared->usecPerFrame);
- delay = shared->usecPerFrame *
- shared->sendPatternGops * shared->patternSize;
- /* charge filter for some time */
- pretime = start = t;
- throw_outlier = 0;
- fbstate = 2;
- }
- break;
- default:
- fprintf(stderr, "CTR error: unknown feedback state: %d\n", fbstate);
- fbstate = 1;
- break;
- }
- }
- /* end of frame rate control algorithm */
-
- }
- else if (shared->cmd == CmdFF)
- {
- shared->nextGroup += count - lastCount;
- if (shared->nextGroup >= shared->totalGroups)
- {
- timer_on ++;
- shared->nextGroup = shared->totalGroups - 1;
- }
- }
- else
- {
- shared->nextGroup -= count - lastCount;
- if (shared->nextGroup < 0)
- {
- timer_on ++;
- shared->nextGroup = 0;
- }
- }
- lastCount = count;
-}
-
-void
-Client_Sig_Handler::TimerProcessing (void)
-{
- // cerr << "Timerprocessing signal went off\n";
- if (audioSocket >= 0 && shared->cmd == CmdPLAY)
- {
- if (videoSocket < 0)
- this->PlayAudioOnly ();
- else if (rtplay)
- {
- // cerr << "TimerProcessing: calling PlayAudio ()\n";
- int res = PlayAudio();
- /* and also tries to sync audio and video */
- if (res)
- {
- int jit;
- res = forward - audioForward;
- jit = (res>0 ? res : -res);
- jit = (int)(((double)jit / (double)shared->samplesPerSecond) * 1000000.0);
- if (res < -audioForward/2) /* needs to speedup the clock */
- {
- struct itimerval val;
- getitimer(ITIMER_REAL, &val);
- if ((int)val.it_value.tv_usec > jit)
- val.it_value.tv_usec -= jit;
- else
- {
- timer_signals_skip ++;
- val.it_value.tv_usec = 2;
- }
- setitimer(ITIMER_REAL, &val, NULL);
- }
- else if (res > audioForward) /* needs to slow down the clock */
- {
- struct itimerval val;
- /*
- val.it_interval.tv_sec = val.it_value.tv_sec = 0;
- val.it_interval.tv_usec = val.it_value.tv_usec = 0;
- */
- getitimer(ITIMER_REAL, &val);
- val.it_value.tv_usec += (jit % 1000000);
- val.it_value.tv_sec += (jit / 1000000);
- setitimer(ITIMER_REAL, &val, NULL);
- }
- /*
- if (res < -audioForward || res > audioForward)
- */
- if (res < -16000 || res > 16000)
- {
- Fprintf(stderr, "Audio forward jit %d samples\n", res);
- }
- }
- }
- }
- if (videoSocket >= 0 &&
- (shared->cmd == CmdPLAY || shared->cmd == CmdFF || shared->cmd == CmdFB)) {
- // cerr << "Timerprocessing signal-handler done\n";
- DisplayPicture();
- }
-
-}
-
-// -----------------------------------------------------------
-// Audio_Client_StreamEndPoint methods
-
-Audio_Client_StreamEndPoint::Audio_Client_StreamEndPoint (Command_Handler *command_handler,
- char *host)
- :command_handler_ (command_handler),
- host_ (host)
-{
-}
-
-int
-Audio_Client_StreamEndPoint::handle_open (void)
-{
- return -1;
-}
-
-int
-Audio_Client_StreamEndPoint::handle_close (void)
-{
- return -1;
-}
-
-// called by the framework before calling connect. Here we create our
-// flow spec which is nothing but hostname::port_number of the
-// datagram.
-CORBA::Boolean
-Audio_Client_StreamEndPoint::handle_preconnect (AVStreams::flowSpec &the_spec)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) handle_preconnect called\n"));
- CORBA::UShort server_port;
- ACE_INET_Addr local_addr;
-
- // Get the local UDP address
- if (this->dgram_.open (ACE_Addr::sap_any) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) datagram open failed %p\n"),0);
-
- // set the socket buffer sizes to 64k.
- int sndbufsize = ACE_DEFAULT_MAX_SOCKET_BUFSIZ;
- int rcvbufsize = ACE_DEFAULT_MAX_SOCKET_BUFSIZ;
-
- if (this->dgram_.set_option (SOL_SOCKET,
- SO_SNDBUF,
- (void *) &sndbufsize,
- sizeof (sndbufsize)) == -1
- && errno != ENOTSUP)
- return 0;
- else if (this->dgram_.set_option (SOL_SOCKET,
- SO_RCVBUF,
- (void *) &rcvbufsize,
- sizeof (rcvbufsize)) == -1
- && errno != ENOTSUP)
- return 0;
-
- if (this->dgram_.get_local_addr (local_addr) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram get local addr failed %p"),-1);
- // form a string
- char client_address_string [BUFSIZ];
- ::sprintf (client_address_string,
- "%s:%d",
- this->host_ == 0 ? local_addr.get_host_name ():this->host_,
- local_addr.get_port_number ());
- the_spec.length (1);
- the_spec [0] = CORBA::string_dup (client_address_string);
-
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) client flow spec is %s\n",
- client_address_string));
- return 1;
-}
-
-// called by the A/V framework after calling connect. Passes the
-// server streamendpoints' flowspec which we use to connect our
-// datagram socket.
-CORBA::Boolean
-Audio_Client_StreamEndPoint::handle_postconnect (AVStreams::flowSpec& server_spec)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) handle_postconnect called \n"));
-
- // Take the first string of the sequence .
- ACE_INET_Addr server_udp_addr (server_spec [0]);
-
- server_udp_addr.dump ();
- if (ACE_OS::connect (this->dgram_.get_handle (),(sockaddr *) server_udp_addr.get_addr (),
- server_udp_addr.get_size ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) datagram connect failed %p\n"),-1);
- // Now set the data handle of the command handler.
-
- this->command_handler_->set_audio_data_handle (this->dgram_.get_handle ());
- return 0;
-}
-
-int
-Audio_Client_StreamEndPoint::handle_start (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env)
-
-{
- return -1;
-}
-
-int
-Audio_Client_StreamEndPoint::handle_stop (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env)
-
-{
- return -1;
-}
-
-int
-Audio_Client_StreamEndPoint::handle_destroy (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env)
-
-{
- return -1;
-}
-
-ACE_HANDLE
-Audio_Client_StreamEndPoint::get_handle (void)
-{
- return this->dgram_.get_handle ();
-}
-
-// -----------------------------------------------------------
-// Video_Client_StreamEndPoint methods
-
-Video_Client_StreamEndPoint::Video_Client_StreamEndPoint (Command_Handler *command_handler,
- char *host)
- :command_handler_ (command_handler),
- host_ (host)
-{
-}
-
-int
-Video_Client_StreamEndPoint::handle_open (void)
-{
- return -1;
-}
-
-int
-Video_Client_StreamEndPoint::handle_close (void)
-{
- return -1;
-}
-
-CORBA::Boolean
-Video_Client_StreamEndPoint::handle_preconnect (AVStreams::flowSpec &the_spec)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) handle_preconnect called\n"));
- CORBA::UShort server_port;
- ACE_INET_Addr local_addr;
-
- // Get the local UDP address
- if (this->dgram_.open (ACE_Addr::sap_any) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) datagram open failed %p\n"),0);
-
- // set the socket buffer sizes to 64k.
- int sndbufsize = ACE_DEFAULT_MAX_SOCKET_BUFSIZ;
- int rcvbufsize = ACE_DEFAULT_MAX_SOCKET_BUFSIZ;
-
- if (this->dgram_.set_option (SOL_SOCKET,
- SO_SNDBUF,
- (void *) &sndbufsize,
- sizeof (sndbufsize)) == -1
- && errno != ENOTSUP)
- return 0;
- else if (this->dgram_.set_option (SOL_SOCKET,
- SO_RCVBUF,
- (void *) &rcvbufsize,
- sizeof (rcvbufsize)) == -1
- && errno != ENOTSUP)
- return 0;
-
- if (this->dgram_.get_local_addr (local_addr) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram get local addr failed %p"),-1);
- // form a string
- char client_address_string [BUFSIZ];
- ::sprintf (client_address_string,
- "%s:%d",
- this->host_ == 0 ?local_addr.get_host_name ():this->host_,
- local_addr.get_port_number ());
- the_spec.length (1);
- the_spec [0] = CORBA::string_dup (client_address_string);
-
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) client flow spec is %s\n",
- client_address_string));
- return 1;
-}
-
-CORBA::Boolean
-Video_Client_StreamEndPoint::handle_postconnect (AVStreams::flowSpec& server_spec)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) handle_postconnect called \n"));
-
- // Take the first string of the sequence .
- ACE_INET_Addr server_udp_addr (server_spec [0]);
-
- server_udp_addr.dump ();
- if (ACE_OS::connect (this->dgram_.get_handle (),(sockaddr *) server_udp_addr.get_addr (),
- server_udp_addr.get_size ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) datagram connect failed %p\n"),-1);
- // Now set the data handle of the command handler.
-
- this->command_handler_->set_video_data_handle (this->dgram_.get_handle ());
- return 0;
-}
-
-int
-Video_Client_StreamEndPoint::handle_start (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env)
-
-{
- return -1;
-}
-
-int
-Video_Client_StreamEndPoint::handle_stop (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env)
-
-{
- return -1;
-}
-
-int
-Video_Client_StreamEndPoint::handle_destroy (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env)
-
-{
- return -1;
-}
-
-ACE_HANDLE
-Video_Client_StreamEndPoint::get_handle (void)
-{
- return this->dgram_.get_handle ();
-}
-
-// ---------------------------------------------------------
-// Video_Client_VDev methods.
-
-Video_Client_VDev::Video_Client_VDev (void)
- : video_control_ (0),
- command_handler_ (0)
-{
-}
-
-
-Video_Client_VDev::Video_Client_VDev (Command_Handler *command_handler)
- :video_control_ (0),
- command_handler_ (command_handler)
-{
-}
-
-CORBA::Boolean
-Video_Client_VDev::set_media_ctrl (CORBA::Object_ptr media_ctrl,
- CORBA::Environment &env)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Video_Client_VDev::set_media_ctrl ()\n"));
- this->video_control_ = Video_Control::_narrow (media_ctrl,
- env);
-
- TAO_CHECK_ENV_RETURN (env,0);
-
- this->command_handler_->set_video_control (this->video_control_);
-
- return 1;
-}
-
-// -----------------------------------------------------------
-// Audio_Client_VDev methods.
-
-Audio_Client_VDev::Audio_Client_VDev (void)
- : audio_control_ (0),
- command_handler_ (0)
-{
-}
-
-
-Audio_Client_VDev::Audio_Client_VDev (Command_Handler *command_handler)
- :audio_control_ (0),
- command_handler_ (command_handler)
-{
-}
-
-CORBA::Boolean
-Audio_Client_VDev::set_media_ctrl (CORBA::Object_ptr media_ctrl,
- CORBA::Environment &env)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) Audio_Client_VDev::set_media_ctrl ()\n"));
- this->audio_control_ = Audio_Control::_narrow (media_ctrl,
- env);
-
- TAO_CHECK_ENV_RETURN (env,0);
-
- this->command_handler_->set_audio_control (this->audio_control_);
-
- return 1;
-}
-
-// -----------------------------------------------------------
-// Video_Endpoint_Reactive_Strategy_A methods
-
-Video_Endpoint_Reactive_Strategy_A::Video_Endpoint_Reactive_Strategy_A (TAO_ORB_Manager *orb_manager,
- Command_Handler *command_handler)
- : TAO_AV_Endpoint_Reactive_Strategy_A<Video_Client_StreamEndPoint,Video_Client_VDev,AV_Null_MediaCtrl> (orb_manager),
- command_handler_ (command_handler)
-{
-}
-
-Video_Endpoint_Reactive_Strategy_A::~Video_Endpoint_Reactive_Strategy_A (void)
-{
- // delete this->vdev_;
- // delete this->endpoint_;
-}
-
-int
-Video_Endpoint_Reactive_Strategy_A::make_vdev (Video_Client_VDev *&vdev)
-{
- ACE_NEW_RETURN (this->vdev_,
- Video_Client_VDev (this->command_handler_),
- -1);
- vdev = this->vdev_;
- return 0;
-}
-
-int
-Video_Endpoint_Reactive_Strategy_A::make_stream_endpoint (Video_Client_StreamEndPoint *&endpoint)
-{
- ACE_NEW_RETURN (this->endpoint_,
- Video_Client_StreamEndPoint (this->command_handler_,
- this->command_handler_->get_data_host ()),
- -1);
- endpoint = this->endpoint_;
- return 0;
-}
-
-// ------------------------------------------------------------
-// Audio_Endpoint_Reactive_Strategy_A methods
-
-Audio_Endpoint_Reactive_Strategy_A::Audio_Endpoint_Reactive_Strategy_A (TAO_ORB_Manager *orb_manager,
- Command_Handler *command_handler)
- : TAO_AV_Endpoint_Reactive_Strategy_A<Audio_Client_StreamEndPoint,Audio_Client_VDev,AV_Null_MediaCtrl> (orb_manager),
- command_handler_ (command_handler)
-{
-}
-
-Audio_Endpoint_Reactive_Strategy_A::~Audio_Endpoint_Reactive_Strategy_A (void)
-{
- // delete this->vdev_;
- // delete this->endpoint_;
-}
-
-int
-Audio_Endpoint_Reactive_Strategy_A::make_vdev (Audio_Client_VDev *&vdev)
-{
- ACE_NEW_RETURN (this->vdev_,
- Audio_Client_VDev (this->command_handler_),
- -1);
- vdev = this->vdev_;
- return 0;
-}
-
-int
-Audio_Endpoint_Reactive_Strategy_A::make_stream_endpoint (Audio_Client_StreamEndPoint *&endpoint)
-{
- ACE_NEW_RETURN (this->endpoint_,
- Audio_Client_StreamEndPoint (this->command_handler_,
- this->command_handler_->get_data_host ()),
- -1);
- endpoint = this->endpoint_;
- return 0;
-}
-
-//--------------------------------------------------------------------------------
-
-Receiver_i::Receiver_i (Command_Handler *handler)
- :command_handler_ (handler)
-{
-}
-
-void
-Receiver_i::push_mmdevice (CORBA::Object_ptr audio_mmdevice,
- const char *audio_file,
- CORBA::Object_ptr video_mmdevice,
- const char *video_file,
- CORBA::Environment&)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t)Receiver_i::push_audio_mmdevice"));
- this->command_handler_->set_mmdevice (audio_mmdevice,audio_file,video_mmdevice,video_file);
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class TAO_AV_Endpoint_Reactive_Strategy<Video_Client_StreamEndPoint,Video_Client_VDev,AV_Null_MediaCtrl>;
-template class TAO_AV_Endpoint_Reactive_Strategy_A<Video_Client_StreamEndPoint,Video_Client_VDev,AV_Null_MediaCtrl>;
-template class TAO_AV_Endpoint_Reactive_Strategy<Audio_Client_StreamEndPoint,Audio_Client_VDev,AV_Null_MediaCtrl>;
-template class TAO_AV_Endpoint_Reactive_Strategy_A<Audio_Client_StreamEndPoint,Audio_Client_VDev,AV_Null_MediaCtrl>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate TAO_AV_Endpoint_Reactive_Strategy<Video_Client_StreamEndPoint,Video_Client_VDev,AV_Null_MediaCtrl>
-#pragma instantiate TAO_AV_Endpoint_Reactive_Strategy_A<Video_Client_StreamEndPoint,Video_Client_VDev,AV_Null_MediaCtrl>
-#pragma instantiate TAO_AV_Endpoint_Reactive_Strategy<Audio_Client_StreamEndPoint,Audio_Client_VDev,AV_Null_MediaCtrl>
-#pragma instantiate TAO_AV_Endpoint_Reactive_Strategy_A<Audio_Client_StreamEndPoint,Audio_Client_VDev,AV_Null_MediaCtrl>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h
deleted file mode 100644
index a6ec7b1d646..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h
+++ /dev/null
@@ -1,617 +0,0 @@
-// $Id$
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-#include "ace/OS.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-// ============================================================================
-//
-// = LIBRARY
-// mpeg_client
-//
-// = FILENAME
-// Command_Handler.h
-//
-// = DESCRIPTION
-// Defines the client side components of the A/V framework like
-// video stream endpoints ,video multi media device, video virtual device.
-//
-// = AUTHORS
-// Sumedh Mungee (sumedh@cs.wustl.edu)
-// Nagarajan Surendran (naga@cs.wustl.edu)
-//
-// ============================================================================
-
-
-#ifndef AV_COMMAND_HANDLER_H
-#define AV_COMMAND_HANDLER_H
-
-#include "ace/Reactor.h"
-#include "ace/Event_Handler.h"
-#include "ace/ARGV.h"
-#include "tao/TAO.h"
-#include "mpeg_shared/Video_ControlC.h"
-#include "orbsvcs/CosNamingC.h"
-#include "ace/SOCK_Dgram.h"
-#include "ace/SOCK_Connector.h"
-#include "mpeg_shared/Audio_ControlC.h"
-#include "orbsvcs/AV/AVStreams_i.h"
-#include "ace/High_Res_Timer.h"
-#include "ace/Acceptor.h"
-#include "orbsvcs/Naming/Naming_Utils.h"
-#include "mpeg_shared/ReceiverS.h"
-#include "ace/Get_Opt.h"
-#include "ab.h"
-#include "vb.h"
-
-class Command_Handler;
-
-
-class Receiver_i
- :public POA_Receiver
-{
- public:
- Receiver_i (Command_Handler *handler);
- // constructor.
-
- void push_mmdevice (CORBA::Object_ptr audio_mmdevice,
- const char* audio_file,
- CORBA::Object_ptr video_mmdevice,
- const char *video_file,
- CORBA::Environment&);
-
- private:
- Command_Handler *command_handler_;
- // Reference to command handler.
-};
-
-class Video_Client_StreamEndPoint
- :public virtual TAO_Client_StreamEndPoint
-{
- // = TITLE
- // Defines a video client StreamEndpoint class
- // = DESCRIPTION
- // Makes use of a connected dgram to receive data from the server
- // side stream endpoint.
-public:
- Video_Client_StreamEndPoint (Command_Handler *command_handler =0,
- char *host =0);
- // constructor
-
- virtual int handle_open (void);
- // called when streamendpoint is instantiated
-
- virtual int handle_close (void);
- // called when streamendpoint is being destructed
-
- virtual CORBA::Boolean handle_preconnect (AVStreams::flowSpec &the_spec);
- // called before connecting
-
- virtual CORBA::Boolean handle_postconnect (AVStreams::flowSpec &the_spec);
- // called after connecting
-
- virtual int handle_start (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env) ;
-
- virtual int handle_stop (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env) ;
-
- virtual int handle_destroy (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env);
-
- virtual ACE_HANDLE get_handle (void);
- // gets the underlying socket descriptor from the SOCK_Dgram
-
-private:
- ACE_SOCK_Dgram dgram_;
- // The datagram used for streaming.
-
- Command_Handler *command_handler_;
- // Reference to the command handler
-
- char *host_;
- // host interface to bind to.
-};
-
-class Audio_Client_StreamEndPoint
- :public virtual TAO_Client_StreamEndPoint
-{
- // = TITLE
- // Defines a audio client stream endpoint
- // = DESCRIPTION
- // Uses a connected dgram to receive data from the audio server.
-public:
- Audio_Client_StreamEndPoint (Command_Handler *command_handler = 0,
- char *host = 0);
- // constructor
-
- virtual int handle_open (void);
- // called when streamendpoint is instantiated
-
- virtual int handle_close (void);
- // called when streamendpoint is being destructed
-
- virtual CORBA::Boolean handle_preconnect (AVStreams::flowSpec &the_spec);
- // called before connecting
-
- virtual CORBA::Boolean handle_postconnect (AVStreams::flowSpec &the_spec);
- // called after connecting
-
- virtual int handle_start (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env) ;
-
- virtual int handle_stop (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env) ;
-
- virtual int handle_destroy (const AVStreams::flowSpec &the_spec,
- CORBA::Environment &env);
-
- virtual ACE_HANDLE get_handle (void);
- // gets the underlying socket descriptor from the SOCK_Dgram
-
-private:
- ACE_SOCK_Dgram dgram_;
- // The datagram used for streaming.
-
- Command_Handler *command_handler_;
- // Reference to the command handler.
-
- char *host_;
- // host interface to bind to.
-};
-
-
-class Video_Client_VDev
- : public virtual TAO_VDev
-{
- // = TITLE
- // Defines a class that is a client side Virtual device for video.
- // = Description
- // Needs a pointer to the command handler object so that it can
- // set the video control pointer of the command handler.
-public:
- Video_Client_VDev (void);
- Video_Client_VDev (Command_Handler *command_handler);
-
-protected:
- CORBA::Boolean set_media_ctrl (CORBA::Object_ptr media_ctrl,
- CORBA::Environment& env);
-
-private:
- Video_Control_ptr video_control_;
- // The video controller
-
- Command_Handler *command_handler_;
- // pointer to the command handler object
-};
-
-
-class Audio_Client_VDev
- : public virtual TAO_VDev
-{
- // = TITLE
- // Defines a client side audio virtual device
- // = DESCRIPTION
- // Takes a pointer to a command handler object so that it can set
- // the audio control object pointer of the command handler.
-public:
- Audio_Client_VDev (void);
- Audio_Client_VDev (Command_Handler *command_handler);
-
-protected:
- CORBA::Boolean set_media_ctrl (CORBA::Object_ptr media_ctrl,
- CORBA::Environment& env);
-
-private:
- Audio_Control_ptr audio_control_;
- // The Audio controller
-
- Command_Handler *command_handler_;
- // pointer to the command handler object
-};
-
-class Video_Endpoint_Reactive_Strategy_A
- : public TAO_AV_Endpoint_Reactive_Strategy_A<Video_Client_StreamEndPoint,Video_Client_VDev,AV_Null_MediaCtrl>
-{
- // = TITLE
- // Implementation of the Reactive Strategy for the client
- // video MMDevice.
- // = DESCRIPTION
- // Takes a command handler object pointer. It overrides the
- // make_vdev and make_stream_endpoint hooks to create the video
- // vdev and video streamendpoint with command handler object pointers.
-public:
- Video_Endpoint_Reactive_Strategy_A (TAO_ORB_Manager *orb_manager,
- Command_Handler *command_handler);
- // constructor . The orb manager is needed for the TAO_AV_Endpoint_Reactive_Strategy_A.
-
- virtual ~Video_Endpoint_Reactive_Strategy_A (void);
- // destructor.
-
- virtual int make_vdev (Video_Client_VDev *&vdev);
- // hook to make our Vdev with the pointer to command handler.
- virtual int make_stream_endpoint (Video_Client_StreamEndPoint *& endpoint);
- // hook to make our streamendpoint taking a command handler pointer
-private:
- Command_Handler *command_handler_;
- // pointer to command handler object
-
- Video_Client_VDev *vdev_;
- // reference to the created vdev .
-
- Video_Client_StreamEndPoint *endpoint_;
- // reference to the created streamendpoint.
-};
-
-class Audio_Endpoint_Reactive_Strategy_A
- : public TAO_AV_Endpoint_Reactive_Strategy_A<Audio_Client_StreamEndPoint,Audio_Client_VDev,AV_Null_MediaCtrl>
-{
- // = TITLE
- // Implementation of the Reactive Strategy for the client audio
- // MMDevice
- // = DESCRIPTION
- // Takes a command handler object pointer. It overrides the
- // make_vdev and make_stream_endpoint hooks to create the audio
- // vdev and audio streamendpoint with command handler object pointers.
-public:
- Audio_Endpoint_Reactive_Strategy_A (TAO_ORB_Manager *orb_manager,
- Command_Handler *command_handler);
- // constructor . The orb manager is needed for the TAO_AV_Endpoint_Reactive_Strategy_A.
-
- ~Audio_Endpoint_Reactive_Strategy_A (void);
- // Destructor.
-
- virtual int make_vdev (Audio_Client_VDev *&vdev);
- // hook to make our Vdev with the pointer to command handler.
-
- virtual int make_stream_endpoint (Audio_Client_StreamEndPoint *& endpoint);
- // hook to make our streamendpoint taking a command handler pointer
-
-private:
- Command_Handler *command_handler_;
- // pointer to command handler object
-
- Audio_Client_VDev *vdev_;
- // reference to the vdev that was created.
-
- Audio_Client_StreamEndPoint *endpoint_;
- //reference to the created streamendpoint.
-
-};
-
-class Client_Sig_Handler
- : public virtual ACE_Event_Handler
- // = TITLE
- // Defines the signal handler class for the client timer processing
- //
- // = DESCRIPTION
- // Checks if the video is ready and refreshes the display and
- // also plays the audio packets in the timer processing.
-{
-public:
- Client_Sig_Handler (Command_Handler *command_handler);
- // We need the command handler to call close ()
-
- ~Client_Sig_Handler (void);
- // Destructor
-
- virtual ACE_HANDLE get_handle (void) const;
-
- int register_handler (void);
- // this will register this sig_handler
- // with the reactor for SIGCHLD,SIGTERM,SIGINT
-
- int remove_handler (void);
- // removes the handlers.
-
- virtual int shutdown (ACE_HANDLE,
- ACE_Reactor_Mask);
- // handles the reactor shutdown
-
- virtual int handle_input (ACE_HANDLE);
- // handle input on the dummy handle.
-
- virtual int handle_signal (ACE_HANDLE signum,
- siginfo_t * = 0,
- ucontext_t* = 0);
- // handles SIGALRM
-
- void TimerHandler (int signum);
-
- void stop_timer (void);
-
- void DisplayPicture (void);
- // display the picture.
-
- void TimerProcessing (void);
-
- void PlayAudioOnly (void);
-
-private:
- ACE_HANDLE handle_;
- // dummy handle for the sig handler.
-
- ACE_Sig_Set sig_set;
- // the signal set
-
- Command_Handler *command_handler_;
- // We need the command handler to call close ()
-
-};
-
-class Decode_Notification_Handler :public ACE_Event_Handler
-{
-public:
- Decode_Notification_Handler (Command_Handler *command_handler);
- // constructor.
-
- virtual ACE_HANDLE get_handle (void) const;
- // Get the Notification handle.
-
- virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
- // called when input events occur.
-private:
- Command_Handler *command_handler_;
-};
-
-enum Suspended
-{
- UNSUSPENDED = 0,INIT=1,STEP=2,POSITION=3
-};
-
-class Command_Handler
- : public virtual ACE_Event_Handler
- // public virtual ACE_Svc_Handler <ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-{
- // = TITLE
- // Defines the event handler class for the client commands
- //
- // = DESCRIPTION
- // This class makes use of a UNIX socket, over which
- // it will receive commands from the GUI
-
-public:
-
- int command_suspended_;
- // flag to indicate whether the GUI handler has been suspended.
-
- int operation_tag_;
- // operation tag for release/press for position.
-
- int position_val_;
- // value of the position button.
-
- Command_Handler (ACE_HANDLE command_handle = ACE_INVALID_HANDLE);
- // Construct this handler with a control (UNIX) handle
-
- ~Command_Handler (void);
- // Destructor
-
- int init (int argc,char **argv);
- // initialize the ORB and NamingService
-
- int run (void);
- // Run the ORB event loop
-
- int handle_timeout (const ACE_Time_Value &,
- const void *arg);
- // handle the timeout
-
- // void stop_timer (void);
- // stop the internal timer
-
- void wait_for_display (Suspended reason);
- // suspends the gui socket handler in the reactor.
-
- TAO_ORB_Manager *orb_manager (void);
- // returns the orbmanager reference
-
- void set_mmdevice (CORBA::Object_ptr audio_mmdevice,
- const char *audio_file,
- CORBA::Object_ptr video_mmdevice,
- const char *video_file);
- // sets the audio mmdevice object ptr.
-
- void set_video_data_handle (ACE_HANDLE data_fd);
- // sets the data handle (UDP) of the command handler
-
- void set_video_control (Video_Control_ptr video_control);
- // called to set the video control object pointer of the comand handler.
-
- void set_audio_data_handle (ACE_HANDLE data_fd);
- // sets the data handle (UDP) of the command handler
-
- void set_audio_control (Audio_Control_ptr video_control);
- // called to set the video control object pointer of the comand handler.
-
- int get_video_control (void);
- // Gets the video control reference thru the property service from
- // the video server virtual device
-
- char *get_data_host (void);
- // gets the data interface to be used.
-
- int resolve_video_reference (void);
- // Resolve the video control reference.
-
- int resolve_audio_reference (void);
- // Resolve the audio control reference.
-
- virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
- // Called when input events occur (e.g., connection or data).
-
- virtual ACE_HANDLE get_handle (void) const;
- // Returns the handle used by the event_handler.
-
- int init_av (void);
- // Initialize both the audio and video
-
- int init_java_av (char *audio_ior,
- char *video_ior,
- char *audio_file,
- char *video_file);
- // initialize both the audio and video reading the iors from java GUI thru a socket.
-
- int init_video_channel (char *videofile);
- // Initializes the video channel by bind the client and server video
- // mmdevices together and gets the video control object.
-
- int init_audio_channel (char *videofile);
- // Initializes the audio channel by bind the client and server audio
- // mmdevices together and gets the video control object.
-
- int stat_stream (CORBA::Char_out ch,CORBA::Long_out size) ;
- // statistics of this stream.
-
- int close (void) ;
- // close the audio and video connections
-
- int stat_sent (void) ;
-
- int fast_forward (void);
-
- int fast_backward (void);
-
- int step (void);
-
- int play (int flag,
- CORBA::Environment& env);
-
- int position_action (int operation_tag);
-
- int position (void);
-
- int position_release (void);
-
- int volume (void);
-
- int balance (void);
-
- int speed (void);
-
- int stop (void);
-
- int stop_playing (void);
-
- int connect_to_video_server (void);
- // resolves the server video mmdevice and binds the local and server
- // mmdevices together.
-
- int connect_to_audio_server (void);
- // resolves the server video mmdevice and binds the local and server
- // mmdevices together.
-
-private:
-
- int parse_args (int argc,char **argv);
- // parses the arguments.
-
- int remove_handlers (void);
- // removes all the handlers.
-
- int busy_;
- // flag to indicate the state of the command handler
-
- CORBA::String_var audio_mmdevice_ior_;
- CORBA::String_var video_mmdevice_ior_;
-
- ACE_SOCK_Dgram video_dgram_;
- // UDP socket on which to send/recv data
-
- ACE_SOCK_Dgram audio_dgram_;
- // Audio UDP socket
-
- ACE_HANDLE video_data_handle_;
- // UDP socket for video
-
- ACE_HANDLE audio_data_handle_;
- // UDP socket for audio
-
- ACE_HANDLE command_handle_;
- // The fd for the UNIX command socket
-
- TAO_ORB_Manager orb_manager_;
- // the ORB manager
-
- TAO_Naming_Client my_name_client_;
- // A Name_Client used to resolve the video_server_mmdevice
-
- Video_Control_ptr video_control_;
- // Video Control CORBA object
-
- AVStreams::MMDevice_var video_server_mmdevice_;
- // The video server multimedia device
-
- Video_Endpoint_Reactive_Strategy_A *video_reactive_strategy_;
- // Strategy for creating stream endpoints
-
- TAO_MMDevice *video_client_mmdevice_;
- // The video client multimedia device
-
- TAO_StreamCtrl *video_streamctrl_;
- // Video stream controller
-
- Audio_Control_ptr audio_control_;
- // Audio Control CORBA object
-
- AVStreams::MMDevice_var audio_server_mmdevice_;
- // The audio server multimedia device
-
- Audio_Endpoint_Reactive_Strategy_A *audio_reactive_strategy_;
- // Strategy for creating stream endpoints
-
- TAO_MMDevice *audio_client_mmdevice_;
- // The audio client multimedia device
-
- TAO_StreamCtrl *audio_streamctrl_;
- // audio stream controller
-
- // ACE_High_Res_Timer timer_;
- // timer to record the time taken for the play sequence.
-
- Receiver_i receiver_;
- // Receive object,called by the agent to give the mmdevice object
- // reference.
-
- char *data_host_;
- // interface name to bind to for data transfer.
-
- Client_Sig_Handler client_sig_handler_;
- // Handler for the signals.
-
- Decode_Notification_Handler notification_handler_;
- // handler for the decode signals from VD process.
-
- int argc_;
- char **argv_;
-};
-
-
-
-#endif /* AV_COMMAND_HANDLER_H */
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile
deleted file mode 100644
index 0d1f562cf3a..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile
+++ /dev/null
@@ -1,1017 +0,0 @@
-#----------------------------------------------------------------------------
-#
-# $Id$
-#
-#----------------------------------------------------------------------------
-
-MAKEFILE = Makefile
-LIBNAME = libmpeg_client
-LIB = $(LIBNAME).a
-SHLIB = $(LIBNAME).$(SOEXT)
-
-ifndef TAO_ROOT
-TAO_ROOT = $(ACE_ROOT)/TAO
-endif
-
-# On non-Windows environment, we should at least define
-# the export_include IDL flag.
-FILES= 24bit \
- 2x2 \
- ab \
- audio \
- decoders \
- file \
- fs2 \
- fs2fast \
- fs4 \
- global \
- gray \
- hybrid \
- hybriderr \
- info \
- jrevdct \
- mb_ordered \
- mono \
- motionvector \
- ordered \
- ordered2 \
- para \
- parseblock \
- prog \
- ui \
- util \
- util32 \
- vb \
- vd \
- video \
- vp \
- Command_Handler
-
-MPEG_ROOT = $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source
-CPPFLAGS += -I$(MPEG_ROOT) -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs
-
-DEFS = $(addsuffix .h,$(FILES))
-LSRC = $(addsuffix .cpp,$(FILES))
-
-##LIBS += -lTAO -lACE
-
-#----------------------------------------------------------------------------
-# Include macros and targets
-#----------------------------------------------------------------------------
-
-include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
-include $(ACE_ROOT)/include/makeinclude/macros.GNU
-include $(TAO_ROOT)/rules.tao.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
-
-#----------------------------------------------------------------------------
-# Local targets (and local hacks)
-#----------------------------------------------------------------------------
-
-LDFLAGS += -L/project/doc/pkg/X11/lib/ -lXm -lXt -lXext -lSM -lICE -lX11 -L/project/doc/pkg/X11/lib -lsocket -lnsl -ldl
-CPPFLAGS += -i -DSH_MEM -DNDEBUG -I/project/doc/pkg/X11/include -L/project/doc/pkg/X11/lib
-
-clean:
- -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state
-
-realclean: clean
- -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES))
-
-# DO NOT DELETE THIS LINE -- g++dep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-
-.obj/24bit.o .obj/24bit.so .shobj/24bit.o .shobj/24bit.so: 24bit.cpp video.h dither.h proto.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/2x2.o .obj/2x2.so .shobj/2x2.o .shobj/2x2.so: 2x2.cpp video.h dither.h proto.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/ab.o .obj/ab.so .shobj/ab.o .shobj/ab.so: ab.cpp ab.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \
- $(ACE_ROOT)/ace/Event_Handler.h \
- $(ACE_ROOT)/ace/Event_Handler.i \
- $(ACE_ROOT)/ace/Reactor.h \
- $(ACE_ROOT)/ace/Handle_Set.h \
- $(ACE_ROOT)/ace/Handle_Set.i \
- $(ACE_ROOT)/ace/Timer_Queue.h \
- $(ACE_ROOT)/ace/Synch.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
- $(ACE_ROOT)/ace/Synch.i \
- $(ACE_ROOT)/ace/Synch_T.h \
- $(ACE_ROOT)/ace/Synch_T.i \
- $(ACE_ROOT)/ace/Thread.h \
- $(ACE_ROOT)/ace/Thread.i \
- $(ACE_ROOT)/ace/Atomic_Op.i \
- $(ACE_ROOT)/ace/Synch_T.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.h \
- $(ACE_ROOT)/ace/Free_List.h \
- $(ACE_ROOT)/ace/Free_List.i \
- $(ACE_ROOT)/ace/Free_List.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.i \
- $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
- $(ACE_ROOT)/ace/Signal.h \
- $(ACE_ROOT)/ace/Containers.h \
- $(ACE_ROOT)/ace/Containers.i \
- $(ACE_ROOT)/ace/Containers_T.h \
- $(ACE_ROOT)/ace/Containers_T.i \
- $(ACE_ROOT)/ace/Containers_T.cpp \
- $(ACE_ROOT)/ace/Malloc.h \
- $(ACE_ROOT)/ace/Malloc.i \
- $(ACE_ROOT)/ace/Malloc_T.h \
- $(ACE_ROOT)/ace/Malloc_T.i \
- $(ACE_ROOT)/ace/Malloc_T.cpp \
- $(ACE_ROOT)/ace/Memory_Pool.h \
- $(ACE_ROOT)/ace/Mem_Map.h \
- $(ACE_ROOT)/ace/Mem_Map.i \
- $(ACE_ROOT)/ace/Memory_Pool.i \
- $(ACE_ROOT)/ace/Signal.i \
- $(ACE_ROOT)/ace/Object_Manager.h \
- $(ACE_ROOT)/ace/Object_Manager.i \
- $(ACE_ROOT)/ace/Managed_Object.h \
- $(ACE_ROOT)/ace/Managed_Object.i \
- $(ACE_ROOT)/ace/Managed_Object.cpp \
- $(ACE_ROOT)/ace/Reactor.i \
- $(ACE_ROOT)/ace/Reactor_Impl.h vb.h
-.obj/audio.o .obj/audio.so .shobj/audio.o .shobj/audio.so: audio.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h
-.obj/decoders.o .obj/decoders.so .shobj/decoders.o .shobj/decoders.so: decoders.cpp decoders.h util.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i video.h \
- proto.h
-.obj/file.o .obj/file.so .shobj/file.o .shobj/file.so: file.cpp video.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h
-.obj/fs2.o .obj/fs2.so .shobj/fs2.o .shobj/fs2.so: fs2.cpp video.h dither.h fs2.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i proto.h
-.obj/fs2fast.o .obj/fs2fast.so .shobj/fs2fast.o .shobj/fs2fast.so: fs2fast.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/fs4.o .obj/fs4.so .shobj/fs4.o .shobj/fs4.so: fs4.cpp fs4.h $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i video.h \
- proto.h dither.h
-.obj/global.o .obj/global.so .shobj/global.o .shobj/global.so: global.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/gray.o .obj/gray.so .shobj/gray.o .shobj/gray.so: gray.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/hybrid.o .obj/hybrid.so .shobj/hybrid.o .shobj/hybrid.so: hybrid.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/hybriderr.o .obj/hybriderr.so .shobj/hybriderr.o .shobj/hybriderr.so: hybriderr.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/info.o .obj/info.so .shobj/info.o .shobj/info.so: info.cpp $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/jrevdct.o .obj/jrevdct.so .shobj/jrevdct.o .shobj/jrevdct.so: jrevdct.cpp video.h proto.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/mb_ordered.o .obj/mb_ordered.so .shobj/mb_ordered.o .shobj/mb_ordered.so: mb_ordered.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/mono.o .obj/mono.so .shobj/mono.o .shobj/mono.so: mono.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/motionvector.o .obj/motionvector.so .shobj/motionvector.o .shobj/motionvector.so: motionvector.cpp video.h proto.h util.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/ordered.o .obj/ordered.so .shobj/ordered.o .shobj/ordered.so: ordered.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/ordered2.o .obj/ordered2.so .shobj/ordered2.o .shobj/ordered2.so: ordered2.cpp video.h proto.h dither.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/para.o .obj/para.so .shobj/para.o .shobj/para.so: para.cpp video.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h
-.obj/parseblock.o .obj/parseblock.so .shobj/parseblock.o .shobj/parseblock.so: parseblock.cpp video.h proto.h decoders.h util.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/prog.o .obj/prog.so .shobj/prog.o .shobj/prog.so: prog.cpp video.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h
-.obj/ui.o .obj/ui.so .shobj/ui.o .shobj/ui.so: ui.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i \
- interface/fb.xbm interface/play.xbm interface/step.xbm \
- interface/stop.xbm interface/loop.xbm interface/ff.xbm \
- interface/MainWindow.mib interface/Info.mib video.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h
-.obj/util.o .obj/util.so .shobj/util.o .shobj/util.so: util.cpp video.h proto.h util.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/util32.o .obj/util32.so .shobj/util32.o .shobj/util32.so: util32.cpp video.h proto.h ui.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i
-.obj/vb.o .obj/vb.so .shobj/vb.o .shobj/vb.so: vb.cpp vb.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \
- $(ACE_ROOT)/ace/Event_Handler.h \
- $(ACE_ROOT)/ace/Event_Handler.i \
- $(ACE_ROOT)/ace/Reactor.h \
- $(ACE_ROOT)/ace/Handle_Set.h \
- $(ACE_ROOT)/ace/Handle_Set.i \
- $(ACE_ROOT)/ace/Timer_Queue.h \
- $(ACE_ROOT)/ace/Synch.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
- $(ACE_ROOT)/ace/Synch.i \
- $(ACE_ROOT)/ace/Synch_T.h \
- $(ACE_ROOT)/ace/Synch_T.i \
- $(ACE_ROOT)/ace/Thread.h \
- $(ACE_ROOT)/ace/Thread.i \
- $(ACE_ROOT)/ace/Atomic_Op.i \
- $(ACE_ROOT)/ace/Synch_T.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.h \
- $(ACE_ROOT)/ace/Free_List.h \
- $(ACE_ROOT)/ace/Free_List.i \
- $(ACE_ROOT)/ace/Free_List.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.i \
- $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
- $(ACE_ROOT)/ace/Signal.h \
- $(ACE_ROOT)/ace/Containers.h \
- $(ACE_ROOT)/ace/Containers.i \
- $(ACE_ROOT)/ace/Containers_T.h \
- $(ACE_ROOT)/ace/Containers_T.i \
- $(ACE_ROOT)/ace/Containers_T.cpp \
- $(ACE_ROOT)/ace/Malloc.h \
- $(ACE_ROOT)/ace/Malloc.i \
- $(ACE_ROOT)/ace/Malloc_T.h \
- $(ACE_ROOT)/ace/Malloc_T.i \
- $(ACE_ROOT)/ace/Malloc_T.cpp \
- $(ACE_ROOT)/ace/Memory_Pool.h \
- $(ACE_ROOT)/ace/Mem_Map.h \
- $(ACE_ROOT)/ace/Mem_Map.i \
- $(ACE_ROOT)/ace/Memory_Pool.i \
- $(ACE_ROOT)/ace/Signal.i \
- $(ACE_ROOT)/ace/Object_Manager.h \
- $(ACE_ROOT)/ace/Object_Manager.i \
- $(ACE_ROOT)/ace/Managed_Object.h \
- $(ACE_ROOT)/ace/Managed_Object.i \
- $(ACE_ROOT)/ace/Managed_Object.cpp \
- $(ACE_ROOT)/ace/Reactor.i \
- $(ACE_ROOT)/ace/Reactor_Impl.h
-.obj/vd.o .obj/vd.so .shobj/vd.o .shobj/vd.so: vd.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h dither.h video.h proto.h vb.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \
- $(ACE_ROOT)/ace/Event_Handler.h \
- $(ACE_ROOT)/ace/Event_Handler.i \
- $(ACE_ROOT)/ace/Reactor.h \
- $(ACE_ROOT)/ace/Handle_Set.h \
- $(ACE_ROOT)/ace/Handle_Set.i \
- $(ACE_ROOT)/ace/Timer_Queue.h \
- $(ACE_ROOT)/ace/Synch.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
- $(ACE_ROOT)/ace/Synch.i \
- $(ACE_ROOT)/ace/Synch_T.h \
- $(ACE_ROOT)/ace/Synch_T.i \
- $(ACE_ROOT)/ace/Thread.h \
- $(ACE_ROOT)/ace/Thread.i \
- $(ACE_ROOT)/ace/Atomic_Op.i \
- $(ACE_ROOT)/ace/Synch_T.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.h \
- $(ACE_ROOT)/ace/Free_List.h \
- $(ACE_ROOT)/ace/Free_List.i \
- $(ACE_ROOT)/ace/Free_List.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.i \
- $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
- $(ACE_ROOT)/ace/Signal.h \
- $(ACE_ROOT)/ace/Containers.h \
- $(ACE_ROOT)/ace/Containers.i \
- $(ACE_ROOT)/ace/Containers_T.h \
- $(ACE_ROOT)/ace/Containers_T.i \
- $(ACE_ROOT)/ace/Containers_T.cpp \
- $(ACE_ROOT)/ace/Malloc.h \
- $(ACE_ROOT)/ace/Malloc.i \
- $(ACE_ROOT)/ace/Malloc_T.h \
- $(ACE_ROOT)/ace/Malloc_T.i \
- $(ACE_ROOT)/ace/Malloc_T.cpp \
- $(ACE_ROOT)/ace/Memory_Pool.h \
- $(ACE_ROOT)/ace/Mem_Map.h \
- $(ACE_ROOT)/ace/Mem_Map.i \
- $(ACE_ROOT)/ace/Memory_Pool.i \
- $(ACE_ROOT)/ace/Signal.i \
- $(ACE_ROOT)/ace/Object_Manager.h \
- $(ACE_ROOT)/ace/Object_Manager.i \
- $(ACE_ROOT)/ace/Managed_Object.h \
- $(ACE_ROOT)/ace/Managed_Object.i \
- $(ACE_ROOT)/ace/Managed_Object.cpp \
- $(ACE_ROOT)/ace/Reactor.i \
- $(ACE_ROOT)/ace/Reactor_Impl.h
-.obj/video.o .obj/video.so .shobj/video.o .shobj/video.so: video.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i decoders.h \
- util.h video.h proto.h global.h ui.h
-.obj/vp.o .obj/vp.so .shobj/vp.o .shobj/vp.so: vp.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h dither.h video.h proto.h ui.h
-.obj/Command_Handler.o .obj/Command_Handler.so .shobj/Command_Handler.o .shobj/Command_Handler.so: Command_Handler.cpp Command_Handler.h \
- $(ACE_ROOT)/ace/OS.h \
- $(ACE_ROOT)/ace/inc_user_config.h \
- $(ACE_ROOT)/ace/config.h \
- $(ACE_ROOT)/ace/config-g++-common.h \
- $(ACE_ROOT)/ace/streams.h \
- $(ACE_ROOT)/ace/Basic_Types.h \
- $(ACE_ROOT)/ace/Basic_Types.i \
- $(ACE_ROOT)/ace/OS.i \
- $(ACE_ROOT)/ace/Trace.h \
- $(ACE_ROOT)/ace/Log_Msg.h \
- $(ACE_ROOT)/ace/Log_Record.h \
- $(ACE_ROOT)/ace/ACE.h \
- $(ACE_ROOT)/ace/ACE.i \
- $(ACE_ROOT)/ace/Log_Priority.h \
- $(ACE_ROOT)/ace/SString.h \
- $(ACE_ROOT)/ace/SString.i \
- $(ACE_ROOT)/ace/Malloc_Base.h \
- $(ACE_ROOT)/ace/Log_Record.i \
- $(ACE_ROOT)/ace/Reactor.h \
- $(ACE_ROOT)/ace/Handle_Set.h \
- $(ACE_ROOT)/ace/Handle_Set.i \
- $(ACE_ROOT)/ace/Timer_Queue.h \
- $(ACE_ROOT)/ace/Synch.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
- $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
- $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
- $(ACE_ROOT)/ace/Synch.i \
- $(ACE_ROOT)/ace/Synch_T.h \
- $(ACE_ROOT)/ace/Event_Handler.h \
- $(ACE_ROOT)/ace/Event_Handler.i \
- $(ACE_ROOT)/ace/Synch_T.i \
- $(ACE_ROOT)/ace/Thread.h \
- $(ACE_ROOT)/ace/Thread.i \
- $(ACE_ROOT)/ace/Atomic_Op.i \
- $(ACE_ROOT)/ace/Synch_T.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.h \
- $(ACE_ROOT)/ace/Free_List.h \
- $(ACE_ROOT)/ace/Free_List.i \
- $(ACE_ROOT)/ace/Free_List.cpp \
- $(ACE_ROOT)/ace/Timer_Queue_T.i \
- $(ACE_ROOT)/ace/Timer_Queue_T.cpp \
- $(ACE_ROOT)/ace/Signal.h \
- $(ACE_ROOT)/ace/Containers.h \
- $(ACE_ROOT)/ace/Containers.i \
- $(ACE_ROOT)/ace/Containers_T.h \
- $(ACE_ROOT)/ace/Containers_T.i \
- $(ACE_ROOT)/ace/Containers_T.cpp \
- $(ACE_ROOT)/ace/Malloc.h \
- $(ACE_ROOT)/ace/Malloc.i \
- $(ACE_ROOT)/ace/Malloc_T.h \
- $(ACE_ROOT)/ace/Malloc_T.i \
- $(ACE_ROOT)/ace/Malloc_T.cpp \
- $(ACE_ROOT)/ace/Memory_Pool.h \
- $(ACE_ROOT)/ace/Mem_Map.h \
- $(ACE_ROOT)/ace/Mem_Map.i \
- $(ACE_ROOT)/ace/Memory_Pool.i \
- $(ACE_ROOT)/ace/Signal.i \
- $(ACE_ROOT)/ace/Object_Manager.h \
- $(ACE_ROOT)/ace/Object_Manager.i \
- $(ACE_ROOT)/ace/Managed_Object.h \
- $(ACE_ROOT)/ace/Managed_Object.i \
- $(ACE_ROOT)/ace/Managed_Object.cpp \
- $(ACE_ROOT)/ace/Reactor.i \
- $(ACE_ROOT)/ace/Reactor_Impl.h \
- $(ACE_ROOT)/ace/ARGV.h \
- $(ACE_ROOT)/ace/ARGV.i \
- $(TAO_ROOT)/tao/TAO.h \
- $(TAO_ROOT)/tao/corbafwd.h \
- $(ACE_ROOT)/ace/CDR_Stream.h \
- $(ACE_ROOT)/ace/Message_Block.h \
- $(ACE_ROOT)/ace/Message_Block.i \
- $(ACE_ROOT)/ace/Message_Block_T.h \
- $(ACE_ROOT)/ace/Message_Block_T.i \
- $(ACE_ROOT)/ace/Message_Block_T.cpp \
- $(ACE_ROOT)/ace/CDR_Stream.i \
- $(TAO_ROOT)/tao/try_macros.h \
- $(TAO_ROOT)/tao/orbconf.h \
- $(ACE_ROOT)/ace/CORBA_macros.h \
- $(TAO_ROOT)/tao/POAC.h \
- $(TAO_ROOT)/tao/PolicyC.h \
- $(TAO_ROOT)/tao/Object.h \
- $(TAO_ROOT)/tao/Object.i \
- $(TAO_ROOT)/tao/Sequence.h \
- $(TAO_ROOT)/tao/Managed_Types.h \
- $(TAO_ROOT)/tao/ORB.h \
- $(TAO_ROOT)/tao/Exception.h \
- $(TAO_ROOT)/tao/Exception.i \
- $(TAO_ROOT)/tao/ORB.i \
- $(TAO_ROOT)/tao/Managed_Types.i \
- $(TAO_ROOT)/tao/Sequence.i \
- $(TAO_ROOT)/tao/Sequence_T.h \
- $(TAO_ROOT)/tao/Sequence_T.i \
- $(TAO_ROOT)/tao/Sequence_T.cpp \
- $(TAO_ROOT)/tao/PolicyC.i \
- $(TAO_ROOT)/tao/CurrentC.h \
- $(TAO_ROOT)/tao/CurrentC.i \
- $(TAO_ROOT)/tao/POAC.i \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlC.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlC.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i \
- $(ACE_ROOT)/ace/SOCK_Dgram.h \
- $(ACE_ROOT)/ace/SOCK_Dgram.i \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Audio_ControlC.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Audio_ControlC.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AV/AVStreams_i.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceC.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceC.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS_T.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS_T.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS_T.cpp \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosPropertyServiceS.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsC.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsC.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS_T.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS_T.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS_T.cpp \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AVStreamsS.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Property/CosPropertyService_i.h \
- $(ACE_ROOT)/ace/Process.h \
- $(ACE_ROOT)/ace/Process.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AV/Endpoint_Strategy_T.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/AV/Endpoint_Strategy_T.cpp \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlC.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlC.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS_T.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS_T.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS_T.cpp \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Null_MediaCtrlS.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Trader/Trader.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingS.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingC.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingC.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingS_T.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingS_T.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingS_T.cpp \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosTradingS.i \
- $(ACE_ROOT)/ace/High_Res_Timer.h \
- $(ACE_ROOT)/ace/High_Res_Timer.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/Naming_Utils.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/IOR_Multicast.h \
- $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \
- $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/CosNaming_i.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS_T.h \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS_T.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS_T.cpp \
- $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS.i \
- $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/Entries.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverS.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverC.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverC.i \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverS_T.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverS_T.i \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverS_T.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/ReceiverS.i \
- ab.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
- newproto.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
- global.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \
- vb.h ctr.cpp \
- $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp
deleted file mode 100644
index 2887981ee52..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp
+++ /dev/null
@@ -1,575 +0,0 @@
-
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-extern int asp[2];
-extern void set_exit_routine_tag(int tag);
-
-#include "ab.h"
-
-ACE_RCSID(mpeg_client, ab, "$Id$")
-
-AudioBuffer::AudioBuffer (void)
- :temp (0),
- bytes (-1),
- abuf (0),
- sid (-1),
- exit_tag (0),
- savedSocket (-1),
- packet (0),
- pkt_data (0),
- conn_tag (-1),
- fbstate (0),
- waketime (0),
- pcmdsn (-1),
- mode_ (INVALID)
-{
-}
-
-//destructor.
-AudioBuffer::~AudioBuffer (void)
-{
- if (ACE_Reactor::instance ()->remove_handler (this->handler_,ACE_Event_Handler::READ_MASK) == -1)
- ACE_DEBUG ((LM_ERROR,"(%P)remove handler failed for Video_Notification_Handler\n"));
-
- delete this->handler_;
- if (ACE_Reactor::instance ()->remove_handler (this,ACE_Event_Handler::READ_MASK) == -1)
- ACE_DEBUG ((LM_ERROR,"(%P)remove handler failed for VideoBuffer\n"));
-
-}
-
-void
-AudioBuffer::set_silence (char *buf, int samples)
-{
- memset(buf, 0xff, samples * shared->audioPara.bytesPerSample);
-}
-
-void
-AudioBuffer::ABinitBuf (int size) /* size in bytes */
-{
- abuf = (ABBuffer *)creat_shared_mem(size);
- abuf->bufsize = size - sizeof(*abuf);
- abuf->buf = (char *)abuf + sizeof(*abuf);
- sid = creat_semaphore();
-}
-
-void
-AudioBuffer::ABflushBuf (int nextSample) /* flush the whole buffer */
-{
- enter_cs(sid);
- abuf->bps = shared->audioPara.bytesPerSample;
- abuf->size = abuf->bufsize / abuf->bps;
- abuf->samples = 0;
- abuf->stuff = 0;
- abuf->ts = abuf->hs = nextSample;
- abuf->tind = 0;
- set_silence(abuf->buf, abuf->size);
- leave_cs(sid);
-}
-
-int
-AudioBuffer::ABcheckSamples (void) /* returns # of samples in ABbuf */
-{
- return abuf->samples;
-}
-
-int
-AudioBuffer::ABgetSamples (char * buf, int samples)
- /* read at most given number of samples from AB to buf, returns
- number of sample actually read */
-{
- int as;
- int tsamples = samples;
- enter_cs(sid);
- if (abuf->stuff > 0) {
- as = min(abuf->stuff, samples);
- set_silence(buf, as);
- abuf->stuff -= as;
- samples -= as;
- buf += as * abuf->bps;
- }
- if (samples > 0) {
- as = min(samples, max(0, abuf->samples));
- /* there may be fewer samples in abuf */
- if (as > 0) {
- int part1 = min(as, abuf->size - abuf->tind);
- ACE_OS::memcpy (buf, abuf->buf + (abuf->bps * abuf->tind), part1 * abuf->bps);
- set_silence(abuf->buf + (abuf->bps * abuf->tind), part1);
- if (part1 < as) { /* This read cross the boundary of abuf */
- ACE_OS::memcpy (buf + (part1 * abuf->bps),
- abuf->buf,
- (as - part1) * abuf->bps);
- set_silence(abuf->buf, as - part1);
- }
- }
- abuf->samples -= samples;
- abuf->ts += samples;
- abuf->tind = (abuf->tind + samples) % abuf->size;
- if (as < samples) set_silence(buf + (as * abuf->bps), samples - as);
- }
- leave_cs(sid);
- return tsamples;
-}
-
-/* if samples < 0; then stuff |samples| silient samples to ABgetSamples(),
- otherwise wipe out this number of samples from AB */
-int
-AudioBuffer::ABskipSamples (int samples)
-{
- enter_cs(sid);
- if (samples <= 0) {
- abuf->stuff += (- samples);
- }
- else {
- abuf->samples -= samples;
- abuf->ts += samples;
- abuf->tind = (abuf->tind + samples) % abuf->size;
- }
- leave_cs(sid);
- return samples;
-}
-
-void
-AudioBuffer::ABdeleteBuf (void)
-{
- remove_shared_mem((char *)abuf);
-}
-
-void
-AudioBuffer::ABdeleteSem (void)
-{
- remove_semaphore(sid);
-}
-
-/* SIGUSR1 from CTR is for killing this process, without affecting any other ones. */
-
-void
-AudioBuffer::exit_on_kill (void)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) ABprocess killed \n"));
- extern void set_exit_routine_tag(int tag);
- set_exit_routine_tag(0);
- // ComCloseConn(savedSocket);
- vbuffer->VBdeleteBuf();
- ACE_OS::exit (0);
-}
-
-ACE_HANDLE
-AudioBuffer::get_handle (void) const
-{
- return this->dataSocket;
-}
-
-int
-AudioBuffer::handle_input (ACE_HANDLE fd)
-{
- // ACE_DEBUG ((LM_DEBUG,"handle_input:mode = %d\n",this->mode_));
- int len;
- switch (this->mode_)
- {
- case READ_HEADER:
- {
- int len;
- if (conn_tag >= 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"non discard mode: "));
- if (bytes < 0)
- bytes = sizeof(*packet);
- len = ACE_OS::read (dataSocket, (char *)temp, bytes);
- }
- else
- { /* discard mode packet stream, read all bytes */
- // ACE_DEBUG ((LM_DEBUG,"discard mode: "));
- if (bytes < 0)
- bytes = PACKET_SIZE;
- len = ACE_OS::read (dataSocket, (char *)packet, bytes);
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) ABprocess: got a %d sized packet\n",len));
- }
- if (len == -1)
- {
- if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN)
- {
- return 0;
- }
- perror("AB ACE_OS::read () audio packet from discard-mode packet stream");
- ACE_Reactor::instance ()->end_event_loop ();
- return -1;
- }
-
- if (len == 0)
- {
- fprintf(stderr, "Error: AB found dataSocket broken\n");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- // ACE_DEBUG ((LM_DEBUG,"packet: bytes = %d,len = %d\n",bytes,len));
- if (conn_tag >= 0)
- {
- temp += len;
- bytes -= len;
- if (bytes == 0)
- {
- // header reading is done.
- this->mode_ = READ_DATA;
- bytes = -1;
- len = sizeof (*packet);
- }
- else
- return 0;
- }
- if (len < sizeof (*packet))
- {
- fprintf(stderr, "Warn: AB discard len = %d bytes of supposed header.\n", len);
- return 0;
- }
- // process the header.
-#ifdef NeedByteOrderConversion
- packet->dataBytes = ntohl(packet->dataBytes);
-#endif
-
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) ABprocess: Received %d sized packet\n",len));
- if (packet->dataBytes <= 0)
- {
- fprintf(stderr, "AB Error: pkt->dataBytes %d, len %d\n",
- packet->dataBytes,
- len);
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- bytes = packet->dataBytes + sizeof(*packet);
-
- if (bytes > PACKET_SIZE)
- {
- Fprintf(stderr, "Fatal error: AB packet buf (%dB) too small (%d)\n",
- PACKET_SIZE, bytes);
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- if (conn_tag > 0)
- {
- temp = (char *)packet + sizeof(*packet);
- bytes = bytes - sizeof(*packet);
- ACE_DEBUG ((LM_DEBUG,"(%P) Ready to read the data part of the packet\n"));
- break;
- }
- }
- // fall through and process the header.
- case READ_DATA:
- {
- // code to read the audio packet and buffer it.
- if (conn_tag >= 0)
- {
- len = ACE_OS::read (dataSocket,temp,bytes);
-
- if (len <= 0)
- {
- if (len == -1)ACE_OS::perror ("AB encounter error on wait_read_bytes()");
- else fprintf(stderr, "AB encounter EOF on wait_read_bytes()\n");
- }
- temp +=len;
- bytes -= len;
- if (bytes != 0)
- return 0;
- }
- // set the parameters for the header reading.
- this->mode_ = READ_HEADER;
- bytes = -1;
- temp = (char *)packet;
-#ifdef NeedByteOrderConversion
- packet->cmdsn = ntohl(packet->cmdsn);
- packet->samplesPerSecond = ntohl(packet->samplesPerSecond);
- packet->resend = ntohl(packet->resend);
- packet->firstSample = ntohl(packet->firstSample);
- packet->samples = ntohl(packet->samples);
- packet->actualSamples = ntohl(packet->actualSamples);
- /* dataBytes already byte-reordered */
-#endif
- /*
- Fprintf(stderr, "AB got a packet: %d(%d)\n",
- packet->firstSample, packet->samples);
- */
- /*
- if (packet->firstSample % 10240 && !packet->resend) continue;
- */
- if (packet->samples * abuf->bps > PACKET_SIZE - sizeof(*packet)) {
- fprintf(stderr, "Fatal error: AB has too small packet buffer, %d out of %d\n",
- PACKET_SIZE, packet->samples * abuf->bps + sizeof(*packet));
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
-
- if (packet->cmdsn != shared->cmdsn) { /* outdated packet */
- /*
- Fprintf(stderr, "AB discarded an outdated packet\n");
- */
- return 0;
- }
- enter_cs(sid);
- if (packet->firstSample + packet->samples <= abuf->ts)
- {
- /* all samples too late, discard it */
- abuf->hs = max(abuf->hs, packet->firstSample + packet->samples);
- abuf->samples = abuf->hs - abuf->ts;
- leave_cs(sid);
- /*
- Fprintf(stderr, "AB all sample in packet %d(%d) too late\n",
- packet->firstSample, packet->samples);
- */
- feedback ();
- }
- else if (packet->firstSample >= abuf->ts + abuf->size) {
- /* all samples too early, discard the packet */
- abuf->hs = max(abuf->hs, packet->firstSample + packet->samples);
- abuf->samples = abuf->hs - abuf->ts;
- leave_cs(sid);
- /*
- Fprintf(stderr, "AB all sample in packet %d(%d) too early\n",
- packet->firstSample, packet->samples);
- */
- feedback ();
- }
- else if (packet->samples > packet->actualSamples) {
- leave_cs(sid);
- fprintf(stderr, "Error: AB interpolation not available yet.\n");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- else
- {
- int oldhs = abuf->hs;
- int firstSample = max(packet->firstSample, abuf->ts);
- int samples = min(packet->samples -
- (firstSample - packet->firstSample),
- (abuf->ts + abuf->size) - packet->firstSample);
- char * data = pkt_data +
- (firstSample - packet->firstSample) * abuf->bps;
- int dstart = (abuf->tind + (firstSample - abuf->ts)) % abuf->size;
- int part1 = min(samples, abuf->size - dstart);
- ACE_OS::memcpy (abuf->buf + (dstart * abuf->bps), data, part1 * abuf->bps);
- if (part1 < samples) {
- memcpy(abuf->buf, data + part1 * abuf->bps,
- (samples - part1) * abuf->bps);
- }
- abuf->hs = max(abuf->hs, packet->firstSample + packet->samples);
- abuf->samples = abuf->hs - abuf->ts;
- dstart =max(oldhs, abuf->ts);
-
- leave_cs(sid);
-
- part1 = firstSample - dstart;
- if (packet->resend) {
- Fprintf(stderr, "AB got resent %d(%d)\n",
- packet->firstSample, packet->samples);
- }
- else if (part1 > 0) {
- int res;
- AudioFeedBackPara para;
- Fprintf(stderr, "AB found gap %d(%d)\n", dstart, part1);
- para.cmdsn = htonl(shared->cmdsn);
- para.type = htonl(1);
- para.data.ap.firstSample = htonl(dstart);
- para.data.ap.samples = htonl(part1);
- // register ourself for the write handler.
- int result;
- result = ACE_Reactor::instance ()->register_handler (this,ACE_Event_Handler::WRITE_MASK);
- if (result != 0)
- return result;
- this->mode_ = WRITE_FEEDBACK2;
- temp = (char *)&para;
- bytes = sizeof (para);
- }
- }
- }
- break;
- default:
- break;
- }
- return 0;
-}
-
-int
-AudioBuffer::handle_output (ACE_HANDLE fd)
-{
- ACE_DEBUG ((LM_DEBUG,"handle_output:mode = %d\n",this->mode_));
- int res;
- if ((this->mode_ == WRITE_FEEDBACK1) || (this->mode_ == WRITE_FEEDBACK2))
- {
- // send feedback.
-
- if (conn_tag != 0)
- { /* packet stream */
- res = ACE_OS::write (dataSocket, temp, bytes);
- if (res == -1)
- {
- if (errno == ENOBUFS) {
- ACE_OS::perror ("AB Warning, resend-req packet discarded for");
- return 0;
- }
- ACE_OS::perror ("AB error, resend-req packet sending failed");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- }
- else
- {
- res = ACE_OS::write (dataSocket, temp, bytes);
- if (res == -1) {
- ACE_OS::perror ("AB error, resend-req packet sending failed");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- }
- if (res == 0)
- {
- ACE_DEBUG ((LM_DEBUG,"(%P|%t)AudioBuffer::handle_output:write failed\n"));
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- temp += res;
- bytes -= res;
- if (bytes != 0)
- return 0;
- else
- {
- // remove the write handler.
- int result;
- result = ACE_Reactor::instance ()->remove_handler (this,
- ACE_Event_Handler::WRITE_MASK);
- if (result != 0)
- return result;
-
- this->mode_ = READ_HEADER;
- temp = (char *)packet;
- bytes == -1;
- }
- }
- if (this->mode_ == WRITE_FEEDBACK1)
- {
- // adjust the wakeup time and feedback state.
- waketime = get_usec() + STARTUP_WAIT;
- fbstate = 1;
- }
- return 0;
-}
-
-int
-AudioBuffer::ABprocess (int socket)
-{
- int result;
- ACE_DEBUG ((LM_DEBUG,"(%P|%t)AudioBuffer::ABprocess ()\n"));
- packet = (AudioPacket *)ACE_OS::malloc(PACKET_SIZE);
- if (packet == NULL) {
- ACE_OS::perror ("AB failed to allocate mem for packet buffer");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
-
- this->dataSocket = socket;
- ACE_NEW_RETURN (this->handler_,
- Audio_Notification_Handler,
- -1);
- // Register the notification handler with the reactor.
- result = ACE_Reactor::instance ()->register_handler (this->handler_,
- ACE_Event_Handler::READ_MASK);
- if (result != 0)
- return result;
-
- result = ACE_Reactor::instance ()->register_handler (this,
- ACE_Event_Handler::READ_MASK);
-
- if (result != 0)
- return result;
-
- conn_tag = shared->audioMaxPktSize;
- exit_tag = 0;
-
- this->mode_ = READ_HEADER;
- pkt_data = (char *)packet + sizeof(*packet);
- temp = (char *)packet;
- bytes = -1;
- return 0;
-}
-
-// following is feedback algorithm.
-void
-AudioBuffer::feedback (void)
-{
- if (shared->live || (!shared->config.syncEffective)) return;
- /*
- fprintf(stderr, "AB fbstate = %d\n", fbstate);
- */
- switch (fbstate) {
- case 0: /* startup init */
- if (pcmdsn != packet->cmdsn) {
- fbstate = 0;
- pcmdsn = packet->cmdsn;
- }
- else {
- fbstate = 1;
- waketime = get_usec() + STARTUP_WAIT;
- }
- break;
- case 1: /* startup wait */
- if (pcmdsn != packet->cmdsn) {
- fbstate = 0;
- break;
- }
- if (get_usec() >= waketime) {
- fbstate = 2;
- }
- break;
- case 2: /* monitoring */
- if (pcmdsn != packet->cmdsn) {
- fbstate = 0;
- break;
- }
- if (abuf->samples < abuf->size >>2 ||
- abuf->samples > (abuf->size * 3) >> 2)
- {
- /* feedback action needed */
- AudioFeedBackPara para;
- int res;
- para.data.fb.addsps = 0;
- para.data.fb.addSamples = (abuf->size >> 2) - abuf->samples;
-
- Fprintf(stderr, "AB sends fb: %dsps, %dsamples\n",
- para.data.fb.addsps,
- para.data.fb.addSamples);
- para.cmdsn = htonl(shared->cmdsn);
- para.type = htonl(0);
- para.data.fb.addsps = htonl(para.data.fb.addsps);
- para.data.fb.addSamples = htonl(para.data.fb.addSamples);
- int result = ACE_Reactor::instance ()->register_handler (this,ACE_Event_Handler::WRITE_MASK);
- if (result != 0)
- ACE_DEBUG ((LM_DEBUG,"register_hanlder for write failed\n"));
- this->mode_ = WRITE_FEEDBACK1;
- temp = (char *)&para;
- bytes = sizeof (para);
- return;
- }
- break;
- default:
- break;
- }
-}
-
-ACE_HANDLE
-Audio_Notification_Handler::get_handle (void) const
-{
- return asp[1];
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.h
deleted file mode 100644
index e1397665998..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// mpeg_client
-//
-// = FILENAME
-// ab.h
-//
-// = DESCRIPTION
-// Defines the audio packet buffering process.
-//
-// = AUTHORS
-// Nagarajan Surendran (naga@cs.wustl.edu)
-//
-// ============================================================================
-
-#if !defined (AV_AB_H)
-#define AV_AB_H
-
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-#ifdef __svr4__
-#include <stropts.h>
-#include <sys/conf.h>
-#endif
-
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-#include "mpeg_shared/filters.h"
-#include "mpeg_shared/fileio.h"
-#include "mpeg_shared/com.h"
-#include "ace/OS.h"
-#include "ace/Event_Handler.h"
-#include "ace/Reactor.h"
-#include "vb.h"
-
-extern VideoBuffer *vbuffer;
-
-/* magic number -- deviation is considered
- caused by clock drift only if rate <= 1/MAX_CLOCK_DRIFT.
- */
-#define MAX_CLOCK_DRIFT 50
-
-#define max(a,b) ((a)>(b) ? (a) : (b))
-#define min(a,b) ((a)<(b) ? (a) : (b))
-#define PACKET_SIZE 8192
-#define STARTUP_WAIT 10000000
-#define ACTION_WAIT 5000000
-
-typedef struct {
- int bufsize; /* number of bytes for the buffer pointed by 'buf' */
- char * buf; /* pointer to the data buffer area */
- int bps; /* current byte-per-sample */
- int size; /* number of samples the buffer can hold */
- int samples; /* number of samples in the buffer; */
- int stuff; /* number of stuff samples to be read by ABgetSamples() */
- int ts; /* tail-sample: the next sample to be comsumed by CTR */
- int hs; /* head-sample: the next sample to be expected from the network */
- int tind; /* index of the ts-sample in the buf */
-} ABBuffer;
-
-
-class Notification_Handler;
-
-class AudioBuffer :public ACE_Event_Handler
-{
-public:
- AudioBuffer (void);
- // constructor.
-
- int ABprocess (int dataSocket);
- // start the buffering process.
-
- ~AudioBuffer (void);
- // destructor.
-
- virtual ACE_HANDLE get_handle (void) const;
- // get the underlying I/O handle.
-
- virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
- // called when input arrives on the datasocket.
-
- virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE);
- // Called to send feedback.
-
- void set_silence(char *buf, int samples);
-
- void ABinitBuf(int size);
-
- void ABflushBuf(int nextSample);
- // flush the whole buffer
-
- int ABcheckSamples(void);
- // returns # of samples in ABbuf
-
- int ABgetSamples(char * buf, int samples);
- // read at most given number of samples from AB to buf, returns
- // number of sample actually read
-
- int ABskipSamples(int samples);
- // if samples < 0; then stuff |samples| silient samples to ABgetSamples(),
- // otherwise wipe out this number of samples from AB.
-
- void ABdeleteBuf(void);
-
- void ABdeleteSem(void);
-
- static void exit_on_kill(void);
-
- static void usr1_handler(int sig);
-
- static void usr2_handler(int sig);
-
- void feedback (void);
-
-private:
- char *temp;
- // temporary pointer.
- int bytes;
- // temporary placeholder for no.of bytes to be read.
- ABBuffer *abuf;
- int sid;
- int exit_tag;
- int savedSocket;
- AudioPacket *packet;
- char *pkt_data;
- int conn_tag;
- /* following are for feedback */
- int fbstate;
- unsigned waketime;
- int pcmdsn;
-
- int dataSocket;
- // data socket handle.
-
- Notification_Handler *handler_;
-
- enum MODE {INVALID = -1,READ_HEADER,READ_DATA,WRITE_FEEDBACK1,WRITE_FEEDBACK2};
- int mode_;
-};
-
-class Audio_Notification_Handler :public Notification_Handler
-{
-public:
- virtual ACE_HANDLE get_handle (void) const;
- // Returns the audio notification handle.
-};
-
-#endif /* AV_AB_H */
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp
deleted file mode 100644
index b99c7d35cba..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp
+++ /dev/null
@@ -1,494 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-/* ##################################################################
-
- When you port to a new architecture, you much add native audio
- device support in this file by adding stuff to all relevant
- functions, otherwise, it is disabled by default.
-
- ################################################################# */
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#ifdef __svr4__
-#include <sys/audioio.h>
-#elif defined(FreeBSD)
-#include <machine/pcaudioio.h>
-#elif defined(sun)
-#include <sys/audioio.h>
-#elif defined(_HPUX_SOURCE)
-#include <sys/audio.h>
-#elif defined(IRIX)
-#include <audio.h>
-#endif
-
-#ifdef FreeBSD
-#define AUDIO_DEVICE "/dev/pcaudio"
-#define AUDIO_CONTROL "/dev/pcaudioctl"
-#elif defined(__svr4__) || defined(sun)
-#define AUDIO_DEVICE "/dev/audio"
-#define AUDIO_CONTROL "/dev/audioctl"
-#elif defined(_HPUX_SOURCE)
-#define AUDIO_DEVICE "/dev/audio"
-#define AUDIO_CONTROL "/dev/audioCtl"
-#elif defined(IRIX)
-#define AUDIO_DEVICE "proprietary device"
-#define AUDIO_CONTROL "proprietary device"
-#elif defined(LINUX)
-#define AUDIO_DEVICE "/dev/audio"
-#define AUDIO_CONTROL "NO CONTROL DEV"
-#endif
-
-#include <time.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-
-ACE_RCSID(mpeg_client, audio, "$Id$")
-
-static int cfd = -1, afd = -1; /* afd == -1 mean no native device available */
-static long start_time;
-static long current_time;
-
-#ifdef IRIX
-#define audioDevice AL_DEFAULT_DEVICE
-static ALport playPort = NULL;
-#endif
-
-#ifdef AUDIOFILE
-
-#include <AF/AFlib.h>
-#include <AF/AFUtils.h>
-
-static int useAF = 0;
-
-static AFAudioConn *aud;
-static AC ac;
-static AFSetACAttributes attributes;
-
-/*
- * Find a suitable default device
- * Returns -1 if no suitable device can be found.
- */
-static int FindDefaultDevice(AFAudioConn *aud)
-{
- AFDeviceDescriptor *audioDevice;
- int i;
- for(i=0; i<ANumberOfAudioDevices(aud); i++)
- {
- audioDevice = AAudioDeviceDescriptor(aud, i);
- if(audioDevice->inputsFromPhone == 0 && audioDevice->outputsToPhone == 0)
- return i;
- }
- return -1;
-}
-#endif
-
-/*
- returns: 0 - succ
- -1 - failed
-*/
-int InitAudioDevice(void)
-{
-#ifdef AUDIOFILE
- int device;
- int gain;
- unsigned int channels;
- int endianflag = 0;
-#endif
-
-#ifdef AUDIOFILE
- device = -1;
- attributes.preempt = Mix;
- attributes.start_timeout = 0;
- attributes.end_silence = 0;
- attributes.play_gain = 0;
- attributes.rec_gain = 0;
- attributes.type = UNKNOWN_ENCODETYPE;
-
- if ( (aud = AFOpenAudioConn(NULL)) == NULL)
- {
- fprintf(stderr, "Failed locating default AudioFile.\n");
- goto native_audio;
- }
-
- /* set up audio context, find sample size and sample rate
- At this time, we only support default setings */
- device = FindDefaultDevice(aud);
- attributes.type = aud->devices[device].playBufType;
- ac = AFCreateAC(aud, device, (ACPlayGain | ACEncodingType | endianflag),
- &attributes);
- if (ac == NULL)
- {
- fprintf(stderr, "Failed Initializing default AudioFile.\n");
- AFCloseAudioConn(aud);
- goto native_audio;
- }
- AFSync(aud, 0); /* Make sure we confirm encoding type support. */
- shared->AFPara.encodeType = attributes.type;
- shared->AFPara.channels = ac->device->playNchannels;
- shared->AFPara.bytesPerSample =
- BytesPerUnit(attributes.type) / SampsPerUnit(attributes.type);
- shared->AFPara.samplesPerSecond = ac->device->playSampleFreq;
- /*
- ACE_OS::memcpy (&(shared->AFPara), &(shared->config.audioPara), sizeof(AudioParameter));
- */
- useAF = 1;
- fprintf(stderr, "Using default AudioFile.\n");
- return 0;
-#elif defined(__svr4__) || defined(sun) || defined(FreeBSD) \
- || defined(_HPUX_SOURCE) || defined(IRIX) || defined(LINUX)
- fprintf(stderr, "This vcr compiled without AudioFile, try native audio.\n");
-#else
- fprintf(stderr, "This vcr compiled without AudioFile, audio to be ignored\n");
- afd = -1;
- return -1;
-#endif
-
- native_audio:
-
-#if defined(__svr4__) || defined(sun) || defined(FreeBSD) || defined(_HPUX_SOURCE)
-
- afd = open(AUDIO_DEVICE, O_WRONLY | O_NDELAY);
- if (afd == -1) {
- fprintf(stderr, "%s", AUDIO_DEVICE);
- ACE_OS::perror (" can't be opened for write");
- return -1;
- }
- cfd = open(AUDIO_CONTROL, O_WRONLY | O_NDELAY);
- if (cfd == -1) {
- fprintf(stderr, "%s", AUDIO_DEVICE);
- ACE_OS::perror (" can't be opened for write");
- ACE_OS::close (afd);
- afd = -1;
- return -1;
- }
-#if defined(_HPUX_SOURCE)
-
- if (ioctl(cfd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ULAW) < 0) {
- fprintf(stderr, "%s" AUDIO_DEVICE);
- ACE_OS::perror ("can't be set to u-law");
- ACE_OS::close (afd);
- ACE_OS::close (cfd);
- afd = -1;
- return -1;
- }
- if (ioctl(cfd, AUDIO_SET_CHANNELS, 1) < 0) {
- fprintf(stderr, "%s" AUDIO_DEVICE);
- ACE_OS::perror ("can't be set to have single channel");
- ACE_OS::close (afd);
- ACE_OS::close (cfd);
- afd = -1;
- return -1;
- }
- if (ioctl(cfd, AUDIO_SET_SAMPLE_RATE, 8000) < 0) {
- fprintf(stderr, "%s" AUDIO_DEVICE);
- ACE_OS::perror ("can't be set to 8000sps");
- ACE_OS::close (afd);
- ACE_OS::close (cfd);
- afd = -1;
- return -1;
- }
- if (ioctl(cfd, AUDIO_SET_OUTPUT, AUDIO_OUT_SPEAKER | AUDIO_OUT_HEADPHONE))
- {
- fprintf(stderr, "%s" AUDIO_DEVICE);
- ACE_OS::perror ("can't be set output to both internal speaker and headphone");
- ACE_OS::close (afd);
- ACE_OS::close (cfd);
- afd = -1;
- return -1;
- }
- if(ioctl(cfd, AUDIO_SET_TXBUFSIZE, 1024*64) < 0)
- {
- fprintf(stderr, "%s" AUDIO_DEVICE);
- ACE_OS::perror ("can't be set output buffer size to 64K");
- ACE_OS::close (afd);
- ACE_OS::close (cfd);
- afd = -1;
- return -1;
- }
-#endif /* _HPUX_SOURCE */
-
-#elif defined(IRIX)
- {
-#define NCH 1
-#define MSQUEUE 100
- ALconfig c;
- long params[2];
-
- params[0] = AL_OUTPUT_RATE;
- params[1] = 8000;
- ALsetparams(audioDevice, params, 2);
-
- if ((c = ALnewconfig()) == NULL) {
- afd = -1;
- return -1;
- }
- ALsetwidth(c, AL_SAMPLE_16);
- ALsetchannels(c, AL_MONO);
- ALsetqueuesize(c, 10240); /* Minimal queue size */
- playPort = ALopenport(AUDIO_DEVICE, "w", c);
- ALfreeconfig(c);
- if (playPort == NULL) {
- afd = -1;
- return -1;
- }
- afd = 0;
- }
-#elif defined(LINUX)
-
- afd = open(AUDIO_DEVICE, O_WRONLY);
- if (afd == -1) {
- fprintf(stderr, "%s", AUDIO_DEVICE);
- ACE_OS::perror (" can't be opened for write");
- return -1;
- }
-
-#else /* no audio device supported on other platforms */
-
- fprintf(stderr, "Audio device access not supported, audio to be ignored\n");
- afd = -1;
- return -1;
-
-#endif /* sun, FreeBSD, _HPUX_SOURCE, ... */
- shared->AFPara.encodeType = AudioTypeMuLaw;
- shared->AFPara.channels = 1;
- shared->AFPara.bytesPerSample = 1;
- shared->AFPara.samplesPerSecond = 8000;
- start_time = get_msec();
- current_time = 0;
- fprintf(stderr, "Using native %s\n", AUDIO_DEVICE);
- return 0;
-}
-
-void SetAudioParameter(AudioParameter * para)
-{
-}
-
-unsigned int GetAudioTime(void)
-{
-#ifdef AUDIOFILE
- if (useAF) return AFGetTime(ac);
-#endif
-#if defined(__svr4__) || defined(sun) || defined(FreeBSD) \
- || defined(_HPUX_SOURCE) || defined(IRIX) || defined(LINUX)
- if (afd == -1) return 0;
- return get_duration(start_time, get_msec()) * 8; /* 8K sampling speed */
-#else
- return 0;
-#endif
-}
-
-/* Play size number of samples to AF */
-unsigned int PlayAudioSamples(unsigned int time, char * buf, int size)
-{
-#ifdef AUDIOFILE
- if (useAF) return AFPlaySamples(ac, time, size * shared->audioPara.bytesPerSample,
- (unsigned char *)buf);
-#endif
-
-#if defined(__svr4__) || defined(sun) || defined(FreeBSD) \
- || defined(_HPUX_SOURCE) || defined(IRIX) || defined(LINUX)
- if (afd == -1) return 0;
-
-#ifdef IRIX
- {
-#define BUFSIZE 1024
- static short AF_cvt_u2s[]={
- -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,
- -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,
- -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,
- -11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316,
- -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
- -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
- -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
- -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
- -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
- -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
- -876, -844, -812, -780, -748, -716, -684, -652,
- -620, -588, -556, -524, -492, -460, -428, -396,
- -372, -356, -340, -324, -308, -292, -276, -260,
- -244, -228, -212, -196, -180, -164, -148, -132,
- -120, -112, -104, -96, -88, -80, -72, -64,
- -56, -48, -40, -32, -24, -16, -8, 0,
- 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
- 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
- 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
- 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
- 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
- 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
- 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
- 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
- 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
- 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
- 876, 844, 812, 780, 748, 716, 684, 652,
- 620, 588, 556, 524, 492, 460, 428, 396,
- 372, 356, 340, 324, 308, 292, 276, 260,
- 244, 228, 212, 196, 180, 164, 148, 132,
- 120, 112, 104, 96, 88, 80, 72, 64,
- 56, 48, 40, 32, 24, 16, 8, 0
- };
- int left = size;
- unsigned char * src = buf;
- int i;
- while (left > 0) {
- short buffer[BUFSIZE];
- short * dst = buffer;
- int len = left;
- if (len > BUFSIZE) len = BUFSIZE;
- left -= len;
- for (i = 0; i < len; i ++) {
- *(dst ++) = AF_cvt_u2s[*(src ++)];
- }
- ALwritesamps(playPort, buffer, len);
- }
- }
-#else
- ACE_OS::write (afd, buf, size);
-#endif
-
- current_time += size;
- return get_duration(start_time, get_msec()) * 8; /* 8K sampling speed */
-#else
- return 0;
-#endif
-}
-
-void StartAudioPlaySession(void)
-{
- SetAudioGain();
-#ifdef AUDIOFILE
- if (useAF) return;
-#endif
-#if defined(__svr4__) || defined(sun) || defined(FreeBSD) \
- || defined(_HPUX_SOURCE) || defined(IRIX)
- if (afd == -1) return;
-#else
- return;
-#endif
-}
-void SetAudioGain(void)
-{
-#if defined(__svr4__) || defined(sun) || defined(FreeBSD)
- audio_info_t sun_gapo;
-#elif defined(_HPUX_SOURCE)
- struct audio_gain ag;
-#elif defined(IRIX)
- long params[4];
-#endif
- int volume = shared->volumePosition;
-
-#ifdef AUDIOFILE
- if (useAF) {
- AFSetOutputGain(ac, volume * 2);
- /*
- AFSetOutputGain(ac, (volume - 10)/3);
- fprintf(stderr, "CTR audio.c: volume changed to %d.\n", volume);
- */
- return;
- }
-#endif
-#if defined(__svr4__) || defined(sun) || defined(FreeBSD)
- if (afd == -1) return;
- ioctl(cfd, AUDIO_GETINFO, &sun_gapo);
- sun_gapo.play.gain = volume * 2;
- ioctl(cfd, AUDIO_SETINFO, &sun_gapo);
- return;
-#elif defined(_HPUX_SOURCE)
- ioctl(cfd, AUDIO_GET_GAINS, &ag);
- ag.cgain[0].transmit_gain = AUDIO_OFF_GAIN+(AUDIO_MAX_GAIN-AUDIO_OFF_GAIN)*volume/100;
- ag.cgain[1].transmit_gain = ag.cgain[0].transmit_gain;
- ioctl(cfd, AUDIO_SET_GAINS, &ag);
- return;
-#elif defined(IRIX)
- params[0] = AL_LEFT_SPEAKER_GAIN;
- params[1] = volume;
- params[2] = AL_RIGHT_SPEAKER_GAIN;
- params[3] = volume;
- ALsetparams(audioDevice, params, 4);
- return;
-#else
- return;
-#endif
-}
-
-void AudioInterpolate(char *rBuf, int len, char * cBuf, int convLen)
-{
- unsigned char *rawBuf = (unsigned char *)rBuf;
- unsigned char *convBuf = (unsigned char *)cBuf;
- int i;
- float factor = (float)len / (float)convLen;
-
-#ifdef AUDIOFILE
- if ((!useAF) && afd == -1) return;
-#else
- if (afd == -1) return;
-#endif
-
- /*
- Fprintf(stderr, "factor %5.2lf, len %d, convLen %d\n", factor, len, convLen);
- */
- if (shared->audioPara.bytesPerSample == 1)
- {
- for (i=0; i<convLen; i++)
- {
- float a = i * factor;
- int k = (int) (a + 0.5);
- /*
- int k = a;
- a = a - k;
- */
- if (k < len - 1) { /* interpolation algorithm can be improved */
- /*
- convBuf[i] = AF_comp_u[(int)(a * AF_exp_u[(int)rawBuf[k+1] & 0xff] + (1.0 - a) *
- AF_exp_u[(int)rawBuf[k] & 0xff]) + 8192];
- */
-
- convBuf[i] = rawBuf[k];
-
- }
- else
- convBuf[i] = rawBuf[len-1];
- }
- }
- else
- {
- fprintf(stderr, "CTR audio.c error: multi_byte samples not supported.\n");
- }
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
deleted file mode 100644
index 5f5ac9e4b87..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
+++ /dev/null
@@ -1,995 +0,0 @@
-// $Id$
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#ifdef ULTRIX
-#include <fcntl.h>
-#else
-#include <sys/fcntl.h>
-#endif
-#include <time.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <limits.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-#include "mpeg_shared/routine.h"
-#include "mpeg_shared/sendpt.h"
-#include "mpeg_shared/filters.h"
-#include "mpeg_shared/fileio.h"
-#include "mpeg_shared/com.h"
-#include "Command_Handler.h"
-
-ACE_RCSID(mpeg_client, ctr, "$Id$")
-
-#define SPEEDHIST_SIZE 20
-
-#if defined max
-#undef max
-#endif
-#define max(a,b) (a>b ? a : b)
-
-#if defined min
-#undef min
-#endif
-#define min(a,b) (a<b ? a : b)
-
-static int usr1_flag = 0;
-static int rtplay = 1;
-static int cmdSocket = -1;
-
-static int writeSocket = -1;
-static int CTRpid = -1, VBpid = -1, VDpid = -1, UIpid = -1;
-static int ABpid = -1;
-static int videoSocket = -1;
-static int audioSocket = -1;
-static int hasAudioDevice = 0;
-static int cmdBytes = 0;
-static char *cmdBuffer = NULL;
-static char *vh, *vf, *ah, *af;
-static int cmdAcks = 0;
-static int speedPtr = 0;
-static struct
-{
- int frameId;
- int usecPerFrame;
- float frameRateLimit;
- int frames;
- int framesDropped;
-} speedHistory[SPEEDHIST_SIZE];
-
-/* following are for live video */
-static unsigned startTime; /* used to record start time for live playback,
- also used to record FF/FB/PLAY round trip time */
-static unsigned startVSA; /* VS advance at the begining of playback of live video */
-static int displayedFrames;
-
-/* following static variable is for frameRate feedback. See comments on
- initialization of these variables in function play()*/
-
-static int fbstate = 0; /* state value of frame-rate feedback */
-static double maxfr = 0; /* frame-rate limit during playback, in fps. This is deduced
- from frameRateLimit, a constant during a playback, even if
- play speed changes */
-static int minupf = 0; /* minimum usec/frame, equals to 1000000/maxfr */
-static double maxrate = 0; /* current max frame rate, in percent of maxfr, after taken
- playspeed into consideration. If play speed > maxfr,
- then this value would be 1.0. Otherwise it would be
- playspeed/maxfr */
-static double frate = 0; /* current server frame rate, in percentage of maxrate */
-static double adjstep = 0; /* step of frame-rate adjustment. In percentage value.
- This is basically
- maxrate/#frames-in-feedback-frame-sequence */
-static int fb_startup = 0; /* Indicate the first feedback action. The first feedback
- action is to set the server fps directly according to
- actully measured display frame-rate. All following
- feedback action would then adjust server fps linearly
- adjstep each time */
-
-AudioBuffer *abuffer;
-VideoBuffer *vbuffer;
-int asp[2];
-int vsp[2];
-int vdsp[2];
-
-#define max(a,b) (a>b ? a : b)
-#define min(a,b) (a<b ? a : b)
-
-#define NewCmd(val) {shared->cmd = val; shared->cmdsn ++; }
-
-static void compute_sendPattern(void);
-
-int
-OurCmdRead(char *buf, int size)
-{
- int val;
- if (size == 0) return 0;
- if (cmdBytes > 0)
- {
- ACE_OS::memcpy (buf, cmdBuffer, size);
- cmdBytes -= size;
- cmdBuffer += size;
- return 0;
- }
- while ((val = ACE_OS::read (cmdSocket, (buf), (size))) <= 0)
- {
- if (val == -1 && errno == EINTR) return 1;
- if (!val) {
- ACE_OS::perror ("CTR error, EOF reached unexpected within CmdRead()");
- }
- else {
- ACE_OS::perror ("CTR CmdRead() from UI through CmdSocket");
- }
- ACE_OS::exit (1);
- }
- return 0;
-}
-
-static void CmdWrite(unsigned char * buf, int size)
-{
- if (cmdAcks > 0 && size == 1 && *buf == CmdDONE)
- {
- cmdAcks --;
- return;
- }
-
- while (ACE_OS::write(cmdSocket, buf, size) == -1)
- {
- if (errno == EINTR)
- continue;
- ACE_OS::perror ("CTR writes to UI through cmdSocket");
- ACE_OS::exit (1);
- }
-}
-
-/* following function can be replaced by ../shared/fileio.c:read_bytes()
- but SocketRead provides more error info */
-
-static void SocketRead(int s, char *buf, int size)
-{ int val, remain = size;
- char * ptr = buf;
- // fprintf (stderr, "SocketRead: videoSocket = %d\n",videoSocket);
- for (;;)
- {
- val = ACE_OS::read (s, ptr, remain);
-
- // fprintf(stderr, "CTR got from %sSocket %d of %d.\n",s == videoSocket ? "video" : "audio", val, remain);
-
- if (val == -1 && errno == EINTR)
- {
- errno = 0;
- continue;
- }
- if (val == -1)
- {
- fprintf(stderr, "CTR error read %sSocket, ret=%d(size=%d)",
- s == videoSocket ? "video" : "audio", size-remain, size);
- ACE_OS::perror ("");
- ACE_OS::exit (1);
- }
- if (val == 0)
- {
- fprintf(stderr, "CTR error read %sSocket, EOF met, ret=%d(size=%d).\n",
- s == videoSocket ? "video" : "audio", size-remain, size);
- ACE_OS::exit (1);
- }
- ptr += val;
- remain -= val;
- if (remain < 0)
- {
- fprintf(stderr, "CTR error read %sSocket, read too much, ret=%d(size=%d).\n",
- s == videoSocket ? "video" : "audio", size-remain, size);
- ACE_OS::exit (1);
- }
- if (remain == 0)
- break;
- }
-}
-
-#define VideoRead(buf, size) SocketRead(videoSocket, buf, size)
-
-#define VideoWrite(buf, psize) \
- { int val; while ((val = ACE_OS::write (videoSocket, (buf), (psize))) == -1) \
- { if (errno == EINTR) continue; \
- ACE_OS::perror ("CTR writes to VS through videoSocket");\
- ACE_OS::exit (1); \
- } \
- if (val < (int)(psize)) { \
- fprintf(stderr, "CTR bad VideoWrite, size %d, val %d", psize, val);ACE_OS::perror (""); }\
- }
-
-#define AudioRead(buf, size) SocketRead(audioSocket, buf, size)
-
-#define AudioWrite(buf, size) \
- { while (write(audioSocket, (buf), (size)) == -1) \
- { if (errno == EINTR) continue; \
- ACE_OS::perror ("CTR writes to AS through audioSocket"); \
- ACE_OS::exit (1); \
- } \
- }
-
-static void start_timer(void);
-static void stop_timer(void);
-static void timer_speed(void);
-static void wait_display(void);
-static void stop_playing();
-
-static void set_speed(void)
-{
- int val;
- if (shared->live) {
- shared->speedPosition = 50;
- }
- val = shared->speedPosition;
- if (val == 0)
- val = 1;
- if (shared->cmd == CmdPLAY && audioSocket >= 0 && videoSocket >= 0 && rtplay) {
- /* limit audio signal period to no more than 1.0 seconds, because AudioFile
- will block if one send more than 4 seconds of sample ahead of current
- time. and our timing control is not precise.
- */
- double s = ((1.0 / shared->pictureRate) * 50.0) *
- (double)max(shared->config.framesPerAudioPlay, 1) / 1.0;
- if (s > 50.0) {
- fprintf(stderr, "CTR warning: lower value of parameter framesPerAudioPlay,\n");
- fprintf(stderr, " otherwise the Player may not work properly.\n");
- }
- if (val < s) {
- if (shared->config.verbose) {
- if (val < s * 1.0 / 2.0) {
- val = (int)s;
- fprintf(stderr, "CTR warning: speed too low, set to %d scale val.\n", val);
- }
- else {
- fprintf(stderr, "CTR warning: audio signal period %3.2f > 1 sec.\n",
- 1.0 * (float)s / (float) val);
- fprintf(stderr, " lower framesPerAudioPlay or increase speed.\n");
- }
- }
- else {
- val = (int)s;
- }
- }
- }
- if (videoSocket >= 0)
- {
- float fps;
- if (val <= 50)
- fps = shared->pictureRate * (float)val / 50.0;
- else
- {
- float rate = shared->config.maxFPS - shared->pictureRate;
- fps = shared->pictureRate + (float)rate * (float)(val - 50) / 50.0;
- /* only B frames are to be dropped */
- }
- Fprintf(stderr, "Play speed video %5.1ffps\n", fps);
- shared->framesPerSecond = (int)fps;
- shared->usecPerFrame = (int) (1000000.0/fps);
- if (audioSocket >= 0)
- {
- float sps = shared->audioPara.samplesPerSecond * fps / shared->pictureRate;
- shared->samplesPerSecond = (int)sps;
- shared->usecPerSample = (int)(1000000.0/sps);
- }
- }
- else if (audioSocket >= 0)
- {
- float sps;
- if (val <= 50)
- sps = (float)shared->audioPara.samplesPerSecond * (float)val / 50.0;
- else
- {
- int rate = shared->config.maxSPS - shared->audioPara.samplesPerSecond;
- sps = shared->audioPara.samplesPerSecond + (float)rate * (float)(val - 50) / 50.0;
- }
- Fprintf(stderr, "Play speed audio %5.1fsps\n", sps);
- shared->samplesPerSecond = (int)sps;
- shared->usecPerSample = (int)(1000000.0/sps);
- }
-}
-
-static int timer_on = 0;
-static int timer_signals_skip = 0;
-static int timerCount = 0;
-static int lastCount = 0;
-static int timerUPF;
-static int wait_usr2 = 0;
-static int last_disp_fid = 0;
-
-static void loopBack(void)
-{
- static char loopBackCmd[7] = {CmdSTOP, CmdPOSITIONrelease,
- 0, 0, 0, 0, CmdPLAY};
- cmdBuffer = loopBackCmd;
- cmdBytes = 7;
- cmdAcks = 3;
-}
-
-#define AUDIO_BUFSIZE 2048
-
-static int audioCount = 0;
-static int audioFirst = 0;
-static int needAudioSkip = 0;
-static int bufferedSamples;
-static int nextASSample, startSample;
-static unsigned int nextAFtime;
-static int forward, forwardDelta;
-static int audioForward, framesPerAudioPlay;
-static int AudioBufSize;
-static char * rawBuf = NULL, * workBuf = NULL, * convBuf = NULL;
-
-static void PlayAudioInit(void)
-{
- audioCount = -1;
- audioFirst = 1;
- needAudioSkip = 0;
- startSample = nextASSample = shared->nextSample;
- audioForward = shared->config.audioForward;
- framesPerAudioPlay = max(shared->config.framesPerAudioPlay, 1);
- if (audioForward <= 0)
- audioForward = DEFAULT_audioForward;
- fprintf(stderr, "CTR audioForward: %d samples.\n", audioForward);
- bufferedSamples = (int)(((double)
- (shared->config.audioTimerDuration *
- shared->config.audioBufferedIntervals))
- * (double)shared->audioPara.samplesPerSecond / 1000.0);
- if (rawBuf == NULL)
- {
- if ((rawBuf = (char *)ACE_OS::malloc(AUDIO_BUFSIZE)) == NULL)
- {
- ACE_OS::perror ("CTR fails to allocate rawBuf for audio channel");
- ACE_OS::exit (1);
- }
- if ((workBuf = (char *)ACE_OS::malloc(AUDIO_BUFSIZE)) == NULL)
- {
- ACE_OS::perror ("CTR fails to allocate workBuf for audio channel");
- ACE_OS::exit (1);
- }
- }
- AudioBufSize = (AUDIO_BUFSIZE / shared->audioPara.bytesPerSample) *
- shared->audioPara.bytesPerSample;
-
- StartAudioPlaySession();
-}
-
-/* input the number of samples in the raw buffer,
- returns the numberof samples in theconverted buffer */
-static int AudioConvert(int len)
-{
- int convLen;
-
- if (shared->samplesPerSecond == shared->audioPara.samplesPerSecond)
- {
- convBuf = rawBuf;
- return len;
- }
-
- convBuf = workBuf;
- convLen = len * shared->audioPara.samplesPerSecond / shared->samplesPerSecond;
- AudioInterpolate(rawBuf, len, convBuf, convLen);
- return convLen;
-}
-
-/* returns: 0 - no forward calculated , 1 - forward calculated */
-static int PlayAudio(void)
-{
- int timer_count = timerCount;
- int i = timer_count / framesPerAudioPlay;
- if (audioFirst)
- {
- audioFirst = 0;
- nextAFtime = GetAudioTime() + audioForward;;
- audioCount = -1; /* guarantee that PlayAudio do the first step */
- }
- if (audioCount == i) /* current audio timer signal already processed */
- return 0;
- if (audioCount < i - 1) /* some audio timer signal missing */
- {
- needAudioSkip = 1;
- /*
- Fprintf(stderr, "CTR: some audio timer signal missed.\n");
- */
- }
- if (nextASSample >= shared->totalSamples)
- {
- /*
- timer_on ++;
- */
- return 0;
- }
-
- audioCount = i;
-
- if (needAudioSkip)
- {
- /* return if not enough skip can be done */
- int next_sample = (int)(startSample +
- ((double)timer_count / shared->pictureRate) *
- shared->audioPara.samplesPerSecond);
- int skip_samples = next_sample - nextASSample;
- abuffer->ABskipSamples(skip_samples);
- nextAFtime += (unsigned int)(((double)skip_samples *
- (double)shared->audioPara.samplesPerSecond) /
- (double)shared->samplesPerSecond);
- nextASSample += skip_samples;
- needAudioSkip = 0;
- }
-
- /* read current block, convert, put to AF, and update nextAFtime */
- {
- int frame_samples = (int)(startSample +
- ((double)(timer_count + framesPerAudioPlay) / shared->pictureRate) *
- (double)shared->audioPara.samplesPerSecond -
- nextASSample);
- int fsize = frame_samples * shared->audioPara.bytesPerSample;
- int read_samples;
- unsigned int curAFtime;
- unsigned int oldAFtime = nextAFtime;
- char * ptr = rawBuf;
- if (fsize > AudioBufSize)
- { /* make sure the rawBuf is big enough */
- Fprintf(stderr, "CTR PlayAudio error: BytesPerFrame=%d > AudioBufSize=%d.\n",
- fsize, AudioBufSize);
- Fprintf(stderr,
- "CTR PlayAudio: startSample=%d, timer_count=%d, nextASSmple=%d.\n",
- startSample, timer_count, nextASSample);
- fprintf(stderr, "Internal error: audio resampling buffer not big enough,\n\
- please reduce value of parameter 'Audio timer interval',\n\
- or 'Audio buffered intervals' or Frames per audio play',\n\
- and try again.\n");
- ACE_OS::exit (1);
- }
-
- read_samples = abuffer->ABgetSamples(ptr, frame_samples);
-
- /* convert and play to AF */
- {
- int maxSamples;
- int left_samples = read_samples;
- if (shared->samplesPerSecond >= shared->audioPara.samplesPerSecond)
- maxSamples = (AudioBufSize/shared->audioPara.bytesPerSample);
- else
- maxSamples = ((AudioBufSize/shared->audioPara.bytesPerSample) *
- shared->samplesPerSecond) /
- shared->audioPara.samplesPerSecond;
- for (;;)
- {
- int samples = (left_samples > maxSamples) ? maxSamples : left_samples;
- int convSamples = AudioConvert(samples);
- curAFtime = PlayAudioSamples(nextAFtime, convBuf, convSamples);
- nextAFtime += convSamples;
- left_samples -= samples;
- if (left_samples == 0)
- break;
- else
- {
- ACE_OS::memcpy (rawBuf, rawBuf + samples * shared->audioPara.bytesPerSample,
- left_samples * shared->audioPara.bytesPerSample);
- }
- }
- }
-
- /* possible bugs in AF some times cause PlayAudioSample() to return 0 */
- forward = curAFtime ? (oldAFtime - curAFtime) : audioForward;
- /*
- if ((oldAFtime - curAFtime) > (audioForward << 6)) {
- fprintf(stderr, "forward %d, oldAFtime %d, curAFtime %d\n",
- oldAFtime - curAFtime, oldAFtime, curAFtime);
- }
- */
- /* check condition */
- if (read_samples == frame_samples) { /* all bytes for current frame already read */
- nextASSample += frame_samples;
- }
- else { /* read to the end of audio file */
- /*
- timer_on ++;
- */
- nextASSample += read_samples;
- }
- shared->nextSample = nextASSample;
- }
- return 1;
-}
-
-
-
-#define MAX_WAIT_USEC 10000000
-
-static void start_timer (void)
-{
- struct itimerval val;
-
- if (audioSocket >= 0 && shared->cmd == CmdPLAY && rtplay)
- {
- // ACE_DEBUG ((LM_DEBUG,"calling playaudioinit ()\n"));
- PlayAudioInit();
- }
-
- /* sleep for a while to wait for decoding the first picture
- and/or audio stream ready */
- {
- unsigned val1 = startTime;
- if (audioSocket >= 0 && shared->cmd == CmdPLAY && rtplay)
- {
- if (shared->nextSample < shared->totalSamples)
- {
- int samples = videoSocket >= 0 ? 1200 : 1200;
- while (abuffer->ABcheckSamples() <= samples)
- {
- if (get_duration(val1, get_usec()) >= MAX_WAIT_USEC)
- {
- fprintf(stderr, "CTR warning: audio is not ready yet.\n");
- break;
- }
- else
- {
- usleep(10000);
- continue;
- }
- }
- }
- }
-
- if (videoSocket >= 0)
- {
- while (VDcheckMsg() <= 0) { /* keep sleeping for 1 millisec until a decoded
- frame show up in VD buffer */
- if (get_duration(val1, get_usec()) >= MAX_WAIT_USEC) {
- fprintf(stderr, "CTR warning: video is not ready yet.\n");
- break;
- }
- usleep(10000);
- }
- }
- val1 = get_duration(val1, get_usec()) / 1000;
- shared->playRoundTripDelay = val1;
-
- Fprintf(stderr, "CTR: estimated play round trip delay: %d millisec.\n", val1);
-
- /*
- if (shared->collectStat)
- {
- fprintf(stderr, "CTR: estimated play round trip delay: %d millisec.\n", val1);
- }
- */
- }
- timer_on = 1;
- timer_signals_skip = 0;
- timerCount = 0;
- lastCount = 0;
-
- if (shared->live) {
-
- /* delay for shared->config.VStimeAdvance milliseconds, adjustable delay */
- if (shared->config.VStimeAdvance > 0) {
- Fprintf(stderr, "CTR adds %d millisec of latency\n",
- shared->config.VStimeAdvance);
- usleep(shared->config.VStimeAdvance * 1000);
- }
- displayedFrames = 0;
- startTime = get_usec();
- startVSA = shared->nextFrame - shared->VBheadFrame;
- if (startVSA < 5) startVSA = 5;
- /*
- Fprintf(stderr, "CTR: startVSA %d\n", startVSA);
- */
- }
-
- if (shared->cmd == CmdPLAY && rtplay) {
- wait_usr2 = 0;
- }
- else {
- wait_usr2 = 1;
- }
- last_disp_fid = -1;
- /*
- fprintf(stderr, "CTR start_timer() - %s for usr2\n",
- wait_usr2 ? "wait" : "NOwait");
- */
- if (shared->cmd == CmdPLAY && audioSocket >= 0 && videoSocket < 0)
- timerUPF = shared->config.audioTimerDuration * 1000;
- else {
- timerUPF = shared->usecPerFrame;
- }
-#ifdef STAT
- speedPtr = 1;
- speedHistory[0].frameId = shared->nextFrame;
- speedHistory[0].usecPerFrame = timerUPF;
- speedHistory[0].frameRateLimit = shared->frameRateLimit;
- speedHistory[0].frames = shared->sendPatternGops * shared->patternSize;
- speedHistory[0].framesDropped = shared->framesDropped;
-#endif
- /*
- fprintf(stderr, "CTR: timer started at %d upf.\n", timerUPF);
- */
- val.it_interval.tv_sec = val.it_value.tv_sec = timerUPF / 1000000;
- val.it_interval.tv_usec = val.it_value.tv_usec = timerUPF % 1000000;
- // setsignal(SIGALRM, TimerHandler);
- setitimer(ITIMER_REAL, &val, NULL);
-}
-
-
-static void wait_display(void)
-{
- if (!usr1_flag) {
- if (shared->cmd == CmdINIT) sleep(10);// XXX hack to make the client wait until the server gets a chance.
- else usleep(800000);
- }
- if (!usr1_flag)
- {
- if (shared->cmd == CmdSTEP) /* to skip undecodable pictures */
- shared->nextFrame ++;
- else if (shared->cmd == CmdINIT) {
- fprintf(stderr, "Warning: initialilzation failed. Please reinitialize the program.\n");
- }
- return;
- }
- usr1_flag = 0;
-}
-
-static void usr1_handler(int sig)
-{
- FrameBlock *buf;
- unsigned char tmp;
- /*
- Fprintf(stderr, "CTR got USR1 for displaying single frame.\n");
- */
- usr1_flag = 1;
-
- if (shared->cmd == CmdINIT) { /* Initialize display window */
- tmp = CmdVPinitScreen;
- CmdWrite(&tmp, 1);
- }
- /*
- fprintf(stderr, "CTR: %d frames in VDbuf.\n", VDcheckMsg());
- */
- while (VDcheckMsg() > 1)
- {
- /*
- Fprintf(stderr, "CTR: VDcheckMsg() = %d, to discard a picture.\n", VDcheckMsg());
- */
- if ((buf = VDgetMsg()) != NULL)
- VDreclaimMsg(buf);
- else
- fprintf(stderr, "CTR error: VDgetMsg is NULL, unexpected.\n");
- }
- if (VDcheckMsg() >0 ) {
- /*
- Fprintf(stderr, "CTR to display a frame in user1_handler()\n");
- */
- buf = VDgetMsg();
- }
- else {
- /*
- Fprintf(stderr, "CTR no frame to display in user_handler()\n");
- */
- buf = NULL;
- }
-
- if (buf != NULL) {
- if (shared->cmd == CmdSTEP)
- {
- shared->nextFrame ++;
- shared->nextGroup = buf->gop + 1;
- }
- else
- {
- shared->nextFrame = buf->display;
- shared->nextGroup = buf->gop;
- }
- tmp = CmdVPdisplayFrame;
- CmdWrite(&tmp, 1);
- CmdWrite((unsigned char *)&buf, sizeof(char *));
- }
- else if (shared->cmd == CmdSTEP) {
- shared->nextFrame ++;
- }
-}
-
-static void compute_sendPattern(void)
-{
- char buf[PATTERN_SIZE];
- float limit = shared->frameRateLimit;
- char * pat = shared->pattern;
- int len = shared->patternSize * shared->sendPatternGops;
- int f;
-
- if (limit <= 0)
- limit = 1.0;
- if (rtplay) {
- f = (int)((double)len *
- ((double)limit / (1000000.0 / (double)shared->usecPerFrame)) + 0.5);
- /* rounded to integer, instead of truncated */
- }
- else {
- f = len;
- }
- if (f >= len)
- f = len;
- else if (f <= 1)
- f = 1;
-
- ComputeSendPattern(pat, buf, len, f);
- shared->qosRecomputes ++;
-
- ACE_OS::memcpy (shared->sendPattern, buf, PATTERN_SIZE);
-
- f = len - f;
- if (shared->config.verbose) {
- fprintf(stderr, "speed %dupf, %d frames dropped, frames %d:\nsend pattern:",
- shared->usecPerFrame, f, len);
- shared->framesDropped = f;
- {
- int i;
- for (i = 0; i < len; i ++)
- fputc(buf[i] ? pat[i] : '-', stderr);
- }
- fputc('\n', stderr);
- }
-}
-
-
-static void on_exit_routine(void)
-{
- // ACE_DEBUG ((LM_DEBUG,
- // "(%P|%t) %s:%d\n",
- // __FILE__,
- // __LINE__));
- unsigned char tmp = CmdCLOSE;
-
- if (getpid() != CTRpid) return;
-
- if (audioSocket >= 0)
- {
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (asp[0],&message,BUFSIZ);
- // ACE_OS::write (audioSocket, &tmp, 1);
- // ComCloseConn(audioSocket);
- audioSocket = -1;
- }
-
- if (videoSocket >= 0)
- {
- // ACE_OS::write (videoSocket, &tmp, 1);
- // ComCloseConn(videoSocket);
- videoSocket = -1;
- if (VBpid > 0) {
- char message[BUFSIZ];
- message [0] = EXIT;
- ACE_OS::write (vsp[0],&message,BUFSIZ);
- // ACE_OS::kill (VBpid, SIGUSR1);
- VBpid = -1;
- }
- }
- ComCloseClient();
-}
-
-int CTRmain(int argc,
- char **argv)
-{
- int sv[2];
- extern void set_exit_routine_tag(int tag);
-
- FILE * fp = NULL; /* file pointer for experiment plan */
-
- set_exit_routine_tag(0);
-
- /* allocate shared data structure and initialize it */
- shared = (SharedData *) creat_shared_mem(sizeof(*shared));
- shared->cmd = 0;
- shared->cmdsn = 0;
- shared->cmdBusy = 0;
- shared->loopBack = 0;
- shared->volumePosition = 0;
- shared->balancePosition = 50;
- shared->locationPosition = 0;
- shared->speedPosition = 0;
- shared->qosRecomputes = 0;
-
- shared->pixelValid = 0;
-
- shared->config.rt = 1;
- shared->config.maxFPS = DEFAULT_maxFPS;
- shared->config.maxSPS = DEFAULT_maxSPS;
- shared->config.ffFPS = DEFAULT_ffFPS;
- shared->config.fbFPS = DEFAULT_fbFPS;
- shared->config.feedBackDelay = DEFAULT_feedBackDelay;
- shared->config.audioMask = DEFAULT_audioMask;
- shared->config.audioPara.encodeType = DEFAULT_encodeType;
- shared->config.audioPara.channels = DEFAULT_channels;
- shared->config.audioPara.samplesPerSecond = DEFAULT_samplesPerSecond;
- shared->config.audioPara.bytesPerSample = DEFAULT_bytesPerSample;
- shared->config.audioTimerDuration = DEFAULT_audioTimerDuration;
- shared->config.audioBufferedIntervals = DEFAULT_audioBufferedIntervals;
- shared->config.framesPerAudioPlay = DEFAULT_framesPerAudioPlay;
- shared->config.audioForward = DEFAULT_audioForward;
- shared->config.VStimeAdvance = DEFAULT_VStimeAdvance;
- shared->config.frameRateLimit = DEFAULT_maxFPS;
- shared->config.collectStat = 0;
- shared->config.collectFrameInfo = 0;
- shared->config.syncEffective = 1;
- shared->config.qosEffective = 1;
- shared->config.audioOffset = 0;
- shared->config.filterPara = DEFAULT_filterPara;
- shared->config.maxSPframes = DEFAULT_maxSPframes;
- shared->config.audioConn = 0;
- shared->config.videoConn = 0;
- shared->config.verbose = (!getuid()) || ACE_OS::getuid () == DEVELOPER_UID;
-
- ACE_NEW_RETURN (vbuffer,
- VideoBuffer (),
- -1);
-
- ACE_NEW_RETURN (abuffer,
- AudioBuffer (),
- -1);
-
- /* create all shared buffers: AB-CTR, VB-VD, VD-VP */
- abuffer->ABinitBuf(AB_BUF_SIZE);
- vbuffer->VBinitBuf(VB_BUF_SIZE);
- VDinitBuf(VD_BUF_SIZE);
-
- CTRpid =ACE_OS::getpid ();
- set_exit_routine_tag(1);
-
-
- // create the notification socket pair.
- if (ACE_OS::socketpair (AF_UNIX,SOCK_STREAM,0,asp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"Error in opening notification socket:%p",
- "notification socket"),-1);
-
- // create the notification socket pair.
- if (ACE_OS::socketpair (AF_UNIX,SOCK_STREAM,0,vsp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"Error in opening notification socket:%p",
- "notification socket"),-1);
-
- if (ACE_OS::socketpair (AF_UNIX,SOCK_STREAM,0,vdsp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"Error in opening notification socket:%p",
- "notification socket"),-1);
-
- /* create command socket pair */
- if (ACE_OS::socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == -1)
- {
- ACE_OS::perror ("CTR error on open cmd socketpair");
- ACE_OS::exit (1);
- }
- cmdSocket = sv[0];
- /* fork processes: VD, GUI */
-
- if ((VDpid = ACE_OS::fork ()) == -1)
- {
- ACE_OS::perror ("CTR error on fork VD");
- ACE_OS::exit (1);
- } else if (VDpid == 0)
- {
- abuffer->ABdeleteBuf();
- ACE_OS::close (sv[0]);
- ACE_OS::close (sv[1]);
- if (realTimeFlag >= 3) {
- if (SetRTpriority("VD", 0)) realTimeFlag = 0;
- }
- VDprocess(CTRpid);
- }
-
- if ((UIpid = ACE_OS::fork ()) == -1)
- {
- ACE_OS::perror ("CTR error on fork UI");
- ACE_OS::exit (1);
- } else if (UIpid == 0)
- {
- vbuffer->VBdeleteBuf();
- abuffer->ABdeleteBuf();
- ACE_OS::close (sv[0]);
- if (realTimeFlag >= 2) {
-#ifdef __svr4__
- if (SetRTpriority("VB", 0)) realTimeFlag = 0;
-#elif defined(_HPUX_SOURCE)
- if (SetRTpriority("VB", 2)) realTimeFlag = 0;
-#endif
- }
- UIprocess(sv[1]);
- }
- ACE_OS::close (sv[1]);
-
- /* initialize Audio device */
- if (InitAudioDevice() == 0)
- hasAudioDevice = 1;
- else
- hasAudioDevice = 0;
-
- // ComInitClient(VCR_TCP_PORT, VCR_UNIX_PORT, VCR_ATM_PORT);
-
- if ((vh = (char *)ACE_OS::malloc(PATH_SIZE)) == NULL)
- {
- ACE_OS::perror ("CTR failed to allocate space for vh");
- ACE_OS::exit (1);
- }
- if ((vf = (char *)ACE_OS::malloc(PATH_SIZE)) == NULL)
- {
- ACE_OS::perror ("CTR failed to allocate space for vf");
- ACE_OS::exit (1);
- }
- if ((ah = (char *)ACE_OS::malloc(PATH_SIZE)) == NULL)
- {
- ACE_OS::perror ("CTR failed to allocate space for ah");
- ACE_OS::exit (1);
- }
- if ((af = (char *)ACE_OS::malloc(PATH_SIZE)) == NULL)
- {
- ACE_OS::perror ("CTR failed to allocate space for af");
- ACE_OS::exit (1);
- }
- if (realTimeFlag) {
- if (SetRTpriority("CTR", 4)) realTimeFlag = 0;
- }
-
- // instantiate our command handler
- Command_Handler command_handler (cmdSocket);
- if (command_handler.init (argc,argv) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) command_handler: init returned -1"),
- -1);
-
- // .. and register it with the reactor.
- if (TAO_ORB_Core_instance ()->reactor ()->register_handler (&command_handler,
- ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) register_handler for command_handler failed\n"),
- -1);
-
- int result = command_handler.run ();
- if (ABpid == 0)
- {
- ACE_DEBUG ((LM_DEBUG,"(%d) Restarting the ACE_Reactor::instance ()",ACE_OS::getpid ()));
- ACE_Reactor::instance ()->run_event_loop ();
- }
-
- if (VBpid == 0)
- {
- ACE_DEBUG ((LM_DEBUG,"(%d) Restarting the ACE_Reactor::instance ()",ACE_OS::getpid ()));
- ACE_Reactor::instance ()->run_event_loop ();
- }
-
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) Exited the client command handler event loop\n"
- "%p\n",
- "run_event_loop"));
-
- return 0;
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp
deleted file mode 100644
index 43e4373934f..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp
+++ /dev/null
@@ -1,937 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/*
- * decoders.c
- *
- * This file contains all the routines for Huffman decoding required in
- * MPEG
- *
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include "decoders.h"
-#include "util.h"
-#include "video.h"
-#include "proto.h"
-
-ACE_RCSID(mpeg_client, decoders, "$Id$")
-
-/* Decoding table for macroblock_address_increment */
-mb_addr_inc_entry mb_addr_inc[2048];
-
-/* Decoding table for macroblock_type in predictive-coded pictures */
-mb_type_entry mb_type_P[64];
-
-/* Decoding table for macroblock_type in bidirectionally-coded pictures */
-mb_type_entry mb_type_B[64];
-
-/* Decoding table for motion vectors */
-motion_vectors_entry motion_vectors[2048];
-
-/* Decoding table for coded_block_pattern */
-
-coded_block_pattern_entry coded_block_pattern[512] =
-{ {(unsigned int)ERROR, 0}, {(unsigned int)ERROR, 0}, {39, 9}, {27, 9}, {59, 9}, {55, 9}, {47, 9}, {31, 9},
- {58, 8}, {58, 8}, {54, 8}, {54, 8}, {46, 8}, {46, 8}, {30, 8}, {30, 8},
- {57, 8}, {57, 8}, {53, 8}, {53, 8}, {45, 8}, {45, 8}, {29, 8}, {29, 8},
- {38, 8}, {38, 8}, {26, 8}, {26, 8}, {37, 8}, {37, 8}, {25, 8}, {25, 8},
- {43, 8}, {43, 8}, {23, 8}, {23, 8}, {51, 8}, {51, 8}, {15, 8}, {15, 8},
- {42, 8}, {42, 8}, {22, 8}, {22, 8}, {50, 8}, {50, 8}, {14, 8}, {14, 8},
- {41, 8}, {41, 8}, {21, 8}, {21, 8}, {49, 8}, {49, 8}, {13, 8}, {13, 8},
- {35, 8}, {35, 8}, {19, 8}, {19, 8}, {11, 8}, {11, 8}, {7, 8}, {7, 8},
- {34, 7}, {34, 7}, {34, 7}, {34, 7}, {18, 7}, {18, 7}, {18, 7}, {18, 7},
- {10, 7}, {10, 7}, {10, 7}, {10, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7},
- {33, 7}, {33, 7}, {33, 7}, {33, 7}, {17, 7}, {17, 7}, {17, 7}, {17, 7},
- {9, 7}, {9, 7}, {9, 7}, {9, 7}, {5, 7}, {5, 7}, {5, 7}, {5, 7},
- {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6},
- {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6},
- {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6},
- {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6},
- {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5},
- {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5},
- {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5},
- {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5},
- {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5},
- {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5},
- {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5},
- {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5},
- {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5},
- {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5},
- {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5},
- {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5},
- {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5},
- {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5},
- {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5},
- {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5},
- {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5},
- {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5},
- {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5},
- {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5},
- {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5},
- {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5},
- {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5},
- {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5},
- {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
- {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
- {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
- {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
- {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
- {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
- {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
- {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
- {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
- {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
- {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
- {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
- {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
- {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
- {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
- {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
- {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}
-};
-
-/* Decoding table for dct_dc_size_luminance */
-dct_dc_size_entry dct_dc_size_luminance[128] =
-{ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3},
- {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3},
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
- {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3},
- {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3},
- {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4},
- {6, 5}, {6, 5}, {6, 5}, {6, 5}, {7, 6}, {7, 6}, {8, 7}, {(unsigned int)ERROR, 0}
-};
-
-/* Decoding table for dct_dc_size_chrominance */
-dct_dc_size_entry dct_dc_size_chrominance[256] =
-{ {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
- {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
- {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
- {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5},
- {6, 6}, {6, 6}, {6, 6}, {6, 6}, {7, 7}, {7, 7}, {8, 8}, {(unsigned int)ERROR, 0}
-};
-
-/* DCT coeff tables. */
-
-unsigned short int dct_coeff_tbl_0[256] =
-{
-0xffff, 0xffff, 0xffff, 0xffff,
-0xffff, 0xffff, 0xffff, 0xffff,
-0xffff, 0xffff, 0xffff, 0xffff,
-0xffff, 0xffff, 0xffff, 0xffff,
-0x052f, 0x051f, 0x050f, 0x04ff,
-0x183f, 0x402f, 0x3c2f, 0x382f,
-0x342f, 0x302f, 0x2c2f, 0x7c1f,
-0x781f, 0x741f, 0x701f, 0x6c1f,
-0x028e, 0x028e, 0x027e, 0x027e,
-0x026e, 0x026e, 0x025e, 0x025e,
-0x024e, 0x024e, 0x023e, 0x023e,
-0x022e, 0x022e, 0x021e, 0x021e,
-0x020e, 0x020e, 0x04ee, 0x04ee,
-0x04de, 0x04de, 0x04ce, 0x04ce,
-0x04be, 0x04be, 0x04ae, 0x04ae,
-0x049e, 0x049e, 0x048e, 0x048e,
-0x01fd, 0x01fd, 0x01fd, 0x01fd,
-0x01ed, 0x01ed, 0x01ed, 0x01ed,
-0x01dd, 0x01dd, 0x01dd, 0x01dd,
-0x01cd, 0x01cd, 0x01cd, 0x01cd,
-0x01bd, 0x01bd, 0x01bd, 0x01bd,
-0x01ad, 0x01ad, 0x01ad, 0x01ad,
-0x019d, 0x019d, 0x019d, 0x019d,
-0x018d, 0x018d, 0x018d, 0x018d,
-0x017d, 0x017d, 0x017d, 0x017d,
-0x016d, 0x016d, 0x016d, 0x016d,
-0x015d, 0x015d, 0x015d, 0x015d,
-0x014d, 0x014d, 0x014d, 0x014d,
-0x013d, 0x013d, 0x013d, 0x013d,
-0x012d, 0x012d, 0x012d, 0x012d,
-0x011d, 0x011d, 0x011d, 0x011d,
-0x010d, 0x010d, 0x010d, 0x010d,
-0x282c, 0x282c, 0x282c, 0x282c,
-0x282c, 0x282c, 0x282c, 0x282c,
-0x242c, 0x242c, 0x242c, 0x242c,
-0x242c, 0x242c, 0x242c, 0x242c,
-0x143c, 0x143c, 0x143c, 0x143c,
-0x143c, 0x143c, 0x143c, 0x143c,
-0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c,
-0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c,
-0x085c, 0x085c, 0x085c, 0x085c,
-0x085c, 0x085c, 0x085c, 0x085c,
-0x047c, 0x047c, 0x047c, 0x047c,
-0x047c, 0x047c, 0x047c, 0x047c,
-0x046c, 0x046c, 0x046c, 0x046c,
-0x046c, 0x046c, 0x046c, 0x046c,
-0x00fc, 0x00fc, 0x00fc, 0x00fc,
-0x00fc, 0x00fc, 0x00fc, 0x00fc,
-0x00ec, 0x00ec, 0x00ec, 0x00ec,
-0x00ec, 0x00ec, 0x00ec, 0x00ec,
-0x00dc, 0x00dc, 0x00dc, 0x00dc,
-0x00dc, 0x00dc, 0x00dc, 0x00dc,
-0x00cc, 0x00cc, 0x00cc, 0x00cc,
-0x00cc, 0x00cc, 0x00cc, 0x00cc,
-0x681c, 0x681c, 0x681c, 0x681c,
-0x681c, 0x681c, 0x681c, 0x681c,
-0x641c, 0x641c, 0x641c, 0x641c,
-0x641c, 0x641c, 0x641c, 0x641c,
-0x601c, 0x601c, 0x601c, 0x601c,
-0x601c, 0x601c, 0x601c, 0x601c,
-0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c,
-0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c,
-0x581c, 0x581c, 0x581c, 0x581c,
-0x581c, 0x581c, 0x581c, 0x581c,
-};
-
-unsigned short int dct_coeff_tbl_1[16] =
-{
-0x00bb, 0x202b, 0x103b, 0x00ab,
-0x084b, 0x1c2b, 0x541b, 0x501b,
-0x009b, 0x4c1b, 0x481b, 0x045b,
-0x0c3b, 0x008b, 0x182b, 0x441b,
-};
-
-unsigned short int dct_coeff_tbl_2[4] =
-{
-0x4019, 0x1429, 0x0079, 0x0839,
-};
-
-unsigned short int dct_coeff_tbl_3[4] =
-{
-0x0449, 0x3c19, 0x3819, 0x1029,
-};
-
-unsigned short int dct_coeff_next[256] =
-{
-0xffff, 0xffff, 0xffff, 0xffff,
-0xf7d5, 0xf7d5, 0xf7d5, 0xf7d5,
-0x0826, 0x0826, 0x2416, 0x2416,
-0x0046, 0x0046, 0x2016, 0x2016,
-0x1c15, 0x1c15, 0x1c15, 0x1c15,
-0x1815, 0x1815, 0x1815, 0x1815,
-0x0425, 0x0425, 0x0425, 0x0425,
-0x1415, 0x1415, 0x1415, 0x1415,
-0x3417, 0x0067, 0x3017, 0x2c17,
-0x0c27, 0x0437, 0x0057, 0x2817,
-0x0034, 0x0034, 0x0034, 0x0034,
-0x0034, 0x0034, 0x0034, 0x0034,
-0x1014, 0x1014, 0x1014, 0x1014,
-0x1014, 0x1014, 0x1014, 0x1014,
-0x0c14, 0x0c14, 0x0c14, 0x0c14,
-0x0c14, 0x0c14, 0x0c14, 0x0c14,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-0x0011, 0x0011, 0x0011, 0x0011,
-};
-
-unsigned short int dct_coeff_first[256] =
-{
-0xffff, 0xffff, 0xffff, 0xffff,
-0xf7d5, 0xf7d5, 0xf7d5, 0xf7d5,
-0x0826, 0x0826, 0x2416, 0x2416,
-0x0046, 0x0046, 0x2016, 0x2016,
-0x1c15, 0x1c15, 0x1c15, 0x1c15,
-0x1815, 0x1815, 0x1815, 0x1815,
-0x0425, 0x0425, 0x0425, 0x0425,
-0x1415, 0x1415, 0x1415, 0x1415,
-0x3417, 0x0067, 0x3017, 0x2c17,
-0x0c27, 0x0437, 0x0057, 0x2817,
-0x0034, 0x0034, 0x0034, 0x0034,
-0x0034, 0x0034, 0x0034, 0x0034,
-0x1014, 0x1014, 0x1014, 0x1014,
-0x1014, 0x1014, 0x1014, 0x1014,
-0x0c14, 0x0c14, 0x0c14, 0x0c14,
-0x0c14, 0x0c14, 0x0c14, 0x0c14,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0023, 0x0023, 0x0023, 0x0023,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0813, 0x0813, 0x0813, 0x0813,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0412, 0x0412, 0x0412, 0x0412,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010,
-};
-
-/* Macro for filling up the decoding table for mb_addr_inc */
-#define ASSIGN1(start, end, step, val, num) \
- for (i = start; i < end; i+= step) { \
- for (j = 0; j < step; j++) { \
- mb_addr_inc[i+j].value = val; \
- mb_addr_inc[i+j].num_bits = num; \
- } \
- val--; \
- }
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * init_mb_addr_inc --
- *
- * Initialize the VLC decoding table for macro_block_address_increment
- *
- * Results:
- * The decoding table for macro_block_address_increment will
- * be filled; illegal values will be filled as ERROR.
- *
- * Side effects:
- * The global array mb_addr_inc will be filled.
- *
- *--------------------------------------------------------------
- */
-static void
-init_mb_addr_inc()
-{
- int i, j, val;
-
- for (i = 0; i < 8; i++) {
- mb_addr_inc[i].value = (unsigned int)ERROR;
- mb_addr_inc[i].num_bits = 0;
- }
-
- mb_addr_inc[8].value = MACRO_BLOCK_ESCAPE;
- mb_addr_inc[8].num_bits = 11;
-
- for (i = 9; i < 15; i++) {
- mb_addr_inc[i].value = (unsigned int)ERROR;
- mb_addr_inc[i].num_bits = 0;
- }
-
- mb_addr_inc[15].value = MACRO_BLOCK_STUFFING;
- mb_addr_inc[15].num_bits = 11;
-
- for (i = 16; i < 24; i++) {
- mb_addr_inc[i].value = (unsigned int)ERROR;
- mb_addr_inc[i].num_bits = 0;
- }
-
- val = 33;
-
- ASSIGN1(24, 36, 1, val, 11);
- ASSIGN1(36, 48, 2, val, 10);
- ASSIGN1(48, 96, 8, val, 8);
- ASSIGN1(96, 128, 16, val, 7);
- ASSIGN1(128, 256, 64, val, 5);
- ASSIGN1(256, 512, 128, val, 4);
- ASSIGN1(512, 1024, 256, val, 3);
- ASSIGN1(1024, 2048, 1024, val, 1);
-}
-
-
-/* Macro for filling up the decoding table for mb_type */
-#define ASSIGN2(start, end, quant, motion_forward, motion_backward, pattern, intra, num, mb_type) \
- for (i = start; i < end; i ++) { \
- mb_type[i].mb_quant = quant; \
- mb_type[i].mb_motion_forward = motion_forward; \
- mb_type[i].mb_motion_backward = motion_backward; \
- mb_type[i].mb_pattern = pattern; \
- mb_type[i].mb_intra = intra; \
- mb_type[i].num_bits = num; \
- }
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * init_mb_type_P --
- *
- * Initialize the VLC decoding table for macro_block_type in
- * predictive-coded pictures.
- *
- * Results:
- * The decoding table for macro_block_type in predictive-coded
- * pictures will be filled; illegal values will be filled as ERROR.
- *
- * Side effects:
- * The global array mb_type_P will be filled.
- *
- *--------------------------------------------------------------
- */
-static void
-init_mb_type_P()
-{
- int i;
-
- mb_type_P[0].mb_quant = mb_type_P[0].mb_motion_forward
- = mb_type_P[0].mb_motion_backward = mb_type_P[0].mb_pattern
- = mb_type_P[0].mb_intra = (unsigned int)ERROR;
- mb_type_P[0].num_bits = 0;
-
- ASSIGN2(1, 2, 1, 0, 0, 0, 1, 6, mb_type_P)
- ASSIGN2(2, 4, 1, 0, 0, 1, 0, 5, mb_type_P)
- ASSIGN2(4, 6, 1, 1, 0, 1, 0, 5, mb_type_P);
- ASSIGN2(6, 8, 0, 0, 0, 0, 1, 5, mb_type_P);
- ASSIGN2(8, 16, 0, 1, 0, 0, 0, 3, mb_type_P);
- ASSIGN2(16, 32, 0, 0, 0, 1, 0, 2, mb_type_P);
- ASSIGN2(32, 64, 0, 1, 0, 1, 0, 1, mb_type_P);
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * init_mb_type_B --
- *
- * Initialize the VLC decoding table for macro_block_type in
- * bidirectionally-coded pictures.
- *
- * Results:
- * The decoding table for macro_block_type in bidirectionally-coded
- * pictures will be filled; illegal values will be filled as ERROR.
- *
- * Side effects:
- * The global array mb_type_B will be filled.
- *
- *--------------------------------------------------------------
- */
-static void
-init_mb_type_B()
-{
- int i;
-
- mb_type_B[0].mb_quant = mb_type_B[0].mb_motion_forward
- = mb_type_B[0].mb_motion_backward = mb_type_B[0].mb_pattern
- = mb_type_B[0].mb_intra = (unsigned int)ERROR;
- mb_type_B[0].num_bits = 0;
-
- ASSIGN2(1, 2, 1, 0, 0, 0, 1, 6, mb_type_B);
- ASSIGN2(2, 3, 1, 0, 1, 1, 0, 6, mb_type_B);
- ASSIGN2(3, 4, 1, 1, 0, 1, 0, 6, mb_type_B);
- ASSIGN2(4, 6, 1, 1, 1, 1, 0, 5, mb_type_B);
- ASSIGN2(6, 8, 0, 0, 0, 0, 1, 5, mb_type_B);
- ASSIGN2(8, 12, 0, 1, 0, 0, 0, 4, mb_type_B);
- ASSIGN2(12, 16, 0, 1, 0, 1, 0, 4, mb_type_B);
- ASSIGN2(16, 24, 0, 0, 1, 0, 0, 3, mb_type_B);
- ASSIGN2(24, 32, 0, 0, 1, 1, 0, 3, mb_type_B);
- ASSIGN2(32, 48, 0, 1, 1, 0, 0, 2, mb_type_B);
- ASSIGN2(48, 64, 0, 1, 1, 1, 0, 2, mb_type_B);
-}
-
-
-/* Macro for filling up the decoding tables for motion_vectors */
-#define ASSIGN3(start, end, step, val, num) \
- for (i = start; i < end; i+= step) { \
- for (j = 0; j < step / 2; j++) { \
- motion_vectors[i+j].code = val; \
- motion_vectors[i+j].num_bits = num; \
- } \
- for (j = step / 2; j < step; j++) { \
- motion_vectors[i+j].code = -val; \
- motion_vectors[i+j].num_bits = num; \
- } \
- val--; \
- }
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * init_motion_vectors --
- *
- * Initialize the VLC decoding table for the various motion
- * vectors, including motion_horizontal_forward_code,
- * motion_vertical_forward_code, motion_horizontal_backward_code,
- * and motion_vertical_backward_code.
- *
- * Results:
- * The decoding table for the motion vectors will be filled;
- * illegal values will be filled as ERROR.
- *
- * Side effects:
- * The global array motion_vector will be filled.
- *
- *--------------------------------------------------------------
- */
-static void
-init_motion_vectors()
-{
- int i, j, val = 16;
-
- for (i = 0; i < 24; i++) {
- motion_vectors[i].code = (unsigned int)ERROR;
- motion_vectors[i].num_bits = 0;
- }
-
- ASSIGN3(24, 36, 2, val, 11);
- ASSIGN3(36, 48, 4, val, 10);
- ASSIGN3(48, 96, 16, val, 8);
- ASSIGN3(96, 128, 32, val, 7);
- ASSIGN3(128, 256, 128, val, 5);
- ASSIGN3(256, 512, 256, val, 4);
- ASSIGN3(512, 1024, 512, val, 3);
- ASSIGN3(1024, 2048, 1024, val, 1);
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * init_tables --
- *
- * Initialize all the tables for VLC decoding; this must be
- * called when the system is set up before any decoding can
- * take place.
- *
- * Results:
- * All the decoding tables will be filled accordingly.
- *
- * Side effects:
- * The corresponding global array for each decoding table
- * will be filled.
- *
- *--------------------------------------------------------------
- */
-void
-init_tables()
-{
- extern void init_pre_idct();
-
- init_mb_addr_inc();
- init_mb_type_P();
- init_mb_type_B();
- init_motion_vectors();
- init_pre_idct();
-
-#ifdef ANALYSIS
- {
- init_stats();
- }
-#endif
-}
-
-/*
- *--------------------------------------------------------------
- *
- * DecodeDCTDCSizeLum --
- *
- * Huffman Decoder for dct_dc_size_luminance; location where
- * the result of decoding will be placed is passed as argument.
- * The decoded values are obtained by doing a table lookup on
- * dct_dc_size_luminance.
- *
- * Results:
- * The decoded value for dct_dc_size_luminance or ERROR for
- * unbound values will be placed in the location specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-void
-decodeDCTDCSizeLum(unsigned int *value)
-{
- unsigned int index;
-
- show_bits7(index);
-
- *value = dct_dc_size_luminance[index].value;
-
- flush_bits(dct_dc_size_luminance[index].num_bits);
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * DecodeDCTDCSizeChrom --
- *
- * Huffman Decoder for dct_dc_size_chrominance; location where
- * the result of decoding will be placed is passed as argument.
- * The decoded values are obtained by doing a table lookup on
- * dct_dc_size_chrominance.
- *
- * Results:
- * The decoded value for dct_dc_size_chrominance or ERROR for
- * unbound values will be placed in the location specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-void
-decodeDCTDCSizeChrom(unsigned int *value)
-{
- unsigned int index;
-
- show_bits8(index);
-
- *value = dct_dc_size_chrominance[index].value;
-
- flush_bits(dct_dc_size_chrominance[index].num_bits);
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * decodeDCTCoeff --
- *
- * Huffman Decoder for dct_coeff_first and dct_coeff_next;
- * locations where the results of decoding: run and level, are to
- * be placed and also the type of DCT coefficients, either
- * dct_coeff_first or dct_coeff_next, are being passed as argument.
- *
- * The decoder first examines the next 8 bits in the input stream,
- * and perform according to the following cases:
- *
- * '0000 0000' - examine 8 more bits (i.e. 16 bits total) and
- * perform a table lookup on dct_coeff_tbl_0.
- * One more bit is then examined to determine the sign
- * of level.
- *
- * '0000 0001' - examine 4 more bits (i.e. 12 bits total) and
- * perform a table lookup on dct_coeff_tbl_1.
- * One more bit is then examined to determine the sign
- * of level.
- *
- * '0000 0010' - examine 2 more bits (i.e. 10 bits total) and
- * perform a table lookup on dct_coeff_tbl_2.
- * One more bit is then examined to determine the sign
- * of level.
- *
- * '0000 0011' - examine 2 more bits (i.e. 10 bits total) and
- * perform a table lookup on dct_coeff_tbl_3.
- * One more bit is then examined to determine the sign
- * of level.
- *
- * otherwise - perform a table lookup on dct_coeff_tbl. If the
- * value of run is not ESCAPE, extract one more bit
- * to determine the sign of level; otherwise 6 more
- * bits will be extracted to obtain the actual value
- * of run , and then 8 or 16 bits to get the value of level.
- *
- *
- *
- * Results:
- * The decoded values of run and level or ERROR for unbound values
- * are placed in the locations specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-static void
-decodeDCTCoeff(unsigned short int *dct_coeff_tbl, unsigned int *run, int *level)
-{
- unsigned int temp, index, num_bits;
- unsigned int value, next32bits, flushed;
-
- /*
- * Grab the next 32 bits and use it to improve performance of
- * getting the bits to parse. Thus, calls are translated as:
- *
- * show_bitsX <--> next32bits >> (32-X)
- * get_bitsX <--> val = next32bits >> (32-flushed-X);
- * flushed += X;
- * next32bits &= bitMask[flushed];
- * flush_bitsX <--> flushed += X;
- * next32bits &= bitMask[flushed];
- *
- */
- show_bits32(next32bits);
- flushed = 0;
-
- /* show_bits8(index); */
- index = next32bits >> 24;
-
- if (index > 3) {
- value = dct_coeff_tbl[index];
- *run = (value & RUN_MASK) >> RUN_SHIFT;
- if (*run == END_OF_BLOCK) {
- *level = END_OF_BLOCK;
- }
- else {
- /* num_bits = (value & NUM_MASK) + 1; */
- /* flush_bits(num_bits); */
- flushed = (value & NUM_MASK) + 1;
- next32bits &= bitMask[flushed];
- if (*run != ESCAPE) {
- *level = (value & LEVEL_MASK) >> LEVEL_SHIFT;
- /* get_bits1(value); */
- /* if (value) *level = -*level; */
- if (next32bits >> (31-flushed)) *level = -*level;
- flushed++;
- /* next32bits &= bitMask[flushed]; last op before update */
- }
- else { /* *run == ESCAPE */
- /* get_bits14(temp); */
- temp = next32bits >> (18-flushed);
- flushed += 14;
- next32bits &= bitMask[flushed];
- *run = temp >> 8;
- temp &= 0xff;
- if (temp == 0) {
- /* get_bits8(*level); */
- *level = next32bits >> (24-flushed);
- flushed += 8;
- /* next32bits &= bitMask[flushed]; last op before update */
- assert(*level >= 128);
- } else if (temp != 128) {
- /* Grab sign bit */
- *level = ((int) (temp << 24)) >> 24;
- } else {
- /* get_bits8(*level); */
- *level = next32bits >> (24-flushed);
- flushed += 8;
- /* next32bits &= bitMask[flushed]; last op before update */
- *level = *level - 256;
- assert(*level <= -128 && *level >= -255);
- }
- }
- /* Update bitstream... */
- flush_bits(flushed);
- }
- }
- else {
- if (index == 2) {
- /* show_bits10(index); */
- index = next32bits >> 22;
- value = dct_coeff_tbl_2[index & 3];
- }
- else if (index == 3) {
- /* show_bits10(index); */
- index = next32bits >> 22;
- value = dct_coeff_tbl_3[index & 3];
- }
- else if (index) { /* index == 1 */
- /* show_bits12(index); */
- index = next32bits >> 20;
- value = dct_coeff_tbl_1[index & 15];
- }
- else { /* index == 0 */
- /* show_bits16(index); */
- index = next32bits >> 16;
- value = dct_coeff_tbl_0[index & 255];
- }
- *run = (value & RUN_MASK) >> RUN_SHIFT;
- *level = (value & LEVEL_MASK) >> LEVEL_SHIFT;
-
- /*
- * Fold these operations together to make it fast...
- */
- /* num_bits = (value & NUM_MASK) + 1; */
- /* flush_bits(num_bits); */
- /* get_bits1(value); */
- /* if (value) *level = -*level; */
-
- flushed = (value & NUM_MASK) + 2;
- if ((next32bits >> (32-flushed)) & 0x1) *level = -*level;
-
- /* Update bitstream ... */
- flush_bits(flushed);
- }
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * decodeDCTCoeffFirst --
- *
- * Huffman Decoder for dct_coeff_first. Locations for the
- * decoded results: run and level, are being passed as
- * arguments. Actual work is being done by calling DecodeDCTCoeff,
- * with the table dct_coeff_first.
- *
- * Results:
- * The decoded values of run and level for dct_coeff_first or
- * ERROR for unbound values are placed in the locations given.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-void
-decodeDCTCoeffFirst(unsigned int *run, int *level)
-{
- decodeDCTCoeff(dct_coeff_first, run, level);
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * decodeDCTCoeffNext --
- *
- * Huffman Decoder for dct_coeff_first. Locations for the
- * decoded results: run and level, are being passed as
- * arguments. Actual work is being done by calling DecodeDCTCoeff,
- * with the table dct_coeff_next.
- *
- * Results:
- * The decoded values of run and level for dct_coeff_next or
- * ERROR for unbound values are placed in the locations given.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-void
-decodeDCTCoeffNext(unsigned int *run, int *level)
-{
- decodeDCTCoeff(dct_coeff_next, run, level);
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h
deleted file mode 100644
index da6f73bca54..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h
+++ /dev/null
@@ -1,480 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-/*
- * decoders.h
- *
- * This file contains the declarations of structures required for Huffman
- * decoding
- *
- */
-
-/* Include util.h for bit i/o parsing macros. */
-
-#include "util.h"
-#include "ace/OS.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-/* Code for unbound values in decoding tables */
-#define ERROR -1
-#define DCT_ERROR 63
-
-#define MACRO_BLOCK_STUFFING 34
-#define MACRO_BLOCK_ESCAPE 35
-
-/* Two types of DCT Coefficients */
-#define DCT_COEFF_FIRST 0
-#define DCT_COEFF_NEXT 1
-
-/* Special values for DCT Coefficients */
-#define END_OF_BLOCK 62
-#define ESCAPE 61
-
-/* Structure for an entry in the decoding table of
- * macroblock_address_increment */
-typedef struct {
- unsigned int value; /* value for macroblock_address_increment */
- int num_bits; /* length of the Huffman code */
-} mb_addr_inc_entry;
-
-/* Decoding table for macroblock_address_increment */
-extern mb_addr_inc_entry mb_addr_inc[2048];
-
-
-/* Structure for an entry in the decoding table of macroblock_type */
-typedef struct {
- unsigned int mb_quant; /* macroblock_quant */
- unsigned int mb_motion_forward; /* macroblock_motion_forward */
- unsigned int mb_motion_backward; /* macroblock_motion_backward */
- unsigned int mb_pattern; /* macroblock_pattern */
- unsigned int mb_intra; /* macroblock_intra */
- int num_bits; /* length of the Huffman code */
-} mb_type_entry;
-
-/* Decoding table for macroblock_type in predictive-coded pictures */
-extern mb_type_entry mb_type_P[64];
-
-/* Decoding table for macroblock_type in bidirectionally-coded pictures */
-extern mb_type_entry mb_type_B[64];
-
-
-/* Structures for an entry in the decoding table of coded_block_pattern */
-typedef struct {
- unsigned int cbp; /* coded_block_pattern */
- int num_bits; /* length of the Huffman code */
-} coded_block_pattern_entry;
-
-/* External declaration of coded block pattern table. */
-
-extern coded_block_pattern_entry coded_block_pattern[512];
-
-
-
-/* Structure for an entry in the decoding table of motion vectors */
-typedef struct {
- int code; /* value for motion_horizontal_forward_code,
- * motion_vertical_forward_code,
- * motion_horizontal_backward_code, or
- * motion_vertical_backward_code.
- */
- int num_bits; /* length of the Huffman code */
-} motion_vectors_entry;
-
-
-/* Decoding table for motion vectors */
-extern motion_vectors_entry motion_vectors[2048];
-
-
-/* Structure for an entry in the decoding table of dct_dc_size */
-typedef struct {
- unsigned int value; /* value of dct_dc_size (luminance or chrominance) */
- int num_bits; /* length of the Huffman code */
-} dct_dc_size_entry;
-
-/* External declaration of dct dc size lumiance table. */
-
-extern dct_dc_size_entry dct_dc_size_luminance[128];
-
-/* External declaration of dct dc size chrom table. */
-
-extern dct_dc_size_entry dct_dc_size_chrominance[256];
-
-
-/* DCT coeff tables. */
-
-#define RUN_MASK 0xfc00
-#define LEVEL_MASK 0x03f0
-#define NUM_MASK 0x000f
-#define RUN_SHIFT 10
-#define LEVEL_SHIFT 4
-
-/* External declaration of dct coeff tables. */
-
-extern unsigned short int dct_coeff_tbl_0[256];
-extern unsigned short int dct_coeff_tbl_1[16];
-extern unsigned short int dct_coeff_tbl_2[4];
-extern unsigned short int dct_coeff_tbl_3[4];
-extern unsigned short int dct_coeff_next[256];
-extern unsigned short int dct_coeff_first[256];
-
-#define DecodeDCTDCSizeLum(macro_val) \
-{ \
- unsigned int index; \
- \
- show_bits7(index); \
- \
- macro_val = dct_dc_size_luminance[index].value; \
- \
- flush_bits(dct_dc_size_luminance[index].num_bits); \
-}
-
-#define DecodeDCTDCSizeChrom(macro_val) \
-{ \
- unsigned int index; \
- \
- show_bits8(index); \
- \
- macro_val = dct_dc_size_chrominance[index].value; \
- \
- flush_bits(dct_dc_size_chrominance[index].num_bits); \
-}
-
-#define DecodeDCTCoeff(dct_coeff_tbl, run, level) \
-{ \
- unsigned int temp, index; \
- unsigned int value, next32bits, flushed; \
- \
- /* \
- * Grab the next 32 bits and use it to improve performance of \
- * getting the bits to parse. Thus, calls are translated as: \
- * \
- * show_bitsX <--> next32bits >> (32-X) \
- * get_bitsX <--> val = next32bits >> (32-flushed-X); \
- * flushed += X; \
- * next32bits &= bitMask[flushed]; \
- * flush_bitsX <--> flushed += X; \
- * next32bits &= bitMask[flushed]; \
- * \
- * I've streamlined the code a lot, so that we don't have to mask \
- * out the low order bits and a few of the extra adds are removed. \
- */ \
- show_bits32(next32bits); \
- \
- /* show_bits8(index); */ \
- index = next32bits >> 24; \
- \
- if (index > 3) { \
- value = dct_coeff_tbl[index]; \
- run = value >> RUN_SHIFT; \
- if (run != END_OF_BLOCK) { \
- /* num_bits = (value & NUM_MASK) + 1; */ \
- /* flush_bits(num_bits); */ \
- if (run != ESCAPE) { \
- /* get_bits1(value); */ \
- /* if (value) level = -level; */ \
- flushed = (value & NUM_MASK) + 2; \
- level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \
- value = next32bits >> (32-flushed); \
- value &= 0x1; \
- if (value) level = -level; \
- /* next32bits &= ((~0) >> flushed); last op before update */ \
- } \
- else { /* run == ESCAPE */ \
- /* Get the next six into run, and next 8 into temp */ \
- /* get_bits14(temp); */ \
- flushed = (value & NUM_MASK) + 1; \
- temp = next32bits >> (18-flushed); \
- /* Normally, we'd ad 14 to flushed, but I've saved a few \
- * instr by moving the add below */ \
- temp &= 0x3fff; \
- run = temp >> 8; \
- temp &= 0xff; \
- if (temp == 0) { \
- /* get_bits8(level); */ \
- level = next32bits >> (10-flushed); \
- level &= 0xff; \
- flushed += 22; \
- assert(level >= 128); \
- } else if (temp != 128) { \
- /* Grab sign bit */ \
- flushed += 14; \
- level = ((int) (temp << 24)) >> 24; \
- } else { \
- /* get_bits8(level); */ \
- level = next32bits >> (10-flushed); \
- level &= 0xff; \
- flushed += 22; \
- level = level - 256; \
- assert(level <= -128 && level >= -255); \
- } \
- } \
- /* Update bitstream... */ \
- flush_bits(flushed); \
- assert (flushed <= 32); \
- } \
- } \
- else { \
- if (index == 2) { \
- /* show_bits10(index); */ \
- index = next32bits >> 22; \
- value = dct_coeff_tbl_2[index & 3]; \
- } \
- else if (index == 3) { \
- /* show_bits10(index); */ \
- index = next32bits >> 22; \
- value = dct_coeff_tbl_3[index & 3]; \
- } \
- else if (index) { /* index == 1 */ \
- /* show_bits12(index); */ \
- index = next32bits >> 20; \
- value = dct_coeff_tbl_1[index & 15]; \
- } \
- else { /* index == 0 */ \
- /* show_bits16(index); */ \
- index = next32bits >> 16; \
- value = dct_coeff_tbl_0[index & 255]; \
- } \
- run = value >> RUN_SHIFT; \
- level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \
- \
- /* \
- * Fold these operations together to make it fast... \
- */ \
- /* num_bits = (value & NUM_MASK) + 1; */ \
- /* flush_bits(num_bits); */ \
- /* get_bits1(value); */ \
- /* if (value) level = -level; */ \
- \
- flushed = (value & NUM_MASK) + 2; \
- value = next32bits >> (32-flushed); \
- value &= 0x1; \
- if (value) level = -level; \
- \
- /* Update bitstream ... */ \
- flush_bits(flushed); \
- assert (flushed <= 32); \
- } \
-}
-
-#define DecodeDCTCoeffFirst(runval, levelval) \
-{ \
- DecodeDCTCoeff(dct_coeff_first, runval, levelval); \
-}
-
-#define DecodeDCTCoeffNext(runval, levelval) \
-{ \
- DecodeDCTCoeff(dct_coeff_next, runval, levelval); \
-}
-
-/*
- *--------------------------------------------------------------
- *
- * DecodeMBAddrInc --
- *
- * Huffman Decoder for macro_block_address_increment; the location
- * in which the result will be placed is being passed as argument.
- * The decoded value is obtained by doing a table lookup on
- * mb_addr_inc.
- *
- * Results:
- * The decoded value for macro_block_address_increment or ERROR
- * for unbound values will be placed in the location specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-#define DecodeMBAddrInc(val) \
-{ \
- unsigned int index; \
- show_bits11(index); \
- val = mb_addr_inc[index].value; \
- flush_bits(mb_addr_inc[index].num_bits); \
-}
-
-/*
- *--------------------------------------------------------------
- *
- * DecodeMotionVectors --
- *
- * Huffman Decoder for the various motion vectors, including
- * motion_horizontal_forward_code, motion_vertical_forward_code,
- * motion_horizontal_backward_code, motion_vertical_backward_code.
- * Location where the decoded result will be placed is being passed
- * as argument. The decoded values are obtained by doing a table
- * lookup on motion_vectors.
- *
- * Results:
- * The decoded value for the motion vector or ERROR for unbound
- * values will be placed in the location specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-#define DecodeMotionVectors(value) \
-{ \
- unsigned int index; \
- show_bits11(index); \
- value = motion_vectors[index].code; \
- flush_bits(motion_vectors[index].num_bits); \
-}
-/*
- *--------------------------------------------------------------
- *
- * DecodeMBTypeB --
- *
- * Huffman Decoder for macro_block_type in bidirectionally-coded
- * pictures;locations in which the decoded results: macroblock_quant,
- * macroblock_motion_forward, macro_block_motion_backward,
- * macroblock_pattern, macro_block_intra, will be placed are
- * being passed as argument. The decoded values are obtained by
- * doing a table lookup on mb_type_B.
- *
- * Results:
- * The various decoded values for macro_block_type in
- * bidirectionally-coded pictures or ERROR for unbound values will
- * be placed in the locations specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-#define DecodeMBTypeB(quant, motion_fwd, motion_bwd, pat, intra) \
-{ \
- unsigned int index; \
- \
- show_bits6(index); \
- \
- quant = mb_type_B[index].mb_quant; \
- motion_fwd = mb_type_B[index].mb_motion_forward; \
- motion_bwd = mb_type_B[index].mb_motion_backward; \
- pat = mb_type_B[index].mb_pattern; \
- intra = mb_type_B[index].mb_intra; \
- flush_bits(mb_type_B[index].num_bits); \
-}
-/*
- *--------------------------------------------------------------
- *
- * DecodeMBTypeI --
- *
- * Huffman Decoder for macro_block_type in intra-coded pictures;
- * locations in which the decoded results: macroblock_quant,
- * macroblock_motion_forward, macro_block_motion_backward,
- * macroblock_pattern, macro_block_intra, will be placed are
- * being passed as argument.
- *
- * Results:
- * The various decoded values for macro_block_type in intra-coded
- * pictures or ERROR for unbound values will be placed in the
- * locations specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-#define DecodeMBTypeI(quant, motion_fwd, motion_bwd, pat, intra) \
-{ \
- unsigned int index; \
- static int quantTbl[4] = {ERROR, 1, 0, 0}; \
- \
- show_bits2(index); \
- \
- motion_fwd = 0; \
- motion_bwd = 0; \
- pat = 0; \
- intra = 1; \
- quant = quantTbl[index]; \
- if (index) { \
- flush_bits (1 + quant); \
- } \
-}
-/*
- *--------------------------------------------------------------
- *
- * DecodeMBTypeP --
- *
- * Huffman Decoder for macro_block_type in predictive-coded pictures;
- * locations in which the decoded results: macroblock_quant,
- * macroblock_motion_forward, macro_block_motion_backward,
- * macroblock_pattern, macro_block_intra, will be placed are
- * being passed as argument. The decoded values are obtained by
- * doing a table lookup on mb_type_P.
- *
- * Results:
- * The various decoded values for macro_block_type in
- * predictive-coded pictures or ERROR for unbound values will be
- * placed in the locations specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-#define DecodeMBTypeP(quant, motion_fwd, motion_bwd, pat, intra) \
-{ \
- unsigned int index; \
- \
- show_bits6(index); \
- \
- quant = mb_type_P[index].mb_quant; \
- motion_fwd = mb_type_P[index].mb_motion_forward; \
- motion_bwd = mb_type_P[index].mb_motion_backward; \
- pat = mb_type_P[index].mb_pattern; \
- intra = mb_type_P[index].mb_intra; \
- \
- flush_bits(mb_type_P[index].num_bits); \
-}
-/*
- *--------------------------------------------------------------
- *
- * DecodeCBP --
- *
- * Huffman Decoder for coded_block_pattern; location in which the
- * decoded result will be placed is being passed as argument. The
- * decoded values are obtained by doing a table lookup on
- * coded_block_pattern.
- *
- * Results:
- * The decoded value for coded_block_pattern or ERROR for unbound
- * values will be placed in the location specified.
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-#define DecodeCBP(coded_bp) \
-{ \
- unsigned int index; \
- \
- show_bits9(index); \
- coded_bp = coded_block_pattern[index].cbp; \
- flush_bits(coded_block_pattern[index].num_bits); \
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h
deleted file mode 100644
index 51320095ed5..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-extern int LUM_RANGE;
-extern int CR_RANGE;
-extern int CB_RANGE;
-
-
-#define CB_BASE 1
-#define CR_BASE (CB_BASE*CB_RANGE)
-#define LUM_BASE (CR_BASE*CR_RANGE)
-
-extern unsigned char pixel[256];
-extern int *lum_values;
-extern int *cr_values;
-extern int *cb_values;
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp
deleted file mode 100644
index 7caa4bb8621..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "video.h"
-#include <X11/Intrinsic.h>
-#include <Xm/Xm.h>
-#include <Xm/Text.h>
-#include <Xm/FileSB.h>
-#include <Xm/DialogS.h>
-#if defined(sun) || defined(FreeBSD)
-#include <stdlib.h>
-#endif
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-
-ACE_RCSID(mpeg_client, file, "$Id$")
-
-#ifdef XmFONTLIST_DEFAULT_TAG
-#define XmStringTag XmFONTLIST_DEFAULT_TAG
-#else
-#define XmStringTag XmSTRING_DEFAULT_CHARSET
-#endif
-#define BUFSIZE 256
-
-static Widget fileshell;
-
-void StartLocalServer(void)
-{
- int res;
-
- static int startLocalServer = 1;
-
- if (startLocalServer) {
- startLocalServer = 0;
- if (access(VCR_UNIX_PORT, 0) == -1) { /* going to start a server */
- fprintf(stderr, "Trying to fork a server on local host...\n");
- res = system("vcrs -rt 2> /dev/null& exit");
- if (shared->config.verbose && res == -1) {
- perror("Error on fork server on local host");
- }
- usleep(1000000);
- }
- }
-}
-
-/* hostname == "" defaults to local host */
-static void StartFile(char *hostname, char *filename)
-{
- char *title = (char *)ACE_OS::malloc(strlen(hostname) +ACE_OS::strlen (filename) + 10);
- char buf[BUFSIZE];
- int len;
-
- if (*hostname == 0) StartLocalServer();
-
- if (*hostname == 0) {
- get_full_path(filename, buf, BUFSIZE);
- }
- else {
- strncpy(buf, filename, BUFSIZE);
- buf[BUFSIZE-1] = 0;
- }
- len =ACE_OS::strlen (buf);
-
- if (title == NULL) title = filename;
- else sprintf(title, "%s:%s", hostname, filename);
-
- if (!strcasecmp(".mpg", buf+len-4) || !strcasecmp(".mpeg", buf+len-5))
- StartProgram(title, hostname, buf, "", "");
- else if (!strcasecmp(".au", buf+len-3))
- StartProgram(title, "", "", hostname, buf);
- else
- fprintf(stderr, "Error: type of file %s not known (know only .mpeg .mpg, .au).\n",
- filename);
- if (title != filename) ACE_OS::free (title);
-}
-
-static void dismissCB(Widget W, XtPointer closure, XtPointer call_data)
-{
-
- XtUnmanageChild (fileshell);
-}
-
-static void playCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- char *filename = NULL; /* String containing file name */
- XmStringCharSet charset = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET;
- XmFileSelectionBoxCallbackStruct *fcb =
- (XmFileSelectionBoxCallbackStruct *) call_data;
-
- XmStringGetLtoR(fcb->value, charset, &filename);
-
- if (filename == NULL)
- {
- fprintf(stderr, "Error: failed to get file name to play.\n");
- return;
- }
- StartFile("", filename);
- XmStringFree((XmString)filename);
-}
-
-Widget CreateFileWindow(Widget parent, int cmdSock, int * playflag, Widget frametext)
-{
- Arg args[10]; /* arg list */
- register int n; /* arg count */
- XmString okString, cancelString;
-
-/* Create the file selection box */
- okString = (XmString)XmStringCreateLtoR("Select", XmStringTag);
- cancelString = (XmString)XmStringCreateLtoR("Dismiss", XmStringTag);
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual VCR File Selection"); n++;
- XtSetArg(args[n], XmNokLabelString, okString); n++;
- XtSetArg(args[n], XmNcancelLabelString, cancelString); n++;
- fileshell = XmCreateFileSelectionDialog(parent, "filebox", args, n);
- XmStringFree(okString);
- XmStringFree(cancelString);
- XtAddCallback (fileshell, XmNokCallback, (XtCallbackProc)playCB, NULL);
- XtAddCallback (fileshell, XmNcancelCallback, (XtCallbackProc)dismissCB, NULL);
-
- return fileshell;
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp
deleted file mode 100644
index b5d07070aa1..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "video.h"
-#include "dither.h"
-#include "fs2.h"
-#include "proto.h"
-
-ACE_RCSID(mpeg_client, fs2, "$Id$")
-
-/* Structures for precomputed error propogation values. */
-
-static FS2DithVal lum_index[256];
-static FS2DithVal cr_index[256];
-static FS2DithVal cb_index[256];
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitFS2Dither --
- *
- * Initializes structures for precomputed 2 error f-s dithering.
- * The value field of the structure contains the pixel component
- * of the particular channel in question. Thus the addition of
- * the value field of a structure in the luminance index, a
- * structure in the Cr index, and a structure in the Cb index will
- * yeild a color number. This color number can then be transformed
- * into a pixel value to be displayed. Each channel can then be
- * processed (i.e. dithered) separately, with the results being
- * added up and remapped to yield a final pixel value.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void InitFS2Dither()
-{
- int i;
-
- /* For each possible pixel value, precompute propogated error and
- store in array.
- */
-
- for (i=0; i<256; i++) {
- lum_index[i].value = (i * LUM_RANGE) / 256;
-
- lum_index[i].e1 = (i-lum_values[lum_index[i].value]) / 2;
- lum_index[i].e3 = (i - lum_values[lum_index[i].value]) - lum_index[i].e1;
-
- lum_index[i].value *= LUM_BASE;
-
- cr_index[i].value = (i * CR_RANGE) / 256;
-
- cr_index[i].e1 = (i - cr_values[cr_index[i].value]) / 2;
- cr_index[i].e3 = (i - cr_values[cr_index[i].value]) - cr_index[i].e1 ;
-
- cr_index[i].value *= CR_BASE;
-
- cb_index[i].value = (i * CB_RANGE) / 256;
-
- cb_index[i].e1 = (i - cb_values[cb_index[i].value]) / 2;
- cb_index[i].e3 = (i - cb_values[cb_index[i].value]) - cb_index[i].e1;
-
- cb_index[i].value *= CB_BASE;
-
- }
-
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * DitherImage --
- *
- * Converts lum, cr, cb image planes into fixed colormap
- * space.
- *
- * Results:
- * the display plane is replaced by 8-bit colormap space
- * image.
- *
- * Side effects:
- * Hopefully, none.
- *
- *--------------------------------------------------------------
- */
-
-void FS2DitherImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *disp,
- int rows, int cols)
-{
- static char *cur_row_error, *next_row_error;
- static int first = 1;
- char *cur_row_err_mark, *next_row_err_mark;
- char *temp;
- int i, j, pixsum, c_cols;
- unsigned char *cur_row, *channel, *dest_row;
- FS2DithVal *chan_index;
-
- /* Allocate error arrays. */
-
- if (first) {
- cur_row_error = (char *) ACE_OS::malloc(cols+2);
- next_row_error = (char *) ACE_OS::malloc(cols+2);
- first = 0;
- }
-
- /* Initialize error arrays. */
-
- memset(cur_row_error, 0, cols+2);
- memset(next_row_error, 0, cols+2);
-
- /* Use luminance values first. */
-
- /* For each two rows, do... */
-
- for(i=0; i<rows; i+=2) {
-
- /* Establish pointer to current source and destination rows. */
- cur_row = lum + (i*cols);
- dest_row = disp + (i*cols);
-
- /* Establish pointers to error arrays. */
- cur_row_err_mark = cur_row_error + 1;
- next_row_err_mark = next_row_error + 1;
-
-
- /* For each column within first row do... */
-
- for (j=0; j<cols; j++) {
-
- /* Calculate pixel value with error. */
-
- pixsum = *cur_row + *cur_row_err_mark;
-
- /* Bounds check. */
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- /* Establish dest value, propogate errors. */
-
- *dest_row = lum_index[pixsum].value;
- *(cur_row_err_mark+1) += lum_index[pixsum].e1;
- *next_row_err_mark += lum_index[pixsum].e3;
-
- /* Advance pointers. */
-
- cur_row++;
- dest_row++;
- cur_row_err_mark++;
- next_row_err_mark++;
- }
-
- /* Switch error arrays, so next row errors are now current row errors, and
- vice versa.
- */
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- /* Reset next row errors. */
-
- memset(next_row_error, 0, cols+2);
-
- /* Establish pointers for second row. This one will be processed right to
- left to establish serpantine motion.
- */
-
- cur_row += cols-1;
- dest_row += cols-1;
- cur_row_err_mark = cur_row_error + cols;
- next_row_err_mark = next_row_error + cols;
-
- /* Process each column... */
-
- for (j=0; j<cols; j++) {
-
- pixsum = *cur_row + *cur_row_err_mark;
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- *dest_row = lum_index[pixsum].value;
- *(cur_row_err_mark-1) += lum_index[pixsum].e1;
- *next_row_err_mark += lum_index[pixsum].e3;
-
- cur_row--;
- dest_row--;
- cur_row_err_mark--;
- next_row_err_mark--;
- }
-
- /* Switch error arrays. */
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- /* Reset next row errors. */
-
- memset(next_row_error, 0, cols+2);
- }
-
- /* Reset error arrays. */
-
- memset(cur_row_error, 0, cols+2);
-
- /* Establish column length divided by two. */
-
- c_cols = cols >> 1;
-
- /* Set channel to Cr. Use Cr index. */
-
- channel = cr;
- chan_index = cr_index;
-
- repeat:
-
- /* Process each row of chrominance data... */
-
- for (i=0; i < rows; i+=2) {
-
- /* Establish pointers. */
-
- cur_row = channel + ((i>>1)*c_cols);
- dest_row = disp + (i*cols);
-
- cur_row_err_mark = cur_row_error+1;
- next_row_err_mark = next_row_error+1;
-
- /* For each column in row... */
-
- for (j=0; j<cols; j++) {
- int p_val;
-
- /* Get pixel value as twos bit complement. */
-
- p_val = *cur_row;
-
- /* Add error term. */
-
- pixsum = *cur_row_err_mark + p_val;
-
- /* Bounds check. */
-
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- /* Increment dest value. */
-
- *dest_row += chan_index[pixsum].value;
-
- /* Propogate error values. */
-
- *(cur_row_err_mark+1) += chan_index[pixsum].e1;
- *next_row_err_mark += chan_index[pixsum].e3;
-
-
- /* If count is odd, advance source pointer (Cr and Cb channels are 2:1
- subsampled.
- */
-
- if (j&1) cur_row++;
-
- /* Advance destination and error pointers. */
-
- dest_row++;
- cur_row_err_mark++;
- next_row_err_mark++;
- }
-
- /* Switch error arrays. */
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- /* Reset next row errors. */
-
- memset(next_row_error, 0, cols+2);
-
- /* Re-establish pointers. */
-
- cur_row += c_cols-1;
- dest_row += cols-1;
- cur_row_err_mark = cur_row_error+cols;
- next_row_err_mark = next_row_error+cols;
-
- /* Process second row right to left. */
-
- for (j=0; j<cols; j++) {
- int p_val;
-
- /* Get source value as twos bit complement. */
-
- p_val = *cur_row;
-
- /* Add error. */
-
- pixsum = *cur_row_err_mark + p_val;
-
- /* Bounds check. */
-
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- /* Increment dest value. */
-
- *dest_row += chan_index[pixsum].value;
-
- /* Propogate errors. */
-
- *(cur_row_err_mark-1) += chan_index[pixsum].e1;
- *next_row_err_mark += chan_index[pixsum].e3;
-
- /* If column counters is odd, decrement source pointer. */
-
- if (j&1) cur_row--;
-
- /* Decrement dest and error pointers. */
-
- dest_row--;
- cur_row_err_mark--;
- next_row_err_mark--;
- }
-
- /* Switch error arrays. */
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- /* Reinitialize next row errors. */
-
- memset(next_row_error, 0, cols+2);
- }
-
- /* If Cr channel completed, set channel to Cb and Cb index and repeat. */
-
- if (channel == cr) {
- channel = cb;
- chan_index = cb_index;
- memset(cur_row_error, 0, cols+2);
-
- goto repeat;
- }
-
- /* Establish pointer to start of display frame. */
-
- dest_row = disp;
-
- /* Transform all display values to pixel values. */
-
- for (i=0; i<rows; i++) {
- for (j=0; j<cols; j++) {
- *dest_row = pixel[*dest_row];
- dest_row++;
- }
- }
-}
-
-
-
-
-
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h
deleted file mode 100644
index 21991215259..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-#include "ace/OS.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-typedef struct {
- unsigned char value;
- int e1;
- int e3;
-} FS2DithVal;
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp
deleted file mode 100644
index f5eb87c236f..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, fs2fast, "$Id$")
-
-/* Arrays containing error values for floyd-steinberg dithering. */
-
-static int deltay[256];
-static int deltau[256];
-static int deltav[256];
-static int deltay2[256];
-static int deltau2[256];
-static int deltav2[256];
-
-/* Definitions governing number of bits used for luminance, cr, and cb. */
-
-#define L_BITS 3
-#define CR_BITS 2
-#define CB_BITS 2
-
-/* Masks for proper quantization of lum, cr, and cb values. */
-
-#define L_MASK 0xe0
-#define CR_MASK 0xc0
-#define CB_MASK 0xc0
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitFS2FastDither --
- *
- * Initializes structures and arrays neeeded for fast implementation
- * of two error F-S dithering.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void InitFS2FastDither()
-{
- int i;
- int lum_num, cr_num, cb_num;
-
- for (i=0; i<256; i++) {
- lum_num = (i >> (8-L_BITS));
- cr_num = (i >> (8-CR_BITS));
- cb_num = (i >> (8-CB_BITS));
-
- /* These arrays contain the error values propogated for each pixel value
- for each channel.
- */
-
- deltay[i] = (i - ((int) lum_values[lum_num])) / 2;
- deltau[i] = (i-((int) cr_values[cr_num])) / 2;
- deltav[i] = (i-((int) cb_values[cb_num])) / 2;
- deltay2[i] = (i - ((int) lum_values[lum_num])) - deltay[i];
- deltau2[i] = (i - ((int) cr_values[cr_num])) - deltau[i];
- deltav2[i] = (i - ((int) cb_values[cb_num])) - deltav[i];
-
- }
-
-}
-
-/*
- *--------------------------------------------------------------
- *
- * DitherImage --
- *
- * Dithers an image using floyd-steinberg.
- * Assumptions made:
- * 1) The color space is allocated y:cr:cb = 8:4:4
- * 2) The spatial resolution of y:cr:cb is 4:1:1
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-FS2FastDitherImage (
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- unsigned char *out,
- int w, int h)
-{
- int i, j, idx, idx2;
- int y, u, v;
- int dy, du, dv;
- int code;
- static int *yerr1;
- static int *yerr2;
- static int *uerr1;
- static int *uerr2;
- static int *verr1;
- static int *verr2;
- int *ye1, *ue1, *ve1;
- int *ye2, *ue2, *ve2;
- unsigned char *o, *l, *r, *b;
- static int first = 1;
-
- /* If first time called, allocate error arrays. */
-
- if (first) {
- first = 0;
- yerr1 = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- yerr2 = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- uerr1 = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- uerr2 = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- verr1 = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- verr2 = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- }
-
- /*
- * Init error arrays and variables.
- */
- memset ((char *)yerr1, 0, (w+5)*sizeof(int));
- memset ((char *)yerr2, 0, (w+5)*sizeof(int));
- memset ((char *)uerr1, 0, (w+5)*sizeof(int));
- memset ((char *)uerr2, 0, (w+5)*sizeof(int));
- memset ((char *)verr1, 0, (w+5)*sizeof(int));
- memset ((char *)verr2, 0, (w+5)*sizeof(int));
- du = dv = dy = 0;
-
- for (j=0; j<h; j+=2) {
- ye1 = yerr1;
- ue1 = uerr1;
- ve1 = verr1;
- ye2 = yerr2;
- ue2 = uerr2;
- ve2 = verr2;
- idx = j*w;
- idx2 = idx/4;
- o = out+idx;
- l = lum+idx;
- r = cr+idx2;
- b = cb+idx2;
- /* Do the top row in forward order. */
- for (i=0; i<w; i+=2) {
- /* Do left side of this pair... */
- y = *l++ + dy + *ye1++;
- u = *r + du + *ue1++;
- v = *b + dv + *ve1++;
-
- if (y < 0) y = 0;
- else if (y > 255) y = 255;
- if (u < 0) u = 0;
- else if (u > 255) u = 255;
- if (v < 0) v = 0;
- else if (v > 255) v = 255;
-
- /*
- * Construct a code using:
- * high order 3 bits of y,
- * high order 2 bits of u,
- * high order 2 bits of v
- */
- code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS)))
- >> (8-(L_BITS+CR_BITS+CB_BITS)));
- *o++ = pixel[code];
- *ye2++ = deltay[y];
- *ue2++ = deltau[u];
- *ve2++ = deltav[v];
- dy = deltay2[y];
- du = deltau2[u];
- dv = deltav2[v];
-
- /* Do right side of this pair... */
- y = *l++ + dy + *ye1++;
- u = *r++ + du + *ue1++;
- v = *b++ + dv + *ve1++;
-
- if (y < 0) y = 0;
- else if (y > 255) y = 255;
- if (u < 0) u = 0;
- else if (u > 255) u = 255;
- if (v < 0) v = 0;
- else if (v > 255) v = 255;
-
- code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS)))
- >> (8-(L_BITS+CR_BITS+CB_BITS)));
- *o++ = pixel[code];
- *ye2++ = deltay[y];
- *ue2++ = deltau[u];
- *ve2++ = deltav[v];
- dy = deltay2[y];
- du = deltau2[u];
- dv = deltav2[v];
-
- }
-
- ye1 = yerr1+w-1;
- ue1 = uerr1+w-1;
- ve1 = verr1+w-1;
- ye2 = yerr2+w-1;
- ue2 = uerr2+w-1;
- ve2 = verr2+w-1;
- l += w-1;
- o += w-1;
- r--;
- b--;
- dy = du = dv = 0;
-
- /* Do bottom part of row, in right to left order. */
- for (i=w-1; i>0; i-=2) {
- /* Do right side of this pair... */
- y = *l-- + dy + *ye2--;
- u = *r + du + *ue2--;
- v = *b + dv + *ve2--;
-
- if (y < 0) y = 0;
- else if (y > 255) y = 255;
- if (u < 0) u = 0;
- else if (u > 255) u = 255;
- if (v < 0) v = 0;
- else if (v > 255) v = 255;
-
- /*
- * Construct a code using:
- * high order 3 bits of y,
- * high order 2 bits of u,
- * high order 2 bits of v
- */
- code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS)))
- >> (8-(L_BITS+CR_BITS+CB_BITS)));
- *o-- = pixel[code];
- *ye1-- = deltay[y];
- *ue1-- = deltau[u];
- *ve1-- = deltav[v];
- dy = deltay2[y];
- du = deltau2[u];
- dv = deltav2[v];
-
- /* Do left side of this pair... */
- y = *l-- + dy + *ye2--;
- u = *r-- + du + *ue2--;
- v = *b-- + dv + *ve2--;
-
- if (y < 0) y = 0;
- else if (y > 255) y = 255;
- if (u < 0) u = 0;
- else if (u > 255) u = 255;
- if (v < 0) v = 0;
- else if (v > 255) v = 255;
-
- code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS)))
- >> (8-(L_BITS+CR_BITS+CB_BITS)));
- *o-- = pixel[code];
- *ye1-- = deltay[y];
- *ue1-- = deltau[u];
- *ve1-- = deltav[v];
- dy = deltay2[y];
- du = deltau2[u];
- dv = deltav2[v];
-
- }
- }
-}
-
-
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp
deleted file mode 100644
index 79174685246..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* This file contains C code to do YCrCb -> colormap space. */
-
-#include <stdlib.h>
-#include <string.h>
-#include "fs4.h"
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-
-ACE_RCSID(mpeg_client, fs4, "$Id$")
-
-/* Structures containing precomputed error terms. */
-
-static FS4Dither lum_index[256];
-static FS4Dither cr_index[256];
-static FS4Dither cb_index[256];
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitFS4Dither --
- *
- * Initializes structures used for f-s dithering. Precomputes
- * error terms.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitFS4Dither()
-{
- int i;
-
- for (i=0; i<256; i++) {
- lum_index[i].value = (i * LUM_RANGE) / 256;
-
- lum_index[i].e1 = (7 * (i-lum_values[lum_index[i].value])) / 16;
- lum_index[i].e2 = (i-lum_values[lum_index[i].value])/16;
- lum_index[i].e3 = (5 * (i - lum_values[lum_index[i].value])) / 16;
- lum_index[i].e4 = (i-lum_values[lum_index[i].value]) - lum_index[i].e1 -
- lum_index[i].e2 - lum_index[i].e3;
-
- lum_index[i].value *= LUM_BASE;
-
- cr_index[i].value = (i * CR_RANGE) / 256;
-
- cr_index[i].e1 = (7 * (i-cr_values[cr_index[i].value])) / 16;
- cr_index[i].e2 = (i-cr_values[cr_index[i].value])/16;
- cr_index[i].e3 = (5 * (i - cr_values[cr_index[i].value])) / 16;
- cr_index[i].e4 = (i-cr_values[cr_index[i].value]) - cr_index[i].e1 -
- cr_index[i].e2 - cr_index[i].e3;
- cr_index[i].value *= CR_BASE;
-
- cb_index[i].value = (i * CB_RANGE) / 256;
-
- cb_index[i].e1 = (7 * (i-cb_values[cb_index[i].value])) / 16;
- cb_index[i].e2 = (i-cb_values[cb_index[i].value])/16;
- cb_index[i].e3 = (5 * (i - cb_values[cb_index[i].value])) / 16;
- cb_index[i].e4 = (i-cb_values[cb_index[i].value]) - cb_index[i].e1 -
- cb_index[i].e2 - cb_index[i].e3;
- cb_index[i].value *= CB_BASE;
-
- }
-
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * DitherImage --
- *
- * Converts lum, cr, cb image planes into fixed colormap
- * space. Uses Floyd-Steinberg dithering in serpentine
- * pattern with standard 4 errors propogated.
- *
- * Results:
- * The display plane is replaced by 8-bit colormap space
- * image.
- *
- * Side effects:
- * Hopefully, none.
- *
- *--------------------------------------------------------------
- */
-
-void
-FS4DitherImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *disp,
- int rows, int cols)
-{
- static char *cur_row_error, *next_row_error;
- static int first = 1;
- char *cur_row_err_mark, *next_row_err_mark;
- char *temp;
- int i, j, pixsum, c_cols;
- unsigned char *cur_row, *channel, *dest_row;
- FS4Dither *chan_index;
-
- if (first) {
- cur_row_error = (char *) ACE_OS::malloc(cols+2);
- next_row_error = (char *) ACE_OS::malloc(cols+2);
- first = 0;
- }
-
- memset(cur_row_error, 0, cols+2);
- memset(next_row_error, 0, cols+2);
-
- for(i=0; i<rows; i+=2) {
- cur_row = lum + (i*cols);
- dest_row = disp + (i*cols);
-
- cur_row_err_mark = cur_row_error + 1;
- next_row_err_mark = next_row_error + 1;
-
- for (j=0; j<cols; j++) {
-
- pixsum = *cur_row + *cur_row_err_mark;
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- *dest_row = lum_index[pixsum].value;
- *(cur_row_err_mark+1) += lum_index[pixsum].e1;
- *(next_row_err_mark+1) += lum_index[pixsum].e2;
- *next_row_err_mark += lum_index[pixsum].e3;
- *(next_row_err_mark-1) += lum_index[pixsum].e4;
-
- cur_row++;
- dest_row++;
- cur_row_err_mark++;
- next_row_err_mark++;
- }
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- memset(next_row_error, 0, cols+2);
-
- cur_row += cols-1;
- dest_row += cols-1;
- cur_row_err_mark = cur_row_error + cols;
- next_row_err_mark = next_row_error + cols;
-
- for (j=0; j<cols; j++) {
-
- pixsum = *cur_row + *cur_row_err_mark;
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- *dest_row = lum_index[pixsum].value;
- *(cur_row_err_mark-1) += lum_index[pixsum].e1;
- *(next_row_err_mark-1) += lum_index[pixsum].e2;
- *next_row_err_mark += lum_index[pixsum].e3;
- *(next_row_err_mark+1) += lum_index[pixsum].e4;
-
- cur_row--;
- dest_row--;
- cur_row_err_mark--;
- next_row_err_mark--;
- }
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- memset(next_row_error, 0, cols+2);
- }
-
- memset(cur_row_error, 0, cols+2);
-
- c_cols = cols >> 1;
-
- channel = cr;
- chan_index = cr_index;
-
- repeat:
-
- for (i=0; i < rows; i+=2) {
- cur_row = channel + ((i>>1)*c_cols);
- dest_row = disp + (i*cols);
-
- cur_row_err_mark = cur_row_error+1;
- next_row_err_mark = next_row_error+1;
-
- for (j=0; j<cols; j++) {
- int p_val;
-
- p_val = *cur_row;
-
- pixsum = *cur_row_err_mark + p_val;
-
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- *dest_row += chan_index[pixsum].value;
-
- *(cur_row_err_mark+1) += chan_index[pixsum].e1;
- *(next_row_err_mark+1) += chan_index[pixsum].e2;
- *next_row_err_mark += chan_index[pixsum].e3;
- *(next_row_err_mark-1) += chan_index[pixsum].e4;
-
-
- if (j&1) cur_row++;
- dest_row++;
- cur_row_err_mark++;
- next_row_err_mark++;
- }
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- memset(next_row_error, 0, cols+2);
-
- cur_row += c_cols-1;
- dest_row += cols-1;
- cur_row_err_mark = cur_row_error+cols;
- next_row_err_mark = next_row_error+cols;
-
- for (j=0; j<cols; j++) {
- int p_val;
-
- p_val = *cur_row;
-
- pixsum = *cur_row_err_mark + p_val;
-
- if (pixsum < 0) pixsum = 0;
- else if (pixsum > 255) pixsum = 255;
-
- *dest_row += chan_index[pixsum].value;
-
- *(cur_row_err_mark-1) += chan_index[pixsum].e1;
- *(next_row_err_mark-1) += chan_index[pixsum].e2;
- *next_row_err_mark += chan_index[pixsum].e3;
- *(next_row_err_mark+1) += chan_index[pixsum].e4;
-
- if (j&1) cur_row--;
- dest_row--;
- cur_row_err_mark--;
- next_row_err_mark--;
- }
-
- temp = cur_row_error;
- cur_row_error = next_row_error;
- next_row_error = temp;
-
- memset(next_row_error, 0, cols+2);
- }
-
- if (channel == cr) {
- channel = cb;
- chan_index = cb_index;
- memset(cur_row_error, 0, cols+2);
-
- goto repeat;
- }
-
- dest_row = disp;
-
-
- for (i=0; i<rows; i++) {
- for (j=0; j<cols; j++) {
- *dest_row = pixel[*dest_row];
- dest_row++;
- }
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h
deleted file mode 100644
index 96a93ee1878..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-#include "ace/OS.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-typedef struct {
- unsigned char value;
- int e1;
- int e2;
- int e3;
- int e4;
-} FS4Dither;
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp
deleted file mode 100644
index d9a08f49323..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-
-#include "include/common.h"
-
-ACE_RCSID(mpeg_client, global, "$Id$")
-
-/* Declaration of global variable to hold dither info. */
-
-int ditherType;
-
-/* Global file pointer to incoming data. */
-FILE *input;
-
-/* End of File flag. */
-int EOF_flag = 0;
-
-/* Loop flag. */
-int loopFlag = 0;
-
-/* Shared memory flag. */
-int shmemFlag = 0;
-
-/* Quiet flag. */
-int quietFlag = 0;
-
-/* Display image on screen? */
-int noDisplayFlag = 0;
-
-/* real time flag */
-int realTimeFlag = 0;
-
-/* shared version of command line argument */
-int argc_share;
-char **argv_share;
-
-/* for command line display name */
-char displayName[64];
-
-/* command line program list name */
-char proglistName[PATH_SIZE] = "";
-
-/* shared data structure */
-SharedData * shared = NULL;
-
-/* Range values for lum, cr, cb. */
-int LUM_RANGE;
-int CR_RANGE;
-int CB_RANGE;
-
-/* Array that remaps color numbers to actual pixel values used by X server. */
-
-unsigned char pixel[256];
-
-/* Arrays holding quantized value ranged for lum, cr, and cb. */
-
-int *lum_values = NULL;
-int *cr_values = NULL;
-int *cb_values = NULL;
-
-/* Structures used by the X server. */
-
-Display *display;
-Colormap cmap;
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h
deleted file mode 100644
index 40bb64b0985..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $Id$ */
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-/* Declaration of global variable to hold dither info. */
-
-extern int ditherType;
-
-/* Global file pointer to incoming data. */
-extern FILE *input;
-
-/* End of File flag. */
-extern int EOF_flag;
-
-/* Loop flag. */
-extern int loopFlag;
-
-/* Shared memory flag. */
-extern int shmemFlag;
-
-/* Quiet flag. */
-extern int quietFlag;
-
-/* Display image on screen? */
-extern int noDisplayFlag;
-
-/* real time flag */
-extern int realTimeFlag;
-
-/* shared version of command line argument */
-extern int argc_share;
-extern char **argv_share;
-
-/* for command line display name */
-extern char displayName[];
-
-/* command line program list name */
-extern char proglistName[PATH_SIZE];
-
-/* shared data structure */
-extern SharedData * shared;
-
-/* Structures used by the X server. */
-
-extern Display *display;
-extern Colormap cmap;
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp
deleted file mode 100644
index 71aa8d295d5..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, gray, "$Id$")
-
-
-/*
- *--------------------------------------------------------------
- *
- * GrayDitherImage --
- *
- * Dithers image into 128 gray scales. Simply maps luminance
- * value into 1 of 128 gray scale colors (divide by two, essentially).
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-GrayDitherImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
-
- int i, max = w*h/16;
-
- for (i=0; i<max; i++) {
- out[0] = pixel[lum[0]];
- out[1] = pixel[lum[1]];
- out[2] = pixel[lum[2]];
- out[3] = pixel[lum[3]];
- out[4] = pixel[lum[4]];
- out[5] = pixel[lum[5]];
- out[6] = pixel[lum[6]];
- out[7] = pixel[lum[7]];
- out[8] = pixel[lum[8]];
- out[9] = pixel[lum[9]];
- out[10] = pixel[lum[10]];
- out[11] = pixel[lum[11]];
- out[12] = pixel[lum[12]];
- out[13] = pixel[lum[13]];
- out[14] = pixel[lum[14]];
- out[15] = pixel[lum[15]];
- out += 16;
- lum += 16;
- }
-}
-
-
-
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp
deleted file mode 100644
index 11b969be3a2..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* This file contains C code to implement an ordered dither. */
-
-#include <string.h>
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, hybrid, "$Id$")
-
-#define DITH_SIZE 16
-
-
-/* Structures used to implement hybrid ordered dither/floyd-steinberg
- dither algorithm.
-*/
-
-static unsigned char *l_darrays[DITH_SIZE];
-static unsigned char cr_fsarray[256][4];
-static unsigned char cb_fsarray[256][4];
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitHybridDither--
- *
- * Structures intialized for hybrid dithering. Ordered dither
- * patterns set for luminance channel, f-s errors precomputed
- * for chrominance channels.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitHybridDither()
-{
- int i, j, k, err_range, threshval;
- unsigned char *lmark;
-
- for (i=0; i<DITH_SIZE; i++) {
- lmark = l_darrays[i] = (unsigned char *) ACE_OS::malloc(256);
-
- for (j=0; j<lum_values[0]; j++) {
- *lmark++ = 0;
- }
-
- for (j=0; j<(LUM_RANGE-1); j++) {
- err_range = lum_values[j+1] - lum_values[j];
- threshval = ((i * err_range) / DITH_SIZE)+lum_values[j];
-
- for (k=lum_values[j]; k<lum_values[j+1]; k++) {
- if (k > threshval) *lmark++ = ((j+1) * (CR_RANGE * CB_RANGE));
- else *lmark++ = (j * (CR_RANGE * CB_RANGE));
- }
- }
-
- for (j=lum_values[LUM_RANGE-1]; j<256; j++) {
- *lmark++ = (LUM_RANGE-1)*(CR_RANGE * CB_RANGE);
- }
-
- }
- {
- int cr1, cr2, cr3, cr4, err1, err2;
- int cb1, cb2, cb3, cb4, val, nval;
-
- for (i=0; i<256; i++) {
-
- val = i;
-
- cr1 = (val * CR_RANGE) / 256;
- err1 = (val - cr_values[cr1])/2;
- err2 = (val - cr_values[cr1]) - err1;
-
- nval = val+err1;
- if (nval > 255) nval = 255;
- else if (nval < 0) nval = 0;
- cr2 = (nval * CR_RANGE) / 256;
- err1 = (nval - cr_values[cr2])/2;
-
- nval = val+err2;
- if (nval > 255) nval = 255;
- else if (nval < 0) nval = 0;
- cr3 = (nval * CR_RANGE) / 256;
- err2 = (nval - cr_values[cr3])/2;
-
- nval = val+err1+err2;
- if (nval > 255) nval = 255;
- else if (nval < 0) nval = 0;
- cr4 = (nval * CR_RANGE) / 256;
-
- cr_fsarray[i][0] = cr1*CB_RANGE;
- cr_fsarray[i][1] = cr2*CB_RANGE;
- cr_fsarray[i][2] = cr3*CB_RANGE;
- cr_fsarray[i][3] = cr4*CB_RANGE;
- }
-
- for (i=0; i<256; i++) {
-
- val = i;
-
- cb1 = (val * CB_RANGE) / 256;
- err1 = (val - cb_values[cb1])/2;
- err2 = (val - cb_values[cb1]) - err1;
-
- nval = val+err1;
- if (nval > 255) nval = 255;
- else if (nval < 0) nval = 0;
- cb2 = (nval * CB_RANGE) / 256;
- err1 = (nval - cb_values[cb2])/2;
-
- nval = val+err2;
- if (nval > 255) nval = 255;
- else if (nval < 0) nval = 0;
- cb3 = (nval * CB_RANGE) / 256;
- err2 = (nval - cb_values[cb3])/2;
-
- nval = val+err1+err2;
- if (nval > 255) nval = 255;
- else if (nval < 0) nval = 0;
- cb4 = (nval * CB_RANGE) / 256;
-
- cb_fsarray[i][0] = cb1;
- cb_fsarray[i][1] = cb2;
- cb_fsarray[i][2] = cb3;
- cb_fsarray[i][3] = cb4;
- }
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * HybridDitherImage --
- *
- * Dithers an image using an ordered dither.
- * Assumptions made:
- * 1) The color space is allocated y:cr:cb = 8:4:4
- * 2) The spatial resolution of y:cr:cb is 4:1:1
- * The luminance channel is dithered based on the standard
- * ordered dither pattern for a 4x4 area. The Chrominance
- * channels are dithered based on precomputed f-s errors.
- * Two errors are propogated per pixel. Errors are NOT propogated
- * beyond a 2x2 pixel area.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-HybridDitherImage (unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int w, int h)
-{
- unsigned char *l, *r, *b, *o1, *o2;
- unsigned char *l2;
- int i, j;
-
- l = lum;
- l2 = lum+w;
- r = cr;
- b = cb;
- o1 = out;
- o2 = out+w;
-
- for (i=0; i<h; i+=4) {
-
- for (j=0; j<w; j+=4) {
-
- *o1++ = pixel[(l_darrays[0][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])];
- *o1++ = pixel[(l_darrays[8][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])];
- *o2++ = pixel[(l_darrays[12][*l2++] | cr_fsarray[*r][2] | cb_fsarray[*b][2])];
- *o2++ = pixel[(l_darrays[4][*l2++] | cr_fsarray[*r++][3] | cb_fsarray[*b++][3])];
-
- *o1++ = pixel[(l_darrays[2][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])];
- *o1++ = pixel[(l_darrays[10][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])];
- *o2++ = pixel[(l_darrays[14][*l2++] | cr_fsarray[*r][2] | cb_fsarray[*b][2])];
- *o2++ = pixel[(l_darrays[6][*l2++] | cr_fsarray[*r++][3] | cb_fsarray[*b++][3])];
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
-
- for (j=0; j<w; j+=4) {
-
- *o1++ = pixel[(l_darrays[3][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])];
- *o1++ = pixel[(l_darrays[11][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])];
- *o2++ = pixel[(l_darrays[15][*l2++] | cr_fsarray[*r][3] | cb_fsarray[*b][3])];
- *o2++ = pixel[(l_darrays[7][*l2++] | cr_fsarray[*r++][2] | cb_fsarray[*b++][2])];
-
- *o1++ = pixel[(l_darrays[1][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])];
- *o1++ = pixel[(l_darrays[9][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])];
- *o2++ = pixel[(l_darrays[13][*l2++] | cr_fsarray[*r][3] | cb_fsarray[*b][3])];
- *o2++ = pixel[(l_darrays[5][*l2++] | cr_fsarray[*r++][2] | cb_fsarray[*b++][2])];
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
- }
-}
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp
deleted file mode 100644
index b07d19ea14b..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* This file contains C code to implement an ordered dither in the
- luminance channel and F-S error diffusion on chrominance.
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, hybriderr, "$Id$")
-
-#define DITH_SIZE 16
-
-/* Structures used for hybrid dither with errors propogated. */
-
-static unsigned char *l_darrays[DITH_SIZE];
-static unsigned char *l_darrays0, *l_darrays1, *l_darrays2, *l_darrays3;
-static unsigned char *l_darrays4, *l_darrays5, *l_darrays6, *l_darrays7;
-static unsigned char *l_darrays8, *l_darrays9, *l_darrays10, *l_darrays11;
-static unsigned char *l_darrays12, *l_darrays13, *l_darrays14, *l_darrays15;
-static unsigned char cr_fsarray[256*256][4];
-static unsigned char cb_fsarray[256*256][4];
-static unsigned short c_fserr[256*256][2];
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitHybridErrorDither--
- *
- * Initializes structures used for hybrid dither algorithm
- * with errors propogated on Cr and Cb.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitHybridErrorDither()
-{
- int i, j, k, err_range, threshval;
- unsigned char *lmark;
-
-
- for (i=0; i<DITH_SIZE; i++) {
- lmark = l_darrays[i] = (unsigned char *) ACE_OS::malloc(256);
-
- for (j=0; j<lum_values[0]; j++) {
- *lmark++ = 0;
- }
-
- for (j=0; j<(LUM_RANGE-1); j++) {
- err_range = lum_values[j+1] - lum_values[j];
- threshval = ((i * err_range) / DITH_SIZE)+lum_values[j];
-
- for (k=lum_values[j]; k<lum_values[j+1]; k++) {
- if (k > threshval) *lmark++ = ((j+1) * (CR_RANGE * CB_RANGE));
- else *lmark++ = (j * (CR_RANGE * CB_RANGE));
- }
- }
-
- for (j=lum_values[LUM_RANGE-1]; j <256; j++) {
- *lmark++ = (LUM_RANGE-1)*(CR_RANGE * CB_RANGE);
- }
- }
- l_darrays0 = l_darrays[0]; l_darrays8 = l_darrays[8];
- l_darrays1 = l_darrays[1]; l_darrays9 = l_darrays[9];
- l_darrays2 = l_darrays[2]; l_darrays10 = l_darrays[10];
- l_darrays3 = l_darrays[3]; l_darrays11 = l_darrays[11];
- l_darrays4 = l_darrays[4]; l_darrays12 = l_darrays[12];
- l_darrays5 = l_darrays[5]; l_darrays13 = l_darrays[13];
- l_darrays6 = l_darrays[6]; l_darrays14 = l_darrays[14];
- l_darrays7 = l_darrays[7]; l_darrays15 = l_darrays[15];
- {
- int cr1, cr2, cr3, cr4, err1, err2;
- int cb1, cb2, cb3, cb4, val, nval;
- int outerr1, outerr2, outerr3, outerr4;
- int inerr1, inerr2, inerr3, inerr4;
- unsigned short oe1, oe2, oe3, oe4;
-
- for (j=0; j<65536; j+= 256) {
-
- inerr1 = (((j & 0xc000) >> 14)*8) - 12;
- inerr2 = (((j & 0x3000) >> 12)*8) - 12;
- inerr3 = (((j & 0x0c00) >> 10)*8) - 12;
- inerr4 = (((j & 0x0300) >> 8) *8) - 12;
-
- for (i=0; i<256; i++) {
- val = i;
-
- nval = val+inerr1+inerr3;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cr1 = ((nval) * CR_RANGE) / 256;
- err1 = ((nval) - cr_values[cr1])/2;
- err2 = ((nval) - cr_values[cr1]) - err1;
-
- nval = val+err1+inerr2;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cr2 = ((nval) * CR_RANGE) / 256;
- err1 = ((nval) - cr_values[cr2])/2;
- outerr3 = ((nval) - cr_values[cr2])-err1;
-
- nval = val+err2+inerr4;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cr3 = ((nval) * CR_RANGE) / 256;
- err2 = ((nval) - cr_values[cr3])/2;
- outerr1 = ((nval) - cr_values[cr3]) - err2;
-
- nval = val+err1+err2;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cr4 = ((nval) * CR_RANGE) / 256;
- outerr2 = ((nval) - cr_values[cr4])/2;
- outerr4 = ((nval) - cr_values[cr4])-outerr2;
-
- cr_fsarray[i+j][0] = cr1*CB_RANGE;
- cr_fsarray[i+j][1] = cr2*CB_RANGE;
- cr_fsarray[i+j][2] = cr3*CB_RANGE;
- cr_fsarray[i+j][3] = cr4*CB_RANGE;
-
- if (outerr1 < -16) outerr1++;
- else if (outerr1 > 15) outerr1--;
- if (outerr2 < -16) outerr2++;
- else if (outerr2 > 15) outerr2--;
- if (outerr3 < -16) outerr3++;
- else if (outerr3 > 15) outerr3--;
- if (outerr4 < -16) outerr4++;
- else if (outerr4 > 15) outerr4--;
-
- oe1 = (outerr1 + 16) / 8;
- oe2 = (outerr2 + 16) / 8;
- oe3 = (outerr3 + 16) / 8;
- oe4 = (outerr4 + 16) / 8;
-
-/* This is a debugging check and should be removed if not needed. */
- if ((oe1 > 3) || (oe2 > 3) || (oe3 > 3) || (oe4 > 3))
- fprintf(stderr, "OE error!!!!\n");
-
-
- c_fserr[i+j][0] = ((oe1 << 14) | (oe2 << 12));
-
- c_fserr[i+j][1] = ((oe3 << 10) | (oe4 << 8));
- }
-
- for (i=0; i<256; i++) {
- val = i;
- nval = val+inerr1+inerr3;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cb1 = ((nval) * CB_RANGE) / 256;
- err1 = ((nval) - cb_values[cb1])/2;
- err2 = ((nval) - cb_values[cb1]) - err1;
-
- nval = val+err1+inerr2;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cb2 = ((nval) * CB_RANGE) / 256;
- err1 = ((nval) - cb_values[cb2])/2;
-
- nval = val+err2+inerr4;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cb3 = ((nval) * CB_RANGE) / 256;
- err2 = ((nval) - cb_values[cb3])/2;
-
- nval = val+err1+err2;
- if (nval < 0) nval = 0; else if (nval > 255) nval = 255;
- cb4 = ((nval) * CB_RANGE) / 256;
-
- cb_fsarray[i+j][0] = cb1;
- cb_fsarray[i+j][1] = cb2;
- cb_fsarray[i+j][2] = cb3;
- cb_fsarray[i+j][3] = cb4;
- }
- }
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * HybridErrorDitherImage --
- *
- * Dithers an image using a hybrid ordered/floyd-steinberg dither.
- * Assumptions made:
- * 1) The color space is allocated y:cr:cb = 8:4:4
- * 2) The spatial resolution of y:cr:cb is 4:1:1
- * This dither is almost exactly like the dither implemented in the
- * file odith.c (i.e. hybrid dithering) except a quantized amount of
- * error is propogated between 2x2 pixel areas in Cr and Cb.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-HybridErrorDitherImage (unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int w, int h)
-{
- unsigned char *l, *r, *b, *o1, *o2;
- unsigned char *l2;
- static int *cr_row_errs;
- static int *cb_row_errs;
- int *cr_r_err;
- int *cb_r_err;
- int cr_c_err;
- int cb_c_err;
- unsigned char *cr_fsptr;
- unsigned char *cb_fsptr;
- static int first = 1;
- int cr_code, cb_code;
-
- int i, j;
- int row_advance, row_advance2;
- int half_row_advance, half_row_advance2;
-
- /* If first time called, allocate error arrays. */
-
- if (first) {
- cr_row_errs = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- cb_row_errs = (int *) ACE_OS::malloc((w+5)*sizeof(int));
- first = 0;
- }
-
- row_advance = (w << 1) - 1;
- row_advance2 = row_advance+2;
- half_row_advance = (w>>1)-1;
- half_row_advance2 = half_row_advance+2;
-
- l = lum;
- l2 = lum+w;
- r = cr;
- b = cb;
- o1 = out;
- o2 = out+w;
-
- memset( (char *) cr_row_errs, 0, (w+5)*sizeof(int));
- cr_r_err = cr_row_errs;
- cr_c_err = 0;
- memset( (char *) cb_row_errs, 0, (w+5)*sizeof(int));
- cb_r_err = cb_row_errs;
- cb_c_err = 0;
-
- for (i=0; i<h; i+=4) {
-
- for (j=w; j>0; j-=4) {
-
- cr_code = (*cr_r_err | cr_c_err | *r++);
- cb_code = (*cb_r_err | cb_c_err | *b++);
-
- cr_fsptr = cr_fsarray[cr_code];
- cb_fsptr = cb_fsarray[cb_code];
-
- *o1++ = pixel[(l_darrays0[*l++] | *cr_fsptr++ | *cb_fsptr++)];
- *o1++ = pixel[(l_darrays8[*l++] | *cr_fsptr++ | *cb_fsptr++)];
- *o2++ = pixel[(l_darrays12[*l2++] | *cr_fsptr++ | *cb_fsptr++)];
- *o2++ = pixel[(l_darrays4[*l2++] | *cr_fsptr++ | *cb_fsptr++)];
-
- cr_c_err = c_fserr[cr_code][1];
- cb_c_err = c_fserr[cb_code][1];
- *cr_r_err++ = c_fserr[cr_code][0];
- *cb_r_err++ = c_fserr[cb_code][0];
- cr_code = (*cr_r_err | cr_c_err | *r++);
- cb_code = (*cb_r_err | cb_c_err | *b++);
-
- cr_fsptr = cr_fsarray[cr_code];
- cb_fsptr = cb_fsarray[cb_code];
-
- *o1++ = pixel[(l_darrays2[*l++] | *cr_fsptr++ | *cb_fsptr++)];
- *o1++ = pixel[(l_darrays10[*l++] | *cr_fsptr++ | *cb_fsptr++)];
- *o2++ = pixel[(l_darrays14[*l2++] | *cr_fsptr++ | *cb_fsptr++)];
- *o2++ = pixel[(l_darrays6[*l2++] | *cr_fsptr++ | *cb_fsptr++)];
-
- cr_c_err = c_fserr[cr_code][1];
- cb_c_err = c_fserr[cb_code][1];
- *cr_r_err++ = c_fserr[cr_code][0];
- *cb_r_err++ = c_fserr[cb_code][0];
- }
-
- l += row_advance; l2 += row_advance;
- o1 += row_advance; o2 += row_advance;
- cr_c_err = 0;
- cb_c_err = 0;
- cr_r_err--; cb_r_err--;
- r += half_row_advance; b += half_row_advance;
-
- for (j=w; j>0; j-=4) {
-
- cr_code = (*cr_r_err | cr_c_err | *r--);
- cb_code = (*cb_r_err | cb_c_err | *b--);
- cr_fsptr = cr_fsarray[cr_code];
- cb_fsptr = cb_fsarray[cb_code];
-
- *o1-- = pixel[(l_darrays9[*l--] | *cr_fsptr++ | *cb_fsptr++)];
- *o1-- = pixel[(l_darrays1[*l--] | *cr_fsptr++ | *cb_fsptr++)];
- *o2-- = pixel[(l_darrays5[*l2--] | *cr_fsptr++ | *cb_fsptr++)];
- *o2-- = pixel[(l_darrays13[*l2--] | *cr_fsptr++ | *cb_fsptr++)];
-
- cr_c_err = c_fserr[cr_code][1];
- cb_c_err = c_fserr[cb_code][1];
- *cr_r_err-- = c_fserr[cr_code][0];
- *cb_r_err-- = c_fserr[cb_code][0];
- cr_code = (*cr_r_err | cr_c_err | *r--);
- cb_code = (*cb_r_err | cb_c_err | *b--);
- cr_fsptr = cr_fsarray[cr_code];
- cb_fsptr = cb_fsarray[cb_code];
-
- *o1-- = pixel[(l_darrays11[*l--] | *cr_fsptr++ | *cb_fsptr++)];
- *o1-- = pixel[(l_darrays3[*l--] | *cr_fsptr++ | *cb_fsptr++)];
- *o2-- = pixel[(l_darrays7[*l2--] | *cr_fsptr++ | *cb_fsptr++)];
- *o2-- = pixel[(l_darrays15[*l2--] | *cr_fsptr++ | *cb_fsptr++)];
-
- cr_c_err = c_fserr[cr_code][1];
- cb_c_err = c_fserr[cb_code][1];
- *cr_r_err-- = c_fserr[cr_code][0];
- *cb_r_err-- = c_fserr[cb_code][0];
-
- }
-
- l += row_advance2; l2 += row_advance2;
- o1 += row_advance2; o2 += row_advance2;
- cr_c_err = 0; cb_c_err = 0;
- cr_r_err++; cb_r_err++;
- r += half_row_advance2; b += half_row_advance2;
- }
-}
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp
deleted file mode 100644
index 6400a72bd42..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include "ace/ACE.h"
-
-ACE_RCSID(mpeg_client, info, "$Id$")
-
-char infomessage[] = "\
-\n\
-\n\
-\n\
-TAO Audio/Video Streaming service\n\
----------------------------------\n\
-\n\
-This is a distributed audio/video streaming application that uses\n\
-interfaces and interactions defined in the OMG \"Control and Management\n\
-of A/V streams\" spec. An implementation of the spec can be found in\n\
-the following directory.\n\
-\n\
-TAO/orbsvcs/orbsvcs/AV/\n\
-\n\
-The TAO application is a modified version of a streaming application\n\
-developed at the Oregon Graduate Institute.\n\
-\n\
-\n\
-\n\
-The player features common VCR functionalities like synchronized\n\
-video(MPEG) and audio(.au) play back, play speed set on the fly,\n\
-fast-forward, rewind, step forward, random Positioning, and more.\n\
-\n\
-The player is of server/client architecture. The server manages program\n\
-retrieval and distribution. The client decodes video frames, plays video\n\
-and audio streams, and provides a Motif style user interface.\n\
-\n\
-\n\
-The basic client/server used by the application originated from:\n\
- Distributed Systems Research Group\n\
- Department of Computer Science and Engineering\n\
- Oregon Graduate Institute of Science and Technology\n\
- October, 1995\n\
-The MPEG decoder used by the client is originated from U.C.Berkeley\n\
-MPEG decoder 2.0, by Lawrence A. Rowe, Ketan Patel, and Brian Smith,\n\
-of Computer Science Division-EECS, Univ. of Calif. at Berkeley.\n\
-\n\
-The Motif user interface is based on an implementation by Daeron Meyer\n\
-of The Geometry Center, University of Minnesota.\n\
-\n\
-This software is covered by copyrights. It contains code contributed\n\
-by the authors and several other parties. Please see the beginning of\n\
-source files and copyright file(s) in the root directory of the source\n\
-kit.\n\
-\n\
-Sumedh Mungee <sumedh@cs.wustl.edu>\n\
-Nagarajan Surendran <naga@cs.wustl.edu>\n\
-Seth Widoff <sbw1@cs.wustl.edu>\n\
-Alexander Arulanthu <alex@cs.wustl.edu>\n\
-Distributed Object Computing Group\n\
-Washington University\n\
-\n\
-\n\
-";
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib
deleted file mode 100644
index e42c3b7ec75..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib
+++ /dev/null
@@ -1,78 +0,0 @@
-static char InfoMib[] = "\
-TotalWidgets: 4\n\
-Ref: 1\n\
-Widget: \"RootForm\"\n\
-Children: 2 3 4\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Root\"\n\
-Xmwidth: 562\n\
-Xmheight: 307\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 0\n\
-XmleftOffset: 0\n\
-XmrightOffset: 0\n\
-Private-\n\
-EndWidget.\n\
-Ref: 2\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Dismiss\"\n\
-Xmwidth: 62\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 270\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 506\n\
-XmrightOffset: 9\n\
-Private-\n\
-label: \"Dismiss\"\n\
-EndWidget.\n\
-Ref: 3\n\
-Widget: \"TextBig\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"TextBig\"\n\
-Xmwidth: 546\n\
-Xmheight: 256\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 8\n\
-XmbottomOffset: 43\n\
-XmleftOffset: 8\n\
-XmrightOffset: 8\n\
-Private-\n\
-EndWidget.\n\
-Ref: 4\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"OutFrame\"\n\
-Xmwidth: 561\n\
-Xmheight: 306\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 1\n\
-XmleftOffset: 1\n\
-XmrightOffset: 0\n\
-Private-\n\
-shadowtype: 1\n\
-EndWidget.\n\
-END.\n\
-";
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib
deleted file mode 100644
index d1f432214bb..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib
+++ /dev/null
@@ -1,229 +0,0 @@
-static char MainMib[] = "\
-TotalWidgets: 12\n\
-Ref: 1\n\
-Widget: \"RootForm\"\n\
-Children: 2 3 4 5 6 7 8 9 10 11 12\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Root\"\n\
-Xmwidth: 364\n\
-Xmheight: 216\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 0\n\
-XmleftOffset: 0\n\
-XmrightOffset: 0\n\
-Private-\n\
-EndWidget.\n\
-Ref: 2\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Info\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 200\n\
-XmrightOffset: 123\n\
-Private-\n\
-label: \"Info\"\n\
-EndWidget.\n\
-Ref: 3\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Loop\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 140\n\
-XmrightOffset: 196\n\
-Private-\n\
-label: \"Loop\"\n\
-EndWidget.\n\
-Ref: 4\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Step\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 74\n\
-XmrightOffset: 262\n\
-Private-\n\
-label: \"Step\"\n\
-EndWidget.\n\
-Ref: 5\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Exit\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 314\n\
-XmrightOffset: 9\n\
-Private-\n\
-label: \"Exit\"\n\
-EndWidget.\n\
-Ref: 6\n\
-Widget: \"TextBox\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"FrameText\"\n\
-Xmwidth: 65\n\
-Xmheight: 29\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 8\n\
-XmleftOffset: 245\n\
-XmrightOffset: 54\n\
-Private-\n\
-EndWidget.\n\
-Ref: 7\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Rewind\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 8\n\
-XmrightOffset: 328\n\
-Private-\n\
-label: \"Rew\"\n\
-EndWidget.\n\
-Ref: 8\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Play\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 107\n\
-XmrightOffset: 229\n\
-Private-\n\
-label: \"Play\"\n\
-EndWidget.\n\
-Ref: 9\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Stop\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 9\n\
-XmleftOffset: 41\n\
-XmrightOffset: 295\n\
-Private-\n\
-label: \"Stop\"\n\
-EndWidget.\n\
-Ref: 10\n\
-Widget: \"DrawingArea\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Monitor\"\n\
-Xmwidth: 336\n\
-Xmheight: 157\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 13\n\
-XmbottomOffset: 46\n\
-XmleftOffset: 13\n\
-XmrightOffset: 15\n\
-Private-\n\
-EndWidget.\n\
-Ref: 11\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"InFrame\"\n\
-Xmwidth: 347\n\
-Xmheight: 167\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 8\n\
-XmbottomOffset: 41\n\
-XmleftOffset: 8\n\
-XmrightOffset: 9\n\
-Private-\n\
-shadowtype: 0\n\
-EndWidget.\n\
-Ref: 12\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"OutFrame\"\n\
-Xmwidth: 362\n\
-Xmheight: 215\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 1\n\
-XmleftOffset: 1\n\
-XmrightOffset: 1\n\
-Private-\n\
-shadowtype: 1\n\
-EndWidget.\n\
-END.\n\
-";
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib
deleted file mode 100644
index 1005fba75e8..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib
+++ /dev/null
@@ -1,324 +0,0 @@
-static char MainMib[] = "\
-TotalWidgets: 17\n\
-Ref: 1\n\
-Widget: \"RootForm\"\n\
-Children: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Root\"\n\
-Xmwidth: 364\n\
-Xmheight: 306\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 0\n\
-XmleftOffset: 0\n\
-XmrightOffset: 0\n\
-Private-\n\
-EndWidget.\n\
-Ref: 2\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Exit\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 8\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Exit\"\n\
-EndWidget.\n\
-Ref: 3\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Info\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 53\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Info\"\n\
-EndWidget.\n\
-Ref: 4\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Para\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 98\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Para\"\n\
-EndWidget.\n\
-Ref: 5\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Prog\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 143\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Prog\"\n\
-EndWidget.\n\
-Ref: 6\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"File\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 188\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"File\"\n\
-EndWidget.\n\
-Ref: 7\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Step\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 9\n\
-Private-\n\
-label: \"Step\"\n\
-EndWidget.\n\
-Ref: 8\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Play\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 42\n\
-Private-\n\
-label: \"Play\"\n\
-EndWidget.\n\
-Ref: 9\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"FF\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 75\n\
-Private-\n\
-label: \"FF\"\n\
-EndWidget.\n\
-Ref: 10\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Stop\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 108\n\
-Private-\n\
-label: \"Stop\"\n\
-EndWidget.\n\
-Ref: 11\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Rewind\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 141\n\
-Private-\n\
-label: \"Rewind\"\n\
-EndWidget.\n\
-Ref: 12\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Normal\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 174\n\
-Private-\n\
-label: \"Norm\"\n\
-EndWidget.\n\
-Ref: 13\n\
-Widget: \"Toggle\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Loop\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 219\n\
-Private-\n\
-label: \"Loop\"\n\
-EndWidget.\n\
-Ref: 14\n\
-Widget: \"DrawingArea\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Monitor\"\n\
-Xmwidth: 336\n\
-Xmheight: 157\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 43\n\
-XmbottomOffset: 106\n\
-XmleftOffset: 13\n\
-XmrightOffset: 15\n\
-Private-\n\
-EndWidget.\n\
-Ref: 15\n\
-Widget: \"TextBox\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"TitleText\"\n\
-Xmwidth: 336\n\
-Xmheight: 29\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 0\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 8\n\
-XmbottomOffset: 106\n\
-XmleftOffset: 8\n\
-XmrightOffset: 9\n\
-Private-\n\
-EndWidget.\n\
-Ref: 16\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"InFrame\"\n\
-Xmwidth: 347\n\
-Xmheight: 197\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 38\n\
-XmbottomOffset: 101\n\
-XmleftOffset: 8\n\
-XmrightOffset: 9\n\
-Private-\n\
-shadowtype: 0\n\
-EndWidget.\n\
-Ref: 17\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"OutFrame\"\n\
-Xmwidth: 362\n\
-Xmheight: 275\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 1\n\
-XmleftOffset: 1\n\
-XmrightOffset: 1\n\
-Private-\n\
-shadowtype: 1\n\
-EndWidget.\n\
-END.\n\
-";
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm
deleted file mode 100644
index e20c1d81d6c..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm
+++ /dev/null
@@ -1,9 +0,0 @@
-#define fb_width 20
-#define fb_height 20
-static unsigned char fb_bits[] = {
-0x00, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x8a, 0x02, 0x00,
-0x4d, 0x03, 0x80, 0xaa, 0x02, 0x40, 0x5d, 0x03, 0xa0, 0x28,
-0x02, 0x50, 0x1c, 0x03, 0x28, 0x00, 0x02, 0x1c, 0x00, 0x03,
-0x38, 0x00, 0x02, 0x70, 0x1c, 0x03, 0xe0, 0x38, 0x02, 0xc0,
-0x7d, 0x03, 0x80, 0xeb, 0x02, 0x00, 0xcf, 0x03, 0x00, 0x8e,
-0x03, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm
deleted file mode 100644
index 82b4c250417..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define ff_width 20
-#define ff_height 20
-static unsigned char ff_bits[] = {
- 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x14, 0x05, 0x00, 0x2c, 0x0b, 0x00,
- 0x54, 0x15, 0x00, 0xac, 0x2b, 0x00, 0x44, 0x51, 0x00, 0x8c, 0xa3, 0x00,
- 0x04, 0x40, 0x01, 0x0c, 0x80, 0x03, 0x04, 0xc0, 0x01, 0x8c, 0xe3, 0x00,
- 0xc4, 0x71, 0x00, 0xec, 0x3b, 0x00, 0x74, 0x1d, 0x00, 0x3c, 0x0f, 0x00,
- 0x1c, 0x07, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm
deleted file mode 100644
index 9847623ba6a..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define loop_width 20
-#define loop_height 20
-static unsigned char loop_bits[] = {
- 0x00, 0x10, 0x00, 0x00, 0xf0, 0x00, 0xa0, 0xa0, 0x03, 0x50, 0x51, 0x05,
- 0xe8, 0xa0, 0x06, 0x74, 0x50, 0x03, 0x38, 0xe0, 0x02, 0x34, 0x70, 0x05,
- 0x1a, 0x80, 0x06, 0x14, 0x00, 0x05, 0x1a, 0x80, 0x06, 0x14, 0x00, 0x05,
- 0x2a, 0x80, 0x06, 0x54, 0x40, 0x03, 0xa8, 0xaa, 0x02, 0x50, 0x55, 0x01,
- 0xb0, 0xea, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib
deleted file mode 100644
index b3cc211d9ad..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib
+++ /dev/null
@@ -1,305 +0,0 @@
-static char MainMib[] = "\
-TotalWidgets: 16\n\
-Ref: 1\n\
-Widget: \"RootForm\"\n\
-Children: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Root\"\n\
-Xmwidth: 364\n\
-Xmheight: 306\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 0\n\
-XmleftOffset: 0\n\
-XmrightOffset: 0\n\
-Private-\n\
-EndWidget.\n\
-Ref: 2\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Exit\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 8\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Exit\"\n\
-EndWidget.\n\
-Ref: 3\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Info\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 53\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Info\"\n\
-EndWidget.\n\
-Ref: 4\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Para\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 98\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Para\"\n\
-EndWidget.\n\
-Ref: 5\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Prog\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 0\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 143\n\
-XmrightOffset: 10\n\
-Private-\n\
-label: \"Prog\"\n\
-EndWidget.\n\
-Ref: 6\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Step\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 9\n\
-Private-\n\
-label: \"Step\"\n\
-EndWidget.\n\
-Ref: 7\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Play\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 42\n\
-Private-\n\
-label: \"Play\"\n\
-EndWidget.\n\
-Ref: 8\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"FF\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 75\n\
-Private-\n\
-label: \"FF\"\n\
-EndWidget.\n\
-Ref: 9\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Stop\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 108\n\
-Private-\n\
-label: \"Stop\"\n\
-EndWidget.\n\
-Ref: 10\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Rewind\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 141\n\
-Private-\n\
-label: \"Rewind\"\n\
-EndWidget.\n\
-Ref: 11\n\
-Widget: \"Button\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Normal\"\n\
-Xmwidth: 41\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 174\n\
-Private-\n\
-label: \"Norm\"\n\
-EndWidget.\n\
-Ref: 12\n\
-Widget: \"Toggle\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Loop\"\n\
-Xmwidth: 28\n\
-Xmheight: 28\n\
-XmtopAttachment: 0\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 0\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 179\n\
-XmbottomOffset: 69\n\
-XmleftOffset: 100\n\
-XmrightOffset: 219\n\
-Private-\n\
-label: \"Loop\"\n\
-EndWidget.\n\
-Ref: 13\n\
-Widget: \"DrawingArea\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"Monitor\"\n\
-Xmwidth: 336\n\
-Xmheight: 157\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 43\n\
-XmbottomOffset: 106\n\
-XmleftOffset: 13\n\
-XmrightOffset: 15\n\
-Private-\n\
-EndWidget.\n\
-Ref: 14\n\
-Widget: \"TextBox\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"TitleText\"\n\
-Xmwidth: 336\n\
-Xmheight: 29\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 0\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 8\n\
-XmbottomOffset: 106\n\
-XmleftOffset: 8\n\
-XmrightOffset: 9\n\
-Private-\n\
-EndWidget.\n\
-Ref: 15\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"InFrame\"\n\
-Xmwidth: 347\n\
-Xmheight: 197\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 38\n\
-XmbottomOffset: 101\n\
-XmleftOffset: 8\n\
-XmrightOffset: 9\n\
-Private-\n\
-shadowtype: 0\n\
-EndWidget.\n\
-Ref: 16\n\
-Widget: \"Frame\"\n\
-Children: X\n\
-Parent: 1\n\
-Public-\n\
-Name: \"OutFrame\"\n\
-Xmwidth: 362\n\
-Xmheight: 275\n\
-XmtopAttachment: 1\n\
-XmbottomAttachment: 1\n\
-XmleftAttachment: 1\n\
-XmrightAttachment: 1\n\
-XmtopOffset: 0\n\
-XmbottomOffset: 1\n\
-XmleftOffset: 1\n\
-XmrightOffset: 1\n\
-Private-\n\
-shadowtype: 1\n\
-EndWidget.\n\
-END.\n\
-";
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm
deleted file mode 100644
index 91955e5117c..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define play_width 20
-#define play_height 20
-static unsigned char play_bits[] = {
- 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x01, 0x00, 0xc0, 0x02, 0x00,
- 0x40, 0x05, 0x00, 0xc0, 0x0a, 0x00, 0x40, 0x14, 0x00, 0xc0, 0x28, 0x00,
- 0x40, 0x50, 0x00, 0xc0, 0xe0, 0x00, 0x40, 0x70, 0x00, 0xc0, 0x38, 0x00,
- 0x40, 0x1c, 0x00, 0xc0, 0x0e, 0x00, 0x40, 0x07, 0x00, 0xc0, 0x03, 0x00,
- 0xc0, 0x01, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm
deleted file mode 100644
index 402643dcd25..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define rewind_width 20
-#define rewind_height 20
-static unsigned char rewind_bits[] = {
- 0x00, 0x00, 0x00, 0x30, 0x80, 0x01, 0x28, 0x40, 0x01, 0x30, 0xa0, 0x01,
- 0x28, 0x50, 0x01, 0x30, 0xa8, 0x01, 0x28, 0x14, 0x01, 0x30, 0x8a, 0x01,
- 0x28, 0x05, 0x01, 0xb0, 0x83, 0x01, 0x28, 0x03, 0x01, 0x30, 0x8e, 0x01,
- 0x28, 0x1c, 0x01, 0x30, 0xb8, 0x01, 0x28, 0x70, 0x01, 0x30, 0xe0, 0x01,
- 0x28, 0xc0, 0x01, 0x38, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm
deleted file mode 100644
index 3ac996cbdb7..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define step_width 20
-#define step_height 20
-static unsigned char step_bits[] = {
- 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x14, 0x05, 0x00, 0x18, 0x0b, 0x00,
- 0x14, 0x15, 0x00, 0x18, 0x2b, 0x00, 0x14, 0x51, 0x00, 0x18, 0xa3, 0x00,
- 0x14, 0x41, 0x01, 0x18, 0x83, 0x03, 0x14, 0xc1, 0x01, 0x18, 0xe3, 0x00,
- 0x14, 0x71, 0x00, 0x18, 0x3b, 0x00, 0x14, 0x1d, 0x00, 0x18, 0x0f, 0x00,
- 0x14, 0x07, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm
deleted file mode 100644
index 490ee392761..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define stop_width 20
-#define stop_height 20
-static unsigned char stop_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x54, 0x55, 0x01,
- 0xac, 0xaa, 0x02, 0x14, 0x80, 0x01, 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01,
- 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01, 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01,
- 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01, 0x0c, 0x80, 0x02, 0xf4, 0xff, 0x01,
- 0xac, 0xaa, 0x02, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp
deleted file mode 100644
index 6114517c580..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp
+++ /dev/null
@@ -1,1461 +0,0 @@
-/* $Id$ */
-
-/*
- * jrevdct.c
- *
- * Copyright (C) 1991, 1992, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the basic inverse-DCT transformation subroutine.
- *
- * This implementation is based on an algorithm described in
- * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
- * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
- * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
- * The primary algorithm described there uses 11 multiplies and 29 adds.
- * We use their alternate method with 12 multiplies and 32 adds.
- * The advantage of this method is that no data path contains more than one
- * multiplication; this allows a very simple and accurate implementation in
- * scaled fixed-point arithmetic, with a minimal number of shifts.
- *
- * I've made lots of modifications to attempt to take advantage of the
- * sparse nature of the DCT matrices we're getting. Although the logic
- * is cumbersome, it's straightforward and the resulting code is much
- * faster.
- *
- * A better way to do this would be to pass in the DCT block as a sparse
- * matrix, perhaps with the difference cases encoded.
- */
-
-#include <string.h>
-#include "video.h"
-#include "proto.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, jrevdct, "$Id$")
-
-#define GLOBAL /* a function referenced thru EXTERNs */
-
-/* We assume that right shift corresponds to signed division by 2 with
- * rounding towards minus infinity. This is correct for typical "arithmetic
- * shift" instructions that shift in copies of the sign bit. But some
- * C compilers implement >> with an unsigned shift. For these machines you
- * must define RIGHT_SHIFT_IS_UNSIGNED.
- * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
- * It is only applied with constant shift counts. SHIFT_TEMPS must be
- * included in the variables of any routine using RIGHT_SHIFT.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define SHIFT_TEMPS INT32 shift_temp;
-#define RIGHT_SHIFT(x,shft) \
- ((shift_temp = (x)) < 0 ? \
- (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
- (shift_temp >> (shft)))
-#else
-#define SHIFT_TEMPS
-#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-/*
- * This routine is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/*
- * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
- * on each column. Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * The poop on this scaling stuff is as follows:
- *
- * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
- * larger than the true IDCT outputs. The final outputs are therefore
- * a factor of N larger than desired; since N=8 this can be cured by
- * a simple right shift at the end of the algorithm. The advantage of
- * this arrangement is that we save two multiplications per 1-D IDCT,
- * because the y0 and y4 inputs need not be divided by sqrt(N).
- *
- * We have to do addition and subtraction of the integer inputs, which
- * is no problem, and multiplication by fractional constants, which is
- * a problem to do in integer arithmetic. We multiply all the constants
- * by CONST_SCALE and convert them to integer constants (thus retaining
- * CONST_BITS bits of precision in the constants). After doing a
- * multiplication we have to divide the product by CONST_SCALE, with proper
- * rounding, to produce the correct output. This division can be done
- * cheaply as a right shift of CONST_BITS bits. We postpone shifting
- * as long as possible so that partial sums can be added together with
- * full fractional precision.
- *
- * The outputs of the first pass are scaled up by PASS1_BITS bits so that
- * they are represented to better-than-integral precision. These outputs
- * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
- * with the recommended scaling. (To scale up 12-bit sample data further, an
- * intermediate INT32 array would be needed.)
- *
- * To avoid overflow of the 32-bit intermediate results in pass 2, we must
- * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
- * shows that the values given below are the most effective.
- */
-
-#ifdef EIGHT_BIT_SAMPLES
-#define PASS1_BITS 2
-#else
-#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
-#endif
-
-#define ONE ((INT32) 1)
-
-#define CONST_SCALE (ONE << CONST_BITS)
-
-/* Convert a positive real constant to an integer scaled by CONST_SCALE.
- * IMPORTANT: if your compiler doesn't do this arithmetic at compile time,
- * you will pay a significant penalty in run time. In that case, figure
- * the correct integer constant values and insert them by hand.
- */
-
-#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
-
-/* Descale and correctly round an INT32 value that's scaled by N bits.
- * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
- * the fudge factor is correct for either sign of X.
- */
-
-#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
-
-/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
- * this provides a useful speedup on many machines.
- * There is no way to specify a 16x16->32 multiply in portable C, but
- * some C compilers will do the right thing if you provide the correct
- * combination of casts.
- * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#ifdef EIGHT_BIT_SAMPLES
-#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
-#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
-#endif
-#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
-#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
-#endif
-#endif
-
-#ifndef MULTIPLY /* default definition */
-#define MULTIPLY(var,const) ((var) * (const))
-#endif
-
-/* Precomputed idct value arrays. */
-
-static DCTELEM PreIDCT[64][64];
-
-void j_rev_dct (DCTBLOCK data);
-
-/* Pre compute singleton coefficient IDCT values. */
-void
-init_pre_idct() {
- int i;
-
- for (i=0; i<64; i++) {
- memset((char *) PreIDCT[i], 0, 64*sizeof(DCTELEM));
- PreIDCT[i][i] = 2048;
- j_rev_dct(PreIDCT[i]);
- }
-}
-
-#ifndef ORIG_DCT
-
-
-/*
- * Perform the inverse DCT on one block of coefficients.
- */
-
-void
-j_rev_dct_sparse (DCTBLOCK data, int pos)
-{
- register DCTELEM *dataptr;
- short int val;
- DCTELEM *ndataptr;
- int scale, coeff, rr;
- register int *dp;
- register int v;
-
- /* If DC Coefficient. */
-
- if (pos == 0) {
- dp = (int *)data;
- v = *data;
- /* Compute 32 bit value to assign. This speeds things up a bit */
- if (v < 0) val = (v-3)>>3;
- else val = (v+4)>>3;
- v = val | (val << 16);
- dp[0] = v; dp[1] = v; dp[2] = v; dp[3] = v;
- dp[4] = v; dp[5] = v; dp[6] = v; dp[7] = v;
- dp[8] = v; dp[9] = v; dp[10] = v; dp[11] = v;
- dp[12] = v; dp[13] = v; dp[14] = v; dp[15] = v;
- dp[16] = v; dp[17] = v; dp[18] = v; dp[19] = v;
- dp[20] = v; dp[21] = v; dp[22] = v; dp[23] = v;
- dp[24] = v; dp[25] = v; dp[26] = v; dp[27] = v;
- dp[28] = v; dp[29] = v; dp[30] = v; dp[31] = v;
- return;
- }
-
- /* Some other coefficient. */
- dataptr = (DCTELEM *)data;
- coeff = dataptr[pos];
- ndataptr = PreIDCT[pos];
-
- for (rr=0; rr<4; rr++) {
- dataptr[0] = (ndataptr[0] * coeff) >> (CONST_BITS-2);
- dataptr[1] = (ndataptr[1] * coeff) >> (CONST_BITS-2);
- dataptr[2] = (ndataptr[2] * coeff) >> (CONST_BITS-2);
- dataptr[3] = (ndataptr[3] * coeff) >> (CONST_BITS-2);
- dataptr[4] = (ndataptr[4] * coeff) >> (CONST_BITS-2);
- dataptr[5] = (ndataptr[5] * coeff) >> (CONST_BITS-2);
- dataptr[6] = (ndataptr[6] * coeff) >> (CONST_BITS-2);
- dataptr[7] = (ndataptr[7] * coeff) >> (CONST_BITS-2);
- dataptr[8] = (ndataptr[8] * coeff) >> (CONST_BITS-2);
- dataptr[9] = (ndataptr[9] * coeff) >> (CONST_BITS-2);
- dataptr[10] = (ndataptr[10] * coeff) >> (CONST_BITS-2);
- dataptr[11] = (ndataptr[11] * coeff) >> (CONST_BITS-2);
- dataptr[12] = (ndataptr[12] * coeff) >> (CONST_BITS-2);
- dataptr[13] = (ndataptr[13] * coeff) >> (CONST_BITS-2);
- dataptr[14] = (ndataptr[14] * coeff) >> (CONST_BITS-2);
- dataptr[15] = (ndataptr[15] * coeff) >> (CONST_BITS-2);
- dataptr += 16;
- ndataptr += 16;
- }
- return;
-}
-
-
-void
-j_rev_dct (DCTBLOCK data)
-{
- INT32 tmp0, tmp1, tmp2, tmp3;
- INT32 tmp10, tmp11, tmp12, tmp13;
- INT32 z1, z2, z3, z4, z5;
- INT32 d0, d1, d2, d3, d4, d5, d6, d7;
- register DCTELEM *dataptr;
- int rowctr;
- SHIFT_TEMPS
-
- /* Pass 1: process rows. */
- /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
- /* furthermore, we scale the results by 2**PASS1_BITS. */
-
- dataptr = data;
-
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
- /* Due to quantization, we will usually find that many of the input
- * coefficients are zero, especially the AC terms. We can exploit this
- * by short-circuiting the IDCT calculation for any row in which all
- * the AC terms are zero. In that case each output is equal to the
- * DC coefficient (with scale factor as needed).
- * With typical images and quantization tables, half or more of the
- * row DCT calculations can be simplified this way.
- */
-
- register int *idataptr = (int*)dataptr;
- d0 = dataptr[0];
- d1 = dataptr[1];
- if ((d1 == 0) && (idataptr[1] | idataptr[2] | idataptr[3]) == 0) {
- /* AC terms all zero */
- if (d0) {
- /* Compute a 32 bit value to assign. */
- DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS);
- register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
-
- idataptr[0] = v;
- idataptr[1] = v;
- idataptr[2] = v;
- idataptr[3] = v;
- }
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
- d2 = dataptr[2];
- d3 = dataptr[3];
- d4 = dataptr[4];
- d5 = dataptr[5];
- d6 = dataptr[6];
- d7 = dataptr[7];
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
- if (d6) {
- if (d4) {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp0 = d4 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp2 - tmp0;
- tmp12 = -(tmp0 + tmp2);
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, - FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, -FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp0 = d4 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp2 - tmp0;
- tmp12 = -(tmp0 + tmp2);
- }
- }
- } else {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp0 = d0 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp10 = tmp3;
- tmp13 = -tmp3;
- tmp11 = tmp2;
- tmp12 = -tmp2;
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, - FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp0 = d0 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
- } else {
- /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, - FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp10 = tmp3;
- tmp13 = -tmp3;
- tmp11 = tmp2;
- tmp12 = -tmp2;
- }
- }
- }
- } else {
- if (d4) {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp0 = d4 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp2 - tmp0;
- tmp12 = -(tmp0 + tmp2);
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
- tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
- } else {
- /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = d4 << CONST_BITS;
- tmp11 = tmp12 = -tmp10;
- }
- }
- } else {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp0 = d0 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp10 = tmp3;
- tmp13 = -tmp3;
- tmp11 = tmp2;
- tmp12 = -tmp2;
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
- tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS;
- } else {
- /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
- tmp10 = tmp13 = tmp11 = tmp12 = 0;
- }
- }
- }
- }
-
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
-
- if (d7) {
- if (d5) {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z2 = d5 + d3;
- z3 = d7 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(z1, - FIX(0.899976223));
- z2 = MULTIPLY(z2, - FIX(2.562915447));
- z3 = MULTIPLY(z3, - FIX(1.961570560));
- z4 = MULTIPLY(z4, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
- z1 = d7;
- z2 = d5 + d3;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- z1 = MULTIPLY(d7, - FIX(0.899976223));
- z2 = MULTIPLY(z2, - FIX(2.562915447));
- z3 = MULTIPLY(z3, - FIX(1.961570560));
- z4 = MULTIPLY(d5, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 = z1 + z4;
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z2 = d5;
- z3 = d7;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(z1, - FIX(0.899976223));
- z2 = MULTIPLY(d5, - FIX(2.562915447));
- z3 = MULTIPLY(d7, - FIX(1.961570560));
- z4 = MULTIPLY(z4, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 = z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
- tmp0 = MULTIPLY(d7, - FIX(0.601344887));
- z1 = MULTIPLY(d7, - FIX(0.899976223));
- z3 = MULTIPLY(d7, - FIX(1.961570560));
- tmp1 = MULTIPLY(d5, - FIX(0.509795578));
- z2 = MULTIPLY(d5, - FIX(2.562915447));
- z4 = MULTIPLY(d5, - FIX(0.390180644));
- z5 = MULTIPLY(d5 + d7, FIX(1.175875602));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z3;
- tmp1 += z4;
- tmp2 = z2 + z3;
- tmp3 = z1 + z4;
- }
- }
- } else {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(z1, - FIX(0.899976223));
- z2 = MULTIPLY(d3, - FIX(2.562915447));
- z3 = MULTIPLY(z3, - FIX(1.961570560));
- z4 = MULTIPLY(d1, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 = z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
- z3 = d7 + d3;
-
- tmp0 = MULTIPLY(d7, - FIX(0.601344887));
- z1 = MULTIPLY(d7, - FIX(0.899976223));
- tmp2 = MULTIPLY(d3, FIX(0.509795579));
- z2 = MULTIPLY(d3, - FIX(2.562915447));
- z5 = MULTIPLY(z3, FIX(1.175875602));
- z3 = MULTIPLY(z3, - FIX(0.785694958));
-
- tmp0 += z3;
- tmp1 = z2 + z5;
- tmp2 += z3;
- tmp3 = z1 + z5;
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z5 = MULTIPLY(z1, FIX(1.175875602));
-
- z1 = MULTIPLY(z1, FIX(0.275899379));
- z3 = MULTIPLY(d7, - FIX(1.961570560));
- tmp0 = MULTIPLY(d7, - FIX(1.662939224));
- z4 = MULTIPLY(d1, - FIX(0.390180644));
- tmp3 = MULTIPLY(d1, FIX(1.111140466));
-
- tmp0 += z1;
- tmp1 = z4 + z5;
- tmp2 = z3 + z5;
- tmp3 += z1;
- } else {
- /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
- tmp0 = MULTIPLY(d7, - FIX(1.387039845));
- tmp1 = MULTIPLY(d7, FIX(1.175875602));
- tmp2 = MULTIPLY(d7, - FIX(0.785694958));
- tmp3 = MULTIPLY(d7, FIX(0.275899379));
- }
- }
- }
- } else {
- if (d5) {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
-
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(d1, - FIX(0.899976223));
- z2 = MULTIPLY(z2, - FIX(2.562915447));
- z3 = MULTIPLY(d3, - FIX(1.961570560));
- z4 = MULTIPLY(z4, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 = z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
-
- z5 = MULTIPLY(z2, FIX(1.175875602));
- tmp1 = MULTIPLY(d5, FIX(1.662939225));
- z4 = MULTIPLY(d5, - FIX(0.390180644));
- z2 = MULTIPLY(z2, - FIX(1.387039845));
- tmp2 = MULTIPLY(d3, FIX(1.111140466));
- z3 = MULTIPLY(d3, - FIX(1.961570560));
-
- tmp0 = z3 + z5;
- tmp1 += z2;
- tmp2 += z2;
- tmp3 = z4 + z5;
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
- z4 = d5 + d1;
-
- z5 = MULTIPLY(z4, FIX(1.175875602));
- z1 = MULTIPLY(d1, - FIX(0.899976223));
- tmp3 = MULTIPLY(d1, FIX(0.601344887));
- tmp1 = MULTIPLY(d5, - FIX(0.509795578));
- z2 = MULTIPLY(d5, - FIX(2.562915447));
- z4 = MULTIPLY(z4, FIX(0.785694958));
-
- tmp0 = z1 + z5;
- tmp1 += z4;
- tmp2 = z2 + z5;
- tmp3 += z4;
- } else {
- /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
- tmp0 = MULTIPLY(d5, FIX(1.175875602));
- tmp1 = MULTIPLY(d5, FIX(0.275899380));
- tmp2 = MULTIPLY(d5, - FIX(1.387039845));
- tmp3 = MULTIPLY(d5, FIX(0.785694958));
- }
- }
- } else {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
- z5 = d1 + d3;
- tmp3 = MULTIPLY(d1, FIX(0.211164243));
- tmp2 = MULTIPLY(d3, - FIX(1.451774981));
- z1 = MULTIPLY(d1, FIX(1.061594337));
- z2 = MULTIPLY(d3, - FIX(2.172734803));
- z4 = MULTIPLY(z5, FIX(0.785694958));
- z5 = MULTIPLY(z5, FIX(1.175875602));
-
- tmp0 = z1 - z4;
- tmp1 = z2 + z4;
- tmp2 += z5;
- tmp3 += z5;
- } else {
- /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(d3, - FIX(0.785694958));
- tmp1 = MULTIPLY(d3, - FIX(1.387039845));
- tmp2 = MULTIPLY(d3, - FIX(0.275899379));
- tmp3 = MULTIPLY(d3, FIX(1.175875602));
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(d1, FIX(0.275899379));
- tmp1 = MULTIPLY(d1, FIX(0.785694958));
- tmp2 = MULTIPLY(d1, FIX(1.175875602));
- tmp3 = MULTIPLY(d1, FIX(1.387039845));
- } else {
- /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = tmp1 = tmp2 = tmp3 = 0;
- }
- }
- }
- }
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
- dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
- dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
- dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
- dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
- dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- }
-
- /* Pass 2: process columns. */
- /* Note that we must descale the results by a factor of 8 == 2**3, */
- /* and also undo the PASS1_BITS scaling. */
-
- dataptr = data;
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
- /* Columns of zeroes can be exploited in the same way as we did with rows.
- * However, the row calculation has created many nonzero AC terms, so the
- * simplification applies less often (typically 5% to 10% of the time).
- * On machines with very fast multiplication, it's possible that the
- * test takes more time than it's worth. In that case this section
- * may be commented out.
- */
-
- d0 = dataptr[DCTSIZE*0];
- d1 = dataptr[DCTSIZE*1];
- d2 = dataptr[DCTSIZE*2];
- d3 = dataptr[DCTSIZE*3];
- d4 = dataptr[DCTSIZE*4];
- d5 = dataptr[DCTSIZE*5];
- d6 = dataptr[DCTSIZE*6];
- d7 = dataptr[DCTSIZE*7];
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
- if (d6) {
- if (d4) {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp0 = d4 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp2 - tmp0;
- tmp12 = -(tmp0 + tmp2);
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, - FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, -FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp0 = d4 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp2 - tmp0;
- tmp12 = -(tmp0 + tmp2);
- }
- }
- } else {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp0 = d0 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
-
- tmp10 = tmp3;
- tmp13 = -tmp3;
- tmp11 = tmp2;
- tmp12 = -tmp2;
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, - FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp0 = d0 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
- } else {
- /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
- tmp2 = MULTIPLY(d6, - FIX(1.306562965));
- tmp3 = MULTIPLY(d6, FIX(0.541196100));
-
- tmp10 = tmp3;
- tmp13 = -tmp3;
- tmp11 = tmp2;
- tmp12 = -tmp2;
- }
- }
- }
- } else {
- if (d4) {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp0 = d4 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp2 - tmp0;
- tmp12 = -(tmp0 + tmp2);
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
- tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
- } else {
- /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = d4 << CONST_BITS;
- tmp11 = tmp12 = -tmp10;
- }
- }
- } else {
- if (d2) {
- if (d0) {
- /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp0 = d0 << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp0 + tmp2;
- tmp12 = tmp0 - tmp2;
- } else {
- /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX(0.541196100));
- tmp3 = MULTIPLY(d2, FIX(1.306562965));
-
- tmp10 = tmp3;
- tmp13 = -tmp3;
- tmp11 = tmp2;
- tmp12 = -tmp2;
- }
- } else {
- if (d0) {
- /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
- tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS;
- } else {
- /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
- tmp10 = tmp13 = tmp11 = tmp12 = 0;
- }
- }
- }
- }
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
- if (d7) {
- if (d5) {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z2 = d5 + d3;
- z3 = d7 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(z1, - FIX(0.899976223));
- z2 = MULTIPLY(z2, - FIX(2.562915447));
- z3 = MULTIPLY(z3, - FIX(1.961570560));
- z4 = MULTIPLY(z4, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
- z1 = d7;
- z2 = d5 + d3;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- z1 = MULTIPLY(d7, - FIX(0.899976223));
- z2 = MULTIPLY(z2, - FIX(2.562915447));
- z3 = MULTIPLY(z3, - FIX(1.961570560));
- z4 = MULTIPLY(d5, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 = z1 + z4;
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
- z1 = d7 + d1;
- z2 = d5;
- z3 = d7;
- z4 = d5 + d1;
- z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(z1, - FIX(0.899976223));
- z2 = MULTIPLY(d5, - FIX(2.562915447));
- z3 = MULTIPLY(d7, - FIX(1.961570560));
- z4 = MULTIPLY(z4, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 = z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
- tmp0 = MULTIPLY(d7, - FIX(0.601344887));
- z1 = MULTIPLY(d7, - FIX(0.899976223));
- z3 = MULTIPLY(d7, - FIX(1.961570560));
- tmp1 = MULTIPLY(d5, - FIX(0.509795578));
- z2 = MULTIPLY(d5, - FIX(2.562915447));
- z4 = MULTIPLY(d5, - FIX(0.390180644));
- z5 = MULTIPLY(d5 + d7, FIX(1.175875602));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z3;
- tmp1 += z4;
- tmp2 = z2 + z3;
- tmp3 = z1 + z4;
- }
- }
- } else {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z3 = d7 + d3;
- z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
-
- tmp0 = MULTIPLY(d7, FIX(0.298631336));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(z1, - FIX(0.899976223));
- z2 = MULTIPLY(d3, - FIX(2.562915447));
- z3 = MULTIPLY(z3, - FIX(1.961570560));
- z4 = MULTIPLY(d1, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 = z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
- z3 = d7 + d3;
-
- tmp0 = MULTIPLY(d7, - FIX(0.601344887));
- z1 = MULTIPLY(d7, - FIX(0.899976223));
- tmp2 = MULTIPLY(d3, FIX(0.509795579));
- z2 = MULTIPLY(d3, - FIX(2.562915447));
- z5 = MULTIPLY(z3, FIX(1.175875602));
- z3 = MULTIPLY(z3, - FIX(0.785694958));
-
- tmp0 += z3;
- tmp1 = z2 + z5;
- tmp2 += z3;
- tmp3 = z1 + z5;
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
- z1 = d7 + d1;
- z5 = MULTIPLY(z1, FIX(1.175875602));
-
- z1 = MULTIPLY(z1, FIX(0.275899379));
- z3 = MULTIPLY(d7, - FIX(1.961570560));
- tmp0 = MULTIPLY(d7, - FIX(1.662939224));
- z4 = MULTIPLY(d1, - FIX(0.390180644));
- tmp3 = MULTIPLY(d1, FIX(1.111140466));
-
- tmp0 += z1;
- tmp1 = z4 + z5;
- tmp2 = z3 + z5;
- tmp3 += z1;
- } else {
- /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
- tmp0 = MULTIPLY(d7, - FIX(1.387039845));
- tmp1 = MULTIPLY(d7, FIX(1.175875602));
- tmp2 = MULTIPLY(d7, - FIX(0.785694958));
- tmp3 = MULTIPLY(d7, FIX(0.275899379));
- }
- }
- }
- } else {
- if (d5) {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
- z4 = d5 + d1;
- z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
-
- tmp1 = MULTIPLY(d5, FIX(2.053119869));
- tmp2 = MULTIPLY(d3, FIX(3.072711026));
- tmp3 = MULTIPLY(d1, FIX(1.501321110));
- z1 = MULTIPLY(d1, - FIX(0.899976223));
- z2 = MULTIPLY(z2, - FIX(2.562915447));
- z3 = MULTIPLY(d3, - FIX(1.961570560));
- z4 = MULTIPLY(z4, - FIX(0.390180644));
-
- z3 += z5;
- z4 += z5;
-
- tmp0 = z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
- } else {
- /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
- z2 = d5 + d3;
-
- z5 = MULTIPLY(z2, FIX(1.175875602));
- tmp1 = MULTIPLY(d5, FIX(1.662939225));
- z4 = MULTIPLY(d5, - FIX(0.390180644));
- z2 = MULTIPLY(z2, - FIX(1.387039845));
- tmp2 = MULTIPLY(d3, FIX(1.111140466));
- z3 = MULTIPLY(d3, - FIX(1.961570560));
-
- tmp0 = z3 + z5;
- tmp1 += z2;
- tmp2 += z2;
- tmp3 = z4 + z5;
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
- z4 = d5 + d1;
-
- z5 = MULTIPLY(z4, FIX(1.175875602));
- z1 = MULTIPLY(d1, - FIX(0.899976223));
- tmp3 = MULTIPLY(d1, FIX(0.601344887));
- tmp1 = MULTIPLY(d5, - FIX(0.509795578));
- z2 = MULTIPLY(d5, - FIX(2.562915447));
- z4 = MULTIPLY(z4, FIX(0.785694958));
-
- tmp0 = z1 + z5;
- tmp1 += z4;
- tmp2 = z2 + z5;
- tmp3 += z4;
- } else {
- /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
- tmp0 = MULTIPLY(d5, FIX(1.175875602));
- tmp1 = MULTIPLY(d5, FIX(0.275899380));
- tmp2 = MULTIPLY(d5, - FIX(1.387039845));
- tmp3 = MULTIPLY(d5, FIX(0.785694958));
- }
- }
- } else {
- if (d3) {
- if (d1) {
- /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
- z5 = d1 + d3;
- tmp3 = MULTIPLY(d1, FIX(0.211164243));
- tmp2 = MULTIPLY(d3, - FIX(1.451774981));
- z1 = MULTIPLY(d1, FIX(1.061594337));
- z2 = MULTIPLY(d3, - FIX(2.172734803));
- z4 = MULTIPLY(z5, FIX(0.785694958));
- z5 = MULTIPLY(z5, FIX(1.175875602));
-
- tmp0 = z1 - z4;
- tmp1 = z2 + z4;
- tmp2 += z5;
- tmp3 += z5;
- } else {
- /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(d3, - FIX(0.785694958));
- tmp1 = MULTIPLY(d3, - FIX(1.387039845));
- tmp2 = MULTIPLY(d3, - FIX(0.275899379));
- tmp3 = MULTIPLY(d3, FIX(1.175875602));
- }
- } else {
- if (d1) {
- /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = MULTIPLY(d1, FIX(0.275899379));
- tmp1 = MULTIPLY(d1, FIX(0.785694958));
- tmp2 = MULTIPLY(d1, FIX(1.175875602));
- tmp3 = MULTIPLY(d1, FIX(1.387039845));
- } else {
- /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
- tmp0 = tmp1 = tmp2 = tmp3 = 0;
- }
- }
- }
- }
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
- CONST_BITS+PASS1_BITS+3);
-
- dataptr++; /* advance pointer to next column */
- }
-}
-
-#else
-
-
-void
-j_rev_dct_sparse (DCTBLOCK data, int pos)
-{
- j_rev_dct(data);
-}
-
-void
-j_rev_dct (DCTBLOCK data)
-{
- INT32 tmp0, tmp1, tmp2, tmp3;
- INT32 tmp10, tmp11, tmp12, tmp13;
- INT32 z1, z2, z3, z4, z5;
- register DCTELEM *dataptr;
- int rowctr;
- SHIFT_TEMPS
-
- /* Pass 1: process rows. */
- /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
- /* furthermore, we scale the results by 2**PASS1_BITS. */
-
- dataptr = data;
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
- /* Due to quantization, we will usually find that many of the input
- * coefficients are zero, especially the AC terms. We can exploit this
- * by short-circuiting the IDCT calculation for any row in which all
- * the AC terms are zero. In that case each output is equal to the
- * DC coefficient (with scale factor as needed).
- * With typical images and quantization tables, half or more of the
- * row DCT calculations can be simplified this way.
- */
-
- if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
- dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
- /* AC terms all zero */
- DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS);
-
- dataptr[0] = dcval;
- dataptr[1] = dcval;
- dataptr[2] = dcval;
- dataptr[3] = dcval;
- dataptr[4] = dcval;
- dataptr[5] = dcval;
- dataptr[6] = dcval;
- dataptr[7] = dcval;
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- continue;
- }
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
-
- z2 = (INT32) dataptr[2];
- z3 = (INT32) dataptr[6];
-
- z1 = MULTIPLY(z2 + z3, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(z3, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(z2, FIX(0.765366865));
-
- tmp0 = ((INT32) dataptr[0] + (INT32) dataptr[4]) << CONST_BITS;
- tmp1 = ((INT32) dataptr[0] - (INT32) dataptr[4]) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
-
- tmp0 = (INT32) dataptr[7];
- tmp1 = (INT32) dataptr[5];
- tmp2 = (INT32) dataptr[3];
- tmp3 = (INT32) dataptr[1];
-
- z1 = tmp0 + tmp3;
- z2 = tmp1 + tmp2;
- z3 = tmp0 + tmp2;
- z4 = tmp1 + tmp3;
- z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */
-
- tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = MULTIPLY(tmp3, FIX(1.501321110)); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX(0.899976223)); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
- dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
- dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
- dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
- dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
- dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
-
- dataptr += DCTSIZE; /* advance pointer to next row */
- }
-
- /* Pass 2: process columns. */
- /* Note that we must descale the results by a factor of 8 == 2**3, */
- /* and also undo the PASS1_BITS scaling. */
-
- dataptr = data;
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
- /* Columns of zeroes can be exploited in the same way as we did with rows.
- * However, the row calculation has created many nonzero AC terms, so the
- * simplification applies less often (typically 5% to 10% of the time).
- * On machines with very fast multiplication, it's possible that the
- * test takes more time than it's worth. In that case this section
- * may be commented out.
- */
-
-#ifndef NO_ZERO_COLUMN_TEST
- if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] |
- dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
- dataptr[DCTSIZE*7]) == 0) {
- /* AC terms all zero */
- DCTELEM dcval = (DCTELEM) DESCALE((INT32) dataptr[0], PASS1_BITS+3);
-
- dataptr[DCTSIZE*0] = dcval;
- dataptr[DCTSIZE*1] = dcval;
- dataptr[DCTSIZE*2] = dcval;
- dataptr[DCTSIZE*3] = dcval;
- dataptr[DCTSIZE*4] = dcval;
- dataptr[DCTSIZE*5] = dcval;
- dataptr[DCTSIZE*6] = dcval;
- dataptr[DCTSIZE*7] = dcval;
-
- dataptr++; /* advance pointer to next column */
- continue;
- }
-#endif
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
-
- z2 = (INT32) dataptr[DCTSIZE*2];
- z3 = (INT32) dataptr[DCTSIZE*6];
-
- z1 = MULTIPLY(z2 + z3, FIX(0.541196100));
- tmp2 = z1 + MULTIPLY(z3, - FIX(1.847759065));
- tmp3 = z1 + MULTIPLY(z2, FIX(0.765366865));
-
- tmp0 = ((INT32) dataptr[DCTSIZE*0] + (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
- tmp1 = ((INT32) dataptr[DCTSIZE*0] - (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- /* Odd part per figure 8; the matrix is unitary and hence its
- * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
- */
-
- tmp0 = (INT32) dataptr[DCTSIZE*7];
- tmp1 = (INT32) dataptr[DCTSIZE*5];
- tmp2 = (INT32) dataptr[DCTSIZE*3];
- tmp3 = (INT32) dataptr[DCTSIZE*1];
-
- z1 = tmp0 + tmp3;
- z2 = tmp1 + tmp2;
- z3 = tmp0 + tmp2;
- z4 = tmp1 + tmp3;
- z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */
-
- tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = MULTIPLY(tmp3, FIX(1.501321110)); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX(0.899976223)); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */
-
- z3 += z5;
- z4 += z5;
-
- tmp0 += z1 + z3;
- tmp1 += z2 + z4;
- tmp2 += z2 + z3;
- tmp3 += z1 + z4;
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
- CONST_BITS+PASS1_BITS+3);
-
- dataptr++; /* advance pointer to next column */
- }
-}
-
-
-#endif
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp
deleted file mode 100644
index 716648959b6..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* This file contains C code to implement an ordered dither. */
-
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, mb_ordered, "$Id$")
-
-#define DITH_SIZE 16
-
-
-/* Structures used to implement macroblock ordered
- dither algorithm.
-*/
-
-static unsigned char ***ditherPtr[DITH_SIZE];
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitMBOrderedDither--
- *
- * Structures intialized for ordered dithering.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitMBOrderedDither()
-{
- unsigned char ****pos_2_cb;
- unsigned char ***cb_2_cr;
- unsigned char **cr_2_l;
- int cb_val, cb_rval, cr_val, cr_rval, l_val, l_rval;
- int i, j, pos;
- int err_range, threshval;
-
- pos_2_cb = (unsigned char ****) ACE_OS::malloc (DITH_SIZE*sizeof(unsigned char ***));
- cb_2_cr = (unsigned char ***) ACE_OS::malloc(CB_RANGE*sizeof(unsigned char **));
- cr_2_l = (unsigned char **) ACE_OS::malloc(CR_RANGE*sizeof(unsigned char *));
-
- for (pos=0; pos<DITH_SIZE; pos++) {
-
- pos_2_cb[pos] = (unsigned char ***) ACE_OS::malloc(256*(sizeof(unsigned char **)));
-
- for (j=0; j<CB_RANGE; j++) {
- cb_2_cr[j] = (unsigned char **) ACE_OS::malloc(256*(sizeof(unsigned char *)));
- }
-
- for (cb_val=0; cb_val<cb_values[0]; cb_val++) {
- (pos_2_cb[pos])[cb_val] = cb_2_cr[0];
- }
-
- for (cb_rval=0; cb_rval<(CB_RANGE-1); cb_rval++) {
- err_range = cb_values[cb_rval+1] - cb_values[cb_rval];
- threshval = ((pos*err_range)/DITH_SIZE)+cb_values[cb_rval];
-
- for (cb_val=cb_values[cb_rval]; cb_val<cb_values[cb_rval+1]; cb_val++) {
- if (cb_val>threshval) (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval+1];
- else (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval];
- }
- }
-
- for (cb_val=cb_values[CB_RANGE-1]; cb_val<256; cb_val++) {
- (pos_2_cb[pos])[cb_val] = cb_2_cr[CB_RANGE-1];
- }
-
- for (cb_rval=0; cb_rval<CB_RANGE; cb_rval++) {
-
- for (j=0; j<CR_RANGE; j++) {
- cr_2_l[j] = (unsigned char *) ACE_OS::malloc(256*(sizeof(unsigned char)));
- }
-
- for (cr_val=0; cr_val < cr_values[0]; cr_val++) {
- (cb_2_cr[cb_rval])[cr_val] = cr_2_l[0];
- }
-
- for (cr_rval=0; cr_rval<(CR_RANGE-1); cr_rval++) {
- err_range = cr_values[cr_rval+1] - cr_values[cr_rval];
- threshval = ((pos*err_range)/DITH_SIZE)+cr_values[cr_rval];
-
- for (cr_val=cr_values[cr_rval]; cr_val<cr_values[cr_rval+1]; cr_val++) {
- if (cr_val>threshval) (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval+1];
- else (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval];
- }
- }
-
- for (cr_val=cr_values[CR_RANGE-1]; cr_val<256; cr_val++) {
- (cb_2_cr[cb_rval])[cr_val] = cr_2_l[CR_RANGE-1];
- }
-
- for (cr_rval=0; cr_rval<CR_RANGE; cr_rval++) {
-
- for (l_val = 0; l_val < lum_values[0]; l_val++) {
- (cr_2_l[cr_rval])[l_val] = pixel[cb_rval+(cr_rval*CB_RANGE)+
- (0*CR_RANGE*CB_RANGE)];
- }
-
- for (l_rval=0; l_rval<(LUM_RANGE-1); l_rval++) {
- err_range = lum_values[l_rval+1] - lum_values[l_rval];
- threshval = ((pos*err_range) /DITH_SIZE) + lum_values[l_rval];
-
- for (l_val = lum_values[l_rval]; l_val < lum_values[l_rval+1]; l_val++) {
- if (l_val>threshval) (cr_2_l[cr_rval])[l_val] =
- pixel[cb_rval+(cr_rval*CB_RANGE)+((l_rval+1)*CR_RANGE*CB_RANGE)];
- else (cr_2_l[cr_rval])[l_val] =
- pixel[cb_rval+(cr_rval*CB_RANGE)+(l_rval*CR_RANGE*CB_RANGE)];
- }
- }
-
- for (l_val = lum_values[LUM_RANGE-1]; l_val < 256; l_val++) {
- (cr_2_l[cr_rval])[l_val] =
- pixel[cb_rval+(cr_rval*CB_RANGE)+((LUM_RANGE-1)*CR_RANGE*CB_RANGE)];
- }
- }
- }
- }
-
- for (i=0; i<DITH_SIZE; i++) {
- ditherPtr[i] = pos_2_cb[i];
- }
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * MBOrderedDitherImage --
- *
- * Dithers an image using an ordered dither at macroblock level.
- * Assumptions made:
- * 1) The color space is allocated y:cr:cb = 8:4:4
- * 2) The spatial resolution of y:cr:cb is 4:1:1
- * The channels are dithered based on the standard
- * ordered dither pattern for a 4x4 area.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-MBOrderedDitherImage (unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- unsigned char *l, *r, *b, *o1, *o2;
- unsigned char *l2;
- unsigned char L, R, B;
- int i, j, mbaddr, mbwidth;
- unsigned char ***dp0 = ditherPtr[0];
- unsigned char ***dp2 = ditherPtr[2];
- unsigned char ***dp4 = ditherPtr[4];
- unsigned char ***dp6 = ditherPtr[6];
- unsigned char ***dp8 = ditherPtr[8];
- unsigned char ***dp10 = ditherPtr[10];
- unsigned char ***dp12 = ditherPtr[12];
- unsigned char ***dp14 = ditherPtr[14];
- unsigned char ***dp1 = ditherPtr[1];
- unsigned char ***dp3 = ditherPtr[3];
- unsigned char ***dp5 = ditherPtr[5];
- unsigned char ***dp7 = ditherPtr[7];
- unsigned char ***dp9 = ditherPtr[9];
- unsigned char ***dp11 = ditherPtr[11];
- unsigned char ***dp13 = ditherPtr[13];
- unsigned char ***dp15 = ditherPtr[15];
-
- l = lum;
- l2 = lum + w;
- r = cr;
- b = cb;
- o1 = out;
- o2 = out+w;
- mbwidth = w / 16;
-
- for (i=0; i<h; i+=4) {
-
- mbaddr = (i / 16) * mbwidth ;
-
- for (j=0; j<w; j+=8) {
-
- if (ditherFlags[mbaddr+(j/16)]) {
- R = r[0]; B = b[0];
-
- L = l[0];
- o1[0] = ((dp0[B])[R])[L];
- L = l[1];
- o1[1] = ((dp8[B])[R])[L];
- L = l2[0];
- o2[0] = ((dp12[B])[R])[L];
- L = l2[1];
- o2[1] = ((dp4[B])[R])[L];
-
- R = r[1]; B = b[1];
-
- L = l[2];
- o1[2] = ((dp2[B])[R])[L];
- L = l[3];
- o1[3] = ((dp10[B])[R])[L];
- L = l2[2];
- o2[2] = ((dp14[B])[R])[L];
- L = l2[3];
- o2[3] = ((dp6[B])[R])[L];
-
- R = r[2]; B = b[2];
-
- L = l[4];
- o1[4] = ((dp0[B])[R])[L];
- L = l[5];
- o1[5] = ((dp8[B])[R])[L];
- L = l2[4];
- o2[4] = ((dp12[B])[R])[L];
- L = l2[5];
- o2[5] = ((dp4[B])[R])[L];
-
- R = r[3]; B = b[3];
-
- L = l[6];
- o1[6] = ((dp2[B])[R])[L];
- L = l[7];
- o1[7] = ((dp10[B])[R])[L];
- L = l2[6];
- o2[6] = ((dp14[B])[R])[L];
- L = l2[7];
- o2[7] = ((dp6[B])[R])[L];
- }
-
- l += 8;
- l2 += 8;
- r += 4;
- b += 4;
- o1 += 8;
- o2 += 8;
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
-
- for (j=0; j<w; j+=8) {
-
- if (ditherFlags[mbaddr+(j/16)]) {
-
- R = r[0]; B = b[0];
-
- L = l[0];
- o1[0] = ((dp3[B])[R])[L];
- L = l[1];
- o1[1] = ((dp11[B])[R])[L];
- L = l2[0];
- o2[0] = ((dp15[B])[R])[L];
- L = l2[1];
- o2[1] = ((dp7[B])[R])[L];
-
- R = r[1]; B = b[1];
-
- L = l[2];
- o1[2] = ((dp1[B])[R])[L];
- L = l[3];
- o1[3] = ((dp9[B])[R])[L];
- L = l2[2];
- o2[2] = ((dp13[B])[R])[L];
- L = l2[3];
- o2[3] = ((dp5[B])[R])[L];
-
- R = r[2]; B = b[2];
-
- L = l[4];
- o1[4] = ((dp3[B])[R])[L];
- L = l[5];
- o1[5] = ((dp11[B])[R])[L];
- L = l2[4];
- o2[4] = ((dp15[B])[R])[L];
- L = l2[5];
- o2[5] = ((dp7[B])[R])[L];
-
- R = r[3]; B = b[3];
-
- L = l[6];
- o1[6] = ((dp1[B])[R])[L];
- L = l[7];
- o1[7] = ((dp9[B])[R])[L];
- L = l2[6];
- o2[6] = ((dp13[B])[R])[L];
- L = l2[7];
- o2[7] = ((dp5[B])[R])[L];
- }
-
- l += 8;
- l2 += 8;
- r += 4;
- b += 4;
- o1 += 8;
- o2 += 8;
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
- }
-}
-
-void
-MBOrderedDitherDisplayCopy(VidStream *vid_stream, int mb_addr,
- int motion_forw, int r_right_forw, int r_down_forw,
- int motion_back, int r_right_back, int r_down_back,
- unsigned char *past, unsigned char *future)
-{
- int right_back, right_forw, down_back, down_forw;
- unsigned char *dest = NULL;
- unsigned char *src1, *src2;
- int row, col, row_size, rr;
- int mc, mr;
-
- row = (mb_addr / vid_stream->mb_width) << 4;
- col = (mb_addr % vid_stream->mb_width) << 4;
- row_size = vid_stream->mb_width << 4;
-/*
- dest = vid_stream->current->display + (row * row_size) + col;
-*/
- if (motion_forw) {
- right_forw = r_right_forw >> 1;
- down_forw = r_down_forw >> 1;
- src1 = past + ((row + down_forw) * row_size) + (col + right_forw);
- }
-
- if (motion_back) {
- right_back = r_right_back >> 1;
- down_back = r_down_back >> 1;
- src2 = future + ((row + down_back) * row_size) + (col + right_back);
- }
-
- if (motion_forw) {
- if (motion_back) {
- for (rr = 0; rr<16; rr++) {
- dest[0] = src1[0]; dest[1] = src2[1];
- dest[2] = src1[2]; dest[3] = src2[3];
- dest[4] = src1[4]; dest[5] = src2[5];
- dest[6] = src1[6]; dest[7] = src2[7];
- dest[8] = src1[8]; dest[9] = src2[9];
- dest[10] = src1[10]; dest[11] = src2[11];
- dest[12] = src1[12]; dest[13] = src2[13];
- dest[14] = src1[14]; dest[15] = src2[15];
-
- dest += row_size;
- src1 += row_size;
- src2 += row_size;
- }
- }
- else {
- mc = col & 0x3;
- mr = right_forw & 0x3;
- if (!mc && !mr) {
- /* Use 32 bit copy */
- int *d, *s;
-
- d = (int *) dest;
- s = (int *) src1;
- row_size /= 4;
-
- for (rr = 0; rr < 16; rr++) {
- d[0] = s[0];
- d[1] = s[1];
- d[2] = s[2];
- d[3] = s[3];
- d += row_size;
- s += row_size;
- }
- } else if ((!mc || (mc == 2)) &&
- (!mr || (mr == 2))) {
- /* Use 16 bit copy */
- short int *d, * s;
-
- d = (short int *) dest;
- s = (short int *) src1;
- row_size /= 2;
-
- for (rr = 0; rr < 16; rr++) {
- d[0] = s[0];
- d[1] = s[1];
- d[2] = s[2];
- d[3] = s[3];
- d[4] = s[4];
- d[5] = s[5];
- d[6] = s[6];
- d[7] = s[7];
- d += row_size;
- s += row_size;
- }
- }
- else {
- for (rr = 0; rr < 16; rr++) {
- dest[0] = src1[0];
- dest[1] = src1[1];
- dest[2] = src1[2];
- dest[3] = src1[3];
- dest[4] = src1[4];
- dest[5] = src1[5];
- dest[6] = src1[6];
- dest[7] = src1[7];
- dest[8] = src1[8];
- dest[9] = src1[9];
- dest[10] = src1[10];
- dest[11] = src1[11];
- dest[12] = src1[12];
- dest[13] = src1[13];
- dest[14] = src1[14];
- dest[15] = src1[15];
-
- dest += row_size;
- src1 += row_size;
- }
- }
- }
- }
- else if (motion_back) {
- mc = col & 0x3;
- mr = right_back & 0x3;
- if (!mc && !mr) {
- /* Use 32 bit copy */
- int *d, *s;
-
- d = (int *) dest;
- s = (int *) src2;
- row_size /= 4;
-
- for (rr = 0; rr < 16; rr++) {
- d[0] = s[0];
- d[1] = s[1];
- d[2] = s[2];
- d[3] = s[3];
- d += row_size;
- s += row_size;
- }
- }
- else if ((!mc || mc == 2) &&
- (!mr || mr == 2)) {
- /* Use 8 bit copy */
- short int *d, *s;
-
- d = (short int *) dest;
- s = (short int *) src2;
- row_size /= 2;
-
- for (rr = 0; rr < 16; rr++) {
- d[0] = s[0];
- d[1] = s[1];
- d[2] = s[2];
- d[3] = s[3];
- d[4] = s[4];
- d[5] = s[5];
- d[6] = s[6];
- d[7] = s[7];
- d += row_size;
- s += row_size;
- }
- }
- else {
- for (rr = 0; rr < 16; rr++) {
- /* Use 8 bit copy */
- dest[0] = src2[0];
- dest[1] = src2[1];
- dest[2] = src2[2];
- dest[3] = src2[3];
- dest[4] = src2[4];
- dest[5] = src2[5];
- dest[6] = src2[6];
- dest[7] = src2[7];
- dest[8] = src2[8];
- dest[9] = src2[9];
- dest[10] = src2[10];
- dest[11] = src2[11];
- dest[12] = src2[12];
- dest[13] = src2[13];
- dest[14] = src2[14];
- dest[15] = src2[15];
-
- dest += row_size;
- src2 += row_size;
- }
- }
- }
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h
deleted file mode 100644
index 085d1802ce0..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $Id$ */
-/* Copyright (c) 1994 The Geometry Center; University of Minnesota
- 1300 South Second Street; Minneapolis, MN 55454, USA;
-
-This file is free software; you can redistribute it and/or modify it only
-under the the terms of the GNU GENERAL PUBLIC LICENSE which should be
-included along with this file. This software may be obtained via anonymous
-ftp from geom.umn.edu; email: software@geom.umn.edu. */
-
-/* Author: Daeron Meyer */
-
-#include <stdio.h>
-#include <X11/Intrinsic.h>
-#include <X11/Shell.h>
-#include <Xm/Xm.h>
-#include <Xm/Text.h>
-#include <Xm/TextF.h>
-#include <Xm/RowColumn.h>
-#include <Xm/MainW.h>
-#include <Xm/Label.h>
-#include <Xm/PushB.h>
-#include <Xm/PushBG.h>
-#include <Xm/ToggleB.h>
-#include <Xm/ToggleBG.h>
-#include <Xm/DrawingA.h>
-#include <Xm/CascadeBG.h>
-#include <Xm/SeparatoG.h>
-#include <Xm/Frame.h>
-#include <Xm/BulletinB.h>
-#include <Xm/Scale.h>
-#include <Xm/ScrollBar.h>
-#include <Xm/Form.h>
-#include <Xm/List.h>
-#include <Xm/FileSB.h>
-#include <Xm/AtomMgr.h>
-#include <Xm/Protocols.h>
-#include <Xm/MwmUtil.h>
-
-
-/* Structure of mib_Widget */
-/*****************************************************************************/
-
-typedef struct _mib_Widget {
- char *mib_class; /* name of mib class (Button, TextBox, etc..)*/
- int mib_class_num; /* class number for ez reference :) */
- int mib_mynum; /* numbering for storage format */
- Widget me; /* Xt widget */
- int mib_selected; /* is selected */
- int mib_resizing; /* is resizing 1, or being moved 0 */
- int mib_resizetype;/* 1 = upper left, 2 = upper, 3 = ... */
- int mib_allowresize; /* can this widget be resized ? */
-
- int clkx, clky; /* where user clicked */
-
- void *myres; /* my resources (different for each widget) */
-
- char *name; /* reference name of this widget */
- int width, height; /* width and height */
-
- int topAttachment, bottomAttachment, leftAttachment, rightAttachment;
- /* attachments 1=attached 0=not-attached */
-
- int topOffset, bottomOffset, leftOffset, rightOffset;
- /* offsets if attached */
-
- struct _mib_Widget *parent; /* pointer to parent */
- struct _mib_Widget *sibling; /* remaining linked list of sibling widgets */
- struct _mib_Widget *prev; /* previous sibling or parent */
- struct _mib_Widget *child; /* linked list of children widgets */
-} mib_Widget;
-
-/* mib_Buffer structure */
-/*****************************************************************************/
-
-typedef struct _mib_Buffer {
- void *buffer; /* pointer to either a file or a char string */
- int buf_type; /* type of buffer (defined above) */
- int point; /* pointer for string */
- int buflen; /* length of string buffer */
-} mib_Buffer;
-
-/* mib_Widget functions */
-/*****************************************************************************/
-
-void mib_add_mib_Widget(mib_Widget *, mib_Widget *);
-void mib_add_backward_Widget(mib_Widget *, mib_Widget *);
-void mib_remove_mib_Widget(mib_Widget *);
-void mib_clear_myres(mib_Widget *);
-mib_Widget *mib_new_mib_Widget();
-mib_Widget *mib_find_name(mib_Widget *, char *);
-mib_Widget *mib_load_interface(Widget, char *, int);
-int mib_count_all(mib_Widget *, int);
-int mib_load_Root(Widget, mib_Widget **, mib_Buffer *);
-mib_Widget *mib_load_public(mib_Widget *, mib_Widget *, mib_Buffer *);
-int mib_load_mib_class(mib_Widget **, mib_Widget *, char *, char *,
- mib_Buffer *);
-int mib_load_private(mib_Widget *, mib_Buffer *);
-void mib_reset_size(mib_Widget *);
-int mib_read_line(mib_Buffer *, char *, char *);
-void mib_set_eventhandlers(void *, void *, void *);
-void mib_apply_eventhandlers(Widget, mib_Widget *);
-
-/* supporting functions and structures */
-/*****************************************************************************/
-
-typedef struct _menu_item {
- char *label;
- WidgetClass *class;
- char mnemonic;
- char *accelerator;
- char *accel_text;
- void (*callback)();
- XtPointer callback_data;
- struct _menu_item *subitems;
-} MenuItem;
-
-Widget BuildMenu(Widget, int, char *, char, MenuItem *);
-
-/* mib class numbers */
-
-#define MIB_NULL 0
-#define MIB_TEXTBOX 1
-#define MIB_BUTTON 2
-#define MIB_TOGGLE 3
-#define MIB_RADIOBOX 4
-#define MIB_DRAWINGAREA 5
-#define MIB_LABEL 6
-#define MIB_FRAME 7
-#define MIB_SCROLLBAR 8
-#define MIB_TEXTBIG 9
-#define MIB_LIST 10
-#define MIB_SCALE 11
-#define MIB_MENU 12
-
-/* number of classes */
-#define MI_NUMCLASSES 12
-
-/* for specifying creation of a widget with
- default private values, no values at all (empty),
- or no values and editable */
-
-#define WDEFAULT 1
-#define WEMPTY 2
-#define WEDIT 3
-
-/* for specifing whether we are loading an
- interface from a file or from a string and whether it
- is editable :) */
-
-#define MI_FROMFILE 1
-#define MI_EDITFROMFILE 2
-#define MI_FROMSTRING 3
-#define MI_EDITFROMSTRING 4
-
-#define MI_MAXSTRLEN 200 /* maximum string length */
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp
deleted file mode 100644
index 879de356059..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $Id$ */
-
-/*
- * Author: Yoichiro Ueno (ueno@cs.titech.ac.jp)
- *
- * Copyright (C) 1991, 1992, Yoichiro Ueno.
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose is hereby granted by the Author without
- * fee, provided that the above copyright notice appear in all copies and
- * that both the copyright notice and this permission notice appear in
- * supporting documentation, and that the name of the Author not be used
- * in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. The Author makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, mono, "$Id$")
-
-/*
- *--------------------------------------------------------------
- *
- * MonoDitherImage --
- *
- * Dithers image into monochrome.
- * Dither algorithm is based on dither.c in xli.1.11.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-#define MaxGrey 65280
-#define Threshold (MaxGrey/2)
-#define MinGrey 0
-
-#if ultrix && mips
-# define SEED_BIT 0x01
-# define OPP_SEED_BIT 0x80
-# define SHIFT_SEED_BIT(b) (b <<= 1)
-# define OPP_SHIFT_SEED_BIT(b) (b >>= 1)
-#else
-# define SEED_BIT 0x80
-# define OPP_SEED_BIT 0x01
-# define SHIFT_SEED_BIT(b) (b >>= 1)
-# define OPP_SHIFT_SEED_BIT(b) (b <<= 1)
-#endif
-
-static int *curr = NULL;
-static int *next = NULL;
-
-#if 0
-void
-MonoDitherImage(register unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- int bit_r2l;
- register unsigned int bit;
- register unsigned int data;
- int i;
- register int j;
- int *swap;
- register int out_err;
- register int next1;
- register int next2;
-
- if(curr == NULL) {
- curr = (int *)ACE_OS::malloc(sizeof(int) * (w + 2));
- curr += 1;
- }
- if(next == NULL) {
- next = (int *)ACE_OS::malloc(sizeof(int) * (w + 2));
- next += 1;
- }
-
- bzero ((char *)curr, w * sizeof(*curr));
-
- bit_r2l = SEED_BIT << (w - 1 & 7);
- for(i = 0; i < h; i ++) {
- if(i & 0x01) { /* Right to Left */
- bit = bit_r2l;
- data = 0;
- out_err = curr[w-1];
- next1 = 0;
- next2 = 0;
- for (j=(w-1); j>=0; j--)
- {
- out_err = (out_err >> 4) + (lum[j] << 8);
- if(out_err > Threshold) {
- data |= bit;
- out_err -= MaxGrey;
- }
- else
- out_err -= MinGrey;
-
- next[j+1] = next1 + (out_err * 3);
- next1 = next2 + (out_err * 5);
- next2 = (out_err * 1);
- out_err = curr[j-1] + (out_err * 7);
-
- OPP_SHIFT_SEED_BIT(bit);
-#if ultrix && mips
- if(bit == 0)
-#else
- if(bit > 0x80)
-#endif
- {
- out[j >> 3] = data;
- bit = OPP_SEED_BIT;
- data = 0;
- }
- }
- next[0] = next1;
- }
- else { /* Left to Right */
- bit = SEED_BIT;
- data = 0;
- out_err = curr[0];
- next1 = 0;
- next2 = 0;
- for (j=0; j<w; j++)
- {
- out_err = (out_err >> 4) + (lum[j] << 8);
- if(out_err > Threshold) {
- data |= bit;
- out_err = out_err - MaxGrey;
- }
- else
- out_err = out_err - MinGrey;
-
- next[j-1] = next1 + (out_err * 3);
- next1 = next2 + (out_err * 5);
- next2 = (out_err * 1);
- out_err = curr[j+1] + (out_err * 7);
-
- SHIFT_SEED_BIT(bit);
-#if ultrix && mips
- if(bit > 0x80)
-#else
- if(bit == 0)
-#endif
- {
- out[j >> 3] = data;
- bit = SEED_BIT;
- data = 0;
- }
- }
- next[w-1] = next1;
- }
-
- lum += w;
- out += w >> 3;
- swap = curr;
- curr = next;
- next = swap;
- }
-}
-#endif
-
-void
-MonoDitherImage(register unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- register unsigned int bit;
- register unsigned int data;
- register int j;
- int i;
- static unsigned char d[4][4] = {{0, 8, 2, 10},
- {12, 4, 14, 6},
- {3, 11, 1, 9},
- {15, 7, 13, 5}};
-
- for(i = 0; i < h; i ++) {
- bit = SEED_BIT;
- data = 0;
- for (j=0; j<w; j++) {
- if((lum[j] >> 4) > d[i % 4][j % 4]) {
- data |= bit;
- }
- SHIFT_SEED_BIT(bit);
-#if ultrix && mips
- if(bit > 0x80)
-#else
- if(bit == 0)
-#endif
- {
- out[j >> 3] = data;
- bit = SEED_BIT;
- data = 0;
- }
- }
- lum += w;
- out += (w + 7) >> 3;
- }
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * MonoThresholdImage --
- *
- * convert image into monochrome with threshold.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-MonoThresholdImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- unsigned char bit;
- unsigned char data;
-
- bit = SEED_BIT;
- data = 0;
- for (w*=h; w>0; w--) {
- if(*lum++>128)
- data |= bit;
-
- SHIFT_SEED_BIT(bit);
- if(bit == 0) {
- *out ++ = data;
- bit = SEED_BIT;
- data = 0;
- }
- }
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp
deleted file mode 100644
index e7a2407cd68..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include "video.h"
-#include "proto.h"
-#include "util.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, motionvector, "$Id$")
-
-
-/*
- *--------------------------------------------------------------
- *
- * ComputeVector --
- *
- * Computes motion vector given parameters previously parsed
- * and reconstructed.
- *
- * Results:
- * Reconstructed motion vector info is put into recon_* parameters
- * passed to this function. Also updated previous motion vector
- * information.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-#define ComputeVector(recon_right_ptr, recon_down_ptr, recon_right_prev, recon_down_prev, f, full_pel_vector, motion_h_code, motion_v_code, motion_h_r, motion_v_r) \
- \
-{ \
- int comp_h_r, comp_v_r; \
- int right_little, right_big, down_little, down_big; \
- int max, min, new_vector; \
- \
- /* The following procedure for the reconstruction of motion vectors \
- is a direct and simple implementation of the instructions given \
- in the mpeg December 1991 standard draft. \
- */ \
- \
- if (f == 1 || motion_h_code == 0) \
- comp_h_r = 0; \
- else \
- comp_h_r = f - 1 - motion_h_r; \
- \
- if (f == 1 || motion_v_code == 0) \
- comp_v_r = 0; \
- else \
- comp_v_r = f - 1 - motion_v_r; \
- \
- right_little = motion_h_code * f; \
- if (right_little == 0) \
- right_big = 0; \
- else { \
- if (right_little > 0) { \
- right_little = right_little - comp_h_r; \
- right_big = right_little - 32 * f; \
- } \
- else { \
- right_little = right_little + comp_h_r; \
- right_big = right_little + 32 * f; \
- } \
- } \
- \
- down_little = motion_v_code * f; \
- if (down_little == 0) \
- down_big = 0; \
- else { \
- if (down_little > 0) { \
- down_little = down_little - comp_v_r; \
- down_big = down_little - 32 * f; \
- } \
- else { \
- down_little = down_little + comp_v_r; \
- down_big = down_little + 32 * f; \
- } \
- } \
- \
- max = 16 * f - 1; \
- min = -16 * f; \
- \
- new_vector = recon_right_prev + right_little; \
- \
- if (new_vector <= max && new_vector >= min) \
- *recon_right_ptr = recon_right_prev + right_little; \
- /* just new_vector */ \
- else \
- *recon_right_ptr = recon_right_prev + right_big; \
- recon_right_prev = *recon_right_ptr; \
- if (full_pel_vector) \
- *recon_right_ptr = *recon_right_ptr << 1; \
- \
- new_vector = recon_down_prev + down_little; \
- if (new_vector <= max && new_vector >= min) \
- *recon_down_ptr = recon_down_prev + down_little; \
- /* just new_vector */ \
- else \
- *recon_down_ptr = recon_down_prev + down_big; \
- recon_down_prev = *recon_down_ptr; \
- if (full_pel_vector) \
- *recon_down_ptr = *recon_down_ptr << 1; \
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ComputeForwVector --
- *
- * Computes forward motion vector by calling ComputeVector
- * with appropriate parameters.
- *
- * Results:
- * Reconstructed motion vector placed in recon_right_for_ptr and
- * recon_down_for_ptr.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-ComputeForwVector(int *recon_right_for_ptr, int *recon_down_for_ptr)
-{
-
- Pict *picture;
- Macroblock *mblock;
-
- picture = &(curVidStream->picture);
- mblock = &(curVidStream->mblock);
-
- ComputeVector(recon_right_for_ptr, recon_down_for_ptr,
- mblock->recon_right_for_prev,
- mblock->recon_down_for_prev,
- picture->forw_f, picture->full_pel_forw_vector,
- mblock->motion_h_forw_code, mblock->motion_v_forw_code,
- mblock->motion_h_forw_r, mblock->motion_v_forw_r);
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * ComputeBackVector --
- *
- * Computes backward motion vector by calling ComputeVector
- * with appropriate parameters.
- *
- * Results:
- * Reconstructed motion vector placed in recon_right_back_ptr and
- * recon_down_back_ptr.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-ComputeBackVector(int *recon_right_back_ptr, int *recon_down_back_ptr)
-{
- Pict *picture;
- Macroblock *mblock;
-
- picture = &(curVidStream->picture);
- mblock = &(curVidStream->mblock);
-
- ComputeVector(recon_right_back_ptr, recon_down_back_ptr,
- mblock->recon_right_back_prev,
- mblock->recon_down_back_prev,
- picture->back_f, picture->full_pel_back_vector,
- mblock->motion_h_back_code, mblock->motion_v_back_code,
- mblock->motion_h_back_r, mblock->motion_v_back_r);
-
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h
deleted file mode 100644
index 9df0e313bbb..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $Id$ */
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-/* ui.c */
-void UIprocess(int cmdSocket);
-
-#include "mpeg_shared/routine.h"
-
-/* ctr.c */
-int CTRmain(int argc,char **argv);
-
-/* ab.c */
-void ABinitBuf(int size);
-void ABflushBuf(int nextSample);
-int ABcheckSamples(void); /* returns # of samples in ABbuf */
-int ABgetSamples(char * buf, int samples);
- /* read at most given number of samples from AB to buf, returns
- number of sample actually read */
-int ABskipSamples(int samples);
-/* if samples < 0; then stuff |samples| silient samples to ABgetSamples(),
- otherwise wipe out this number of samples from AB */
-void ABdeleteBuf(void);
-void ABdeleteSem(void);
-
-void ABprocess(int dataSocket);
-
-/* vb.c */
-void VBinitBuf(int size);
-char * VBgetBuf(int size); /* block version */
-int VBcheckBuf(int size); /* non-block check, return True/False*/
-void VBputMsg(char * msgPtr);
-char * VBgetMsg(); /* block version */
-int VBcheckMsg(); /* non-block check, return Number of Msgs in buffer */
-int VBbufEmpty(void);
-void VBreclaimMsg(char * msgPtr);
-void VBdeleteBuf(void);
-void VBdeleteSem(void);
-
-void VBprocess(int initSocket, int dataSocket);
-
-/* vd.c */
-void VDprocess(int CTRpid);
-void VDinitBuf(int size);
-void VDresizeBuf(int height, int width);
-FrameBlock * VDgetBuf(void); /* block version, return with interrupt */
-int VDcheckBuf(void); /* non-block check, return True/False */
-void VDputMsg(FrameBlock * msgPtr);
-FrameBlock * VDgetMsg(void); /* block version, return with interrupt */
-FrameBlock * VDpeekMsg(void); /* returns a msg for checking only, no modification allowed */
-int VDcheckMsg(void); /* non-block check, return Number of Msg in buffer */
-int VDbufEmpty(void);
-void VDreferMsg(FrameBlock * msgPtr);
-void VDreclaimMsg(FrameBlock * msgPtr);
-void VDdeleteBuf(void);
-void VDdeleteSem(void);
-
-/* vp.c */
-
-void VPinitWindow(Widget shell, Window monitorWindow, int cmdSocket);
-void VPresizeWindow(int height, int width);
-
-/* -- in gdith.c -- */
-void VPcommand(int cmd, char * position);
-void VPexpose(void);
-
-/* audio.c */
-int InitAudioDevice(void);
-void SetAudioParameter(AudioParameter * para);
-unsigned int GetAudioTime(void);
-unsigned int PlayAudioSamples(unsigned int time, char * buf, int size);
-void StartAudioPlaySession(void);
-void SetAudioGain(void);
-void AudioInterpolate(char *rawBuf, int len, char * convBuf, int convLen);
-
-/* prog.c */
-
-void StartProgram(char * title, char * vh, char * vf, char * ah, char * af);
-Widget CreateProgramWindow(Widget parent, int cmdSoket, int * playflag, Widget frametext);
-
-/* file.c */
-
-void StartLocalServer(void);
-Widget CreateFileWindow(Widget parent, int cmdSoket, int * playflag, Widget frametext);
-
-
-/* para.c */
-
-Widget CreateParameterWindow(Widget parent);
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp
deleted file mode 100644
index e62806771b2..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* This file contains C code to implement an ordered dither. */
-
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, ordered, "$Id$")
-
-#define DITH_SIZE 16
-
-
-/* Structures used to implement hybrid ordered dither/floyd-steinberg
- dither algorithm.
-*/
-
-static unsigned char *l_darrays[DITH_SIZE];
-static unsigned char *cr_darrays[DITH_SIZE];
-static unsigned char *cb_darrays[DITH_SIZE];
-
-/*
- *--------------------------------------------------------------
- *
- * InitOrderedDither--
- *
- * Structures intialized for ordered dithering.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitOrderedDither()
-{
- int i, j, k, err_range, threshval;
- unsigned char *lmark, *cmark;
-
- for (i=0; i<DITH_SIZE; i++) {
- lmark = l_darrays[i] = (unsigned char *) ACE_OS::malloc(256);
-
- for (j=0; j<lum_values[0]; j++) {
- *lmark++ = 0;
- }
-
- for (j=0; j<(LUM_RANGE-1); j++) {
- err_range = lum_values[j+1] - lum_values[j];
- threshval = ((i * err_range) / DITH_SIZE)+lum_values[j];
-
- for (k=lum_values[j]; k<lum_values[j+1]; k++) {
- if (k > threshval) *lmark++ = ((j+1) * (CR_RANGE * CB_RANGE));
- else *lmark++ = (j * (CR_RANGE * CB_RANGE));
- }
- }
-
- for (j=lum_values[LUM_RANGE-1]; j<256; j++) {
- *lmark++ = (LUM_RANGE-1)*(CR_RANGE * CB_RANGE);
- }
- }
-
- for (i=0; i<DITH_SIZE; i++) {
- cmark = cr_darrays[i] = (unsigned char *) ACE_OS::malloc(256);
-
- for (j=0; j<cr_values[0]; j++) {
- *cmark++ = 0;
- }
-
- for (j=0; j<(CR_RANGE-1); j++) {
- err_range = cr_values[j+1] - cr_values[j];
- threshval = ((i * err_range) / DITH_SIZE)+cr_values[j];
-
- for (k=cr_values[j]; k<cr_values[j+1]; k++) {
- if (k > threshval) *cmark++ = ((j+1) * CB_RANGE);
- else *cmark++ = (j * CB_RANGE);
- }
- }
-
- for (j=cr_values[CR_RANGE-1]; j<256; j++) {
- *cmark++ = (CR_RANGE-1)*(CB_RANGE);
- }
- }
-
- for (i=0; i<DITH_SIZE; i++) {
- cmark = cb_darrays[i] = (unsigned char *) ACE_OS::malloc(256);
-
- for (j=0; j<cb_values[0]; j++) {
- *cmark++ = 0;
- }
-
- for (j=0; j<(CB_RANGE-1); j++) {
- err_range = cb_values[j+1] - cb_values[j];
- threshval = ((i * err_range) / DITH_SIZE)+cb_values[j];
-
- for (k=cb_values[j]; k<cb_values[j+1]; k++) {
- if (k > threshval) *cmark++ = j+1;
- else *cmark++ = j;
- }
- }
-
- for (j=cb_values[CB_RANGE-1]; j<256; j++) {
- *cmark++ = CB_RANGE-1;
- }
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * OrderedDitherImage --
- *
- * Dithers an image using an ordered dither.
- * Assumptions made:
- * 1) The color space is allocated y:cr:cb = 8:4:4
- * 2) The spatial resolution of y:cr:cb is 4:1:1
- * The channels are dithered based on the standard
- * ordered dither pattern for a 4x4 area.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-OrderedDitherImage (unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- unsigned char *l, *r, *b, *o1, *o2;
- unsigned char *l2;
- unsigned char L, R, B;
- int i, j;
-
- l = lum;
- l2 = lum+w;
- r = cr;
- b = cb;
- o1 = out;
- o2 = out+w;
-
- for (i=0; i<h; i+=4) {
-
- for (j=0; j<w; j+=8) {
-
- R = r[0]; B = b[0];
-
- L = l[0];
- o1[0] = pixel[(l_darrays[0][L] + cr_darrays[0][R] + cb_darrays[0][B])];
- L = l[1];
- o1[1] = pixel[(l_darrays[8][L] + cr_darrays[8][R] + cb_darrays[8][B])];
- L = l2[0];
- o2[0] = pixel[(l_darrays[12][L] + cr_darrays[12][R] + cb_darrays[12][B])];
- L = l2[1];
- o2[1] = pixel[(l_darrays[4][L] + cr_darrays[4][R] + cb_darrays[4][B])];
-
- R = r[1]; B = b[1];
-
- L = l[2];
- o1[2] = pixel[(l_darrays[2][L] + cr_darrays[2][R] + cb_darrays[2][B])];
- L = l[3];
- o1[3] = pixel[(l_darrays[10][L] + cr_darrays[10][R] + cb_darrays[10][B])];
- L = l2[2];
- o2[2] = pixel[(l_darrays[14][L] + cr_darrays[14][R] + cb_darrays[14][B])];
- L = l2[3];
- o2[3] = pixel[(l_darrays[6][L] + cr_darrays[6][R] + cb_darrays[6][B])];
-
- R = r[2]; B = b[2];
-
- L = l[4];
- o1[4] = pixel[(l_darrays[0][L] + cr_darrays[0][R] + cb_darrays[0][B])];
- L = l[5];
- o1[5] = pixel[(l_darrays[8][L] + cr_darrays[8][R] + cb_darrays[8][B])];
- L = l2[4];
- o2[4] = pixel[(l_darrays[12][L] + cr_darrays[12][R] + cb_darrays[12][B])];
- L = l2[5];
- o2[5] = pixel[(l_darrays[4][L] + cr_darrays[4][R] + cb_darrays[4][B])];
-
- R = r[3]; B = b[3];
-
- L = l[6];
- o1[6] = pixel[(l_darrays[2][L] + cr_darrays[2][R] + cb_darrays[2][B])];
- L = l[7];
- o1[7] = pixel[(l_darrays[10][L] + cr_darrays[10][R] + cb_darrays[10][B])];
- L = l2[6];
- o2[6] = pixel[(l_darrays[14][L] + cr_darrays[14][R] + cb_darrays[14][B])];
- L = l2[7];
- o2[7] = pixel[(l_darrays[6][L] + cr_darrays[6][R] + cb_darrays[6][B])];
-
- l += 8;
- l2 += 8;
- r += 4;
- b += 4;
- o1 += 8;
- o2 += 8;
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
-
- for (j=0; j<w; j+=8) {
-
- R = r[0]; B = b[0];
-
- L = l[0];
- o1[0] = pixel[(l_darrays[3][L] + cr_darrays[3][R] + cb_darrays[3][B])];
- L = l[1];
- o1[1] = pixel[(l_darrays[11][L] + cr_darrays[11][R] + cb_darrays[11][B])];
- L = l2[0];
- o2[0] = pixel[(l_darrays[15][L] + cr_darrays[15][R] + cb_darrays[15][B])];
- L = l2[1];
- o2[1] = pixel[(l_darrays[7][L] + cr_darrays[7][R] + cb_darrays[7][B])];
-
- R = r[1]; B = b[1];
-
- L = l[2];
- o1[2] = pixel[(l_darrays[1][L] + cr_darrays[1][R] + cb_darrays[1][B])];
- L = l[3];
- o1[3] = pixel[(l_darrays[9][L] + cr_darrays[9][R] + cb_darrays[9][B])];
- L = l2[2];
- o2[2] = pixel[(l_darrays[13][L] + cr_darrays[13][R] + cb_darrays[13][B])];
- L = l2[3];
- o2[3] = pixel[(l_darrays[5][L] + cr_darrays[5][R] + cb_darrays[5][B])];
-
- R = r[2]; B = b[2];
-
- L = l[4];
- o1[4] = pixel[(l_darrays[3][L] + cr_darrays[3][R] + cb_darrays[3][B])];
- L = l[5];
- o1[5] = pixel[(l_darrays[11][L] + cr_darrays[11][R] + cb_darrays[11][B])];
- L = l2[4];
- o2[4] = pixel[(l_darrays[15][L] + cr_darrays[15][R] + cb_darrays[15][B])];
- L = l2[5];
- o2[5] = pixel[(l_darrays[7][L] + cr_darrays[7][R] + cb_darrays[7][B])];
-
- R = r[3]; B = b[3];
-
- L = l[6];
- o1[6] = pixel[(l_darrays[1][L] + cr_darrays[1][R] + cb_darrays[1][B])];
- L = l[7];
- o1[7] = pixel[(l_darrays[9][L] + cr_darrays[9][R] + cb_darrays[9][B])];
- L = l2[6];
- o2[6] = pixel[(l_darrays[13][L] + cr_darrays[13][R] + cb_darrays[13][B])];
- L = l2[7];
- o2[7] = pixel[(l_darrays[5][L] + cr_darrays[5][R] + cb_darrays[5][B])];
-
- l += 8;
- l2 += 8;
- r += 4;
- b += 4;
- o1 += 8;
- o2 += 8;
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
- }
-}
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp
deleted file mode 100644
index c57d2ba21e1..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* This file contains C code to implement an ordered dither. */
-
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "dither.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, ordered2, "$Id$")
-
-#define DITH_SIZE 16
-
-
-/* Structures used to implement hybrid ordered dither/floyd-steinberg
- dither algorithm.
-*/
-
-static unsigned char ***ditherPtr[DITH_SIZE];
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitOrderedDither--
- *
- * Structures intialized for ordered dithering.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitOrdered2Dither()
-{
- unsigned char ****pos_2_cb;
- unsigned char ***cb_2_cr;
- unsigned char **cr_2_l;
- int cb_val, cb_rval, cr_val, cr_rval, l_val, l_rval;
- int i, j, pos;
- int err_range, threshval;
-
- pos_2_cb = (unsigned char ****) ACE_OS::malloc (DITH_SIZE*sizeof(unsigned char ***));
- cb_2_cr = (unsigned char ***) ACE_OS::malloc(CB_RANGE*sizeof(unsigned char **));
- cr_2_l = (unsigned char **) ACE_OS::malloc(CR_RANGE*sizeof(unsigned char *));
-
- for (pos=0; pos<DITH_SIZE; pos++) {
-
- pos_2_cb[pos] = (unsigned char ***) ACE_OS::malloc(256*(sizeof(unsigned char **)));
-
- for (j=0; j<CB_RANGE; j++) {
- cb_2_cr[j] = (unsigned char **) ACE_OS::malloc(256*(sizeof(unsigned char *)));
- }
-
- for (cb_val=0; cb_val<cb_values[0]; cb_val++) {
- (pos_2_cb[pos])[cb_val] = cb_2_cr[0];
- }
-
- for (cb_rval=0; cb_rval<(CB_RANGE-1); cb_rval++) {
- err_range = cb_values[cb_rval+1] - cb_values[cb_rval];
- threshval = ((pos*err_range)/DITH_SIZE)+cb_values[cb_rval];
-
- for (cb_val=cb_values[cb_rval]; cb_val<cb_values[cb_rval+1]; cb_val++) {
- if (cb_val>threshval) (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval+1];
- else (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval];
- }
- }
-
- for (cb_val=cb_values[CB_RANGE-1]; cb_val<256; cb_val++) {
- (pos_2_cb[pos])[cb_val] = cb_2_cr[CB_RANGE-1];
- }
-
- for (cb_rval=0; cb_rval<CB_RANGE; cb_rval++) {
-
- for (j=0; j<CR_RANGE; j++) {
- cr_2_l[j] = (unsigned char *) ACE_OS::malloc(256*(sizeof(unsigned char)));
- }
-
- for (cr_val=0; cr_val < cr_values[0]; cr_val++) {
- (cb_2_cr[cb_rval])[cr_val] = cr_2_l[0];
- }
-
- for (cr_rval=0; cr_rval<(CR_RANGE-1); cr_rval++) {
- err_range = cr_values[cr_rval+1] - cr_values[cr_rval];
- threshval = ((pos*err_range)/DITH_SIZE)+cr_values[cr_rval];
-
- for (cr_val=cr_values[cr_rval]; cr_val<cr_values[cr_rval+1]; cr_val++) {
- if (cr_val>threshval) (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval+1];
- else (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval];
- }
- }
-
- for (cr_val=cr_values[CR_RANGE-1]; cr_val<256; cr_val++) {
- (cb_2_cr[cb_rval])[cr_val] = cr_2_l[CR_RANGE-1];
- }
-
- for (cr_rval=0; cr_rval<CR_RANGE; cr_rval++) {
-
- for (l_val = 0; l_val < lum_values[0]; l_val++) {
- (cr_2_l[cr_rval])[l_val] = pixel[cb_rval+(cr_rval*CB_RANGE)+
- (0*CR_RANGE*CB_RANGE)];
- }
-
- for (l_rval=0; l_rval<(LUM_RANGE-1); l_rval++) {
- err_range = lum_values[l_rval+1] - lum_values[l_rval];
- threshval = ((pos*err_range) /DITH_SIZE) + lum_values[l_rval];
-
- for (l_val = lum_values[l_rval]; l_val < lum_values[l_rval+1]; l_val++) {
- if (l_val>threshval) (cr_2_l[cr_rval])[l_val] =
- pixel[cb_rval+(cr_rval*CB_RANGE)+((l_rval+1)*CR_RANGE*CB_RANGE)];
- else (cr_2_l[cr_rval])[l_val] =
- pixel[cb_rval+(cr_rval*CB_RANGE)+(l_rval*CR_RANGE*CB_RANGE)];
- }
- }
-
- for (l_val = lum_values[LUM_RANGE-1]; l_val < 256; l_val++) {
- (cr_2_l[cr_rval])[l_val] =
- pixel[cb_rval+(cr_rval*CB_RANGE)+((LUM_RANGE-1)*CR_RANGE*CB_RANGE)];
- }
- }
- }
- }
-
- for (i=0; i<DITH_SIZE; i++) {
- ditherPtr[i] = pos_2_cb[i];
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * Ordered2DitherImage --
- *
- * Dithers an image using an ordered dither.
- * Assumptions made:
- * 1) The color space is allocated y:cr:cb = 8:4:4
- * 2) The spatial resolution of y:cr:cb is 4:1:1
- * The channels are dithered based on the standard
- * ordered dither pattern for a 4x4 area.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-Ordered2DitherImage (unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w)
-{
- unsigned char *l, *r, *b, *o1, *o2;
- unsigned char *l2;
- unsigned char L, R, B;
- int i, j;
- unsigned char ***dp0 = ditherPtr[0];
- unsigned char ***dp2 = ditherPtr[2];
- unsigned char ***dp4 = ditherPtr[4];
- unsigned char ***dp6 = ditherPtr[6];
- unsigned char ***dp8 = ditherPtr[8];
- unsigned char ***dp10 = ditherPtr[10];
- unsigned char ***dp12 = ditherPtr[12];
- unsigned char ***dp14 = ditherPtr[14];
- unsigned char ***dp1 = ditherPtr[1];
- unsigned char ***dp3 = ditherPtr[3];
- unsigned char ***dp5 = ditherPtr[5];
- unsigned char ***dp7 = ditherPtr[7];
- unsigned char ***dp9 = ditherPtr[9];
- unsigned char ***dp11 = ditherPtr[11];
- unsigned char ***dp13 = ditherPtr[13];
- unsigned char ***dp15 = ditherPtr[15];
-
- l = lum;
- l2 = lum+w;
- r = cr;
- b = cb;
- o1 = out;
- o2 = out+w;
-
- for (i=0; i<h; i+=4) {
-
- for (j=0; j<w; j+=8) {
-
- R = r[0]; B = b[0];
-
- L = l[0];
- o1[0] = ((dp0[B])[R])[L];
- L = l[1];
- o1[1] = ((dp8[B])[R])[L];
- L = l2[0];
- o2[0] = ((dp12[B])[R])[L];
- L = l2[1];
- o2[1] = ((dp4[B])[R])[L];
-
- R = r[1]; B = b[1];
-
- L = l[2];
- o1[2] = ((dp2[B])[R])[L];
- L = l[3];
- o1[3] = ((dp10[B])[R])[L];
- L = l2[2];
- o2[2] = ((dp14[B])[R])[L];
- L = l2[3];
- o2[3] = ((dp6[B])[R])[L];
-
- R = r[2]; B = b[2];
-
- L = l[4];
- o1[4] = ((dp0[B])[R])[L];
- L = l[5];
- o1[5] = ((dp8[B])[R])[L];
- L = l2[4];
- o2[4] = ((dp12[B])[R])[L];
- L = l2[5];
- o2[5] = ((dp4[B])[R])[L];
-
- R = r[3]; B = b[3];
-
- L = l[6];
- o1[6] = ((dp2[B])[R])[L];
- L = l[7];
- o1[7] = ((dp10[B])[R])[L];
- L = l2[6];
- o2[6] = ((dp14[B])[R])[L];
- L = l2[7];
- o2[7] = ((dp6[B])[R])[L];
-
- l += 8;
- l2 += 8;
- r += 4;
- b += 4;
- o1 += 8;
- o2 += 8;
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
-
- for (j=0; j<w; j+=8) {
-
- R = r[0]; B = b[0];
-
- L = l[0];
- o1[0] = ((dp3[B])[R])[L];
- L = l[1];
- o1[1] = ((dp11[B])[R])[L];
- L = l2[0];
- o2[0] = ((dp15[B])[R])[L];
- L = l2[1];
- o2[1] = ((dp7[B])[R])[L];
-
- R = r[1]; B = b[1];
-
- L = l[2];
- o1[2] = ((dp1[B])[R])[L];
- L = l[3];
- o1[3] = ((dp9[B])[R])[L];
- L = l2[2];
- o2[2] = ((dp13[B])[R])[L];
- L = l2[3];
- o2[3] = ((dp5[B])[R])[L];
-
- R = r[2]; B = b[2];
-
- L = l[4];
- o1[4] = ((dp3[B])[R])[L];
- L = l[5];
- o1[5] = ((dp11[B])[R])[L];
- L = l2[4];
- o2[4] = ((dp15[B])[R])[L];
- L = l2[5];
- o2[5] = ((dp7[B])[R])[L];
-
- R = r[3]; B = b[3];
-
- L = l[6];
- o1[6] = ((dp1[B])[R])[L];
- L = l[7];
- o1[7] = ((dp9[B])[R])[L];
- L = l2[6];
- o2[6] = ((dp13[B])[R])[L];
- L = l2[7];
- o2[7] = ((dp5[B])[R])[L];
-
- l += 8;
- l2 += 8;
- r += 4;
- b += 4;
- o1 += 8;
- o2 += 8;
- }
-
- l += w; l2 += w;
- o1 += w; o2 += w;
- }
-}
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp
deleted file mode 100644
index de3e5a358f5..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp
+++ /dev/null
@@ -1,375 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "video.h"
-#include <X11/Intrinsic.h>
-#include <Xm/DialogS.h>
-#include <Xm/List.h>
-#include <Xm/Frame.h>
-#include <Xm/PushB.h>
-#include <Xm/Form.h>
-#include <Xm/Text.h>
-#include <Xm/TextF.h>
-#include <Xm/Label.h>
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-
-ACE_RCSID(mpeg_client, para, "$Id$")
-
-#define NUM_LIST_ITEMS 25
-#define PARAMETER_FILE "~/.vcr/vcrParameters"
-#define BANNER "Virtual VCR Parameter File, version 2.0 ** Do not Edit **"
-#ifdef XmFONTLIST_DEFAULT_TAG
-#define XmStringTag XmFONTLIST_DEFAULT_TAG
-#else
-#define XmStringTag XmSTRING_DEFAULT_CHARSET
-#endif
-#define STRING_SIZE 64
-#define ITEMS sizeof(shared->config)/4
-
-static Widget parashell, wparalist, wparafield;
-
-static int * config;
-static float *fconfig;
-
-static struct
-{
- char * title;
- int float_tag; /* 0 - integer, 1 - floating point */
-}
-para[] =
-{
- {"Real time (audio on)(tag)", 0},
- {"Video max frames-per-second", 0},
- {"Audio max sampels-per-second", 0},
- {"FF frames-per-second", 0},
- {"Rewind frames-per-second", 0},
- {"Feedback delay (msec)", 0},
- {"Audio output mask", 0},
- {"Audio_para.encodeType", 0},
- {"Audio_para.channels", 0},
- {"Audio_para.samplesPerSecond", 0},
- {"Audio_para.bytesPerSamples", 0},
- {"Audio timer interval (millisec)", 0},
- {"Audio buffered intervals", 0},
- {"Frames per audio play", 0},
- {"Audio forward (samples)", 0},
- {"VS work-ahead (milliseconds)", 0},
- {"frame rate limit (fps, float)", 1},
- {"collect statistics(tag)", 0},
- {"collect video structure info(tag)", 0},
- {"Sync effective(tag)", 0},
- {"QoS effective(tag)", 0},
- {"Audio offset(samples)", 0},
- {"Filter parameter(1/R or nsamples)", 0},
- {"Max send pattern frames", 0},
- {"Reliable byte-stream audio (tag)", 0},
- {"Reliable byte-stream video (tag)", 0},
- {"Verbose message(tag)", 0},
- {"", 0} /* this empty string is needed for testing the size of para */
-};
-
-#define Fgets(s) {if (feof(fp) || fgets(s, STRING_SIZE, fp) == NULL) break; s[strlen(s)-1] = 0; }
-
-#define Fputs(s) {fputs(s, fp); fputc('\n', fp);}
-
-static void InitBuf(void)
-{
- FILE * fp;
- char buf[256];
- int i;
-
- config = (int *)&(shared->config);
- fconfig = (float *)&(shared->config);
-
- get_full_path(PARAMETER_FILE, buf, 256);
- fp = fopen(buf, "r");
- if (fp == NULL)
- {
- fprintf(stderr, "Warning: %s not found, use default parameter value\n",
- PARAMETER_FILE);
- InitBuf_exit1:
- return;
- }
- if (fgets(buf, 100, fp) == NULL)
- {
- fclose(fp);
- goto InitBuf_exit1;
- }
- buf[strlen(buf)-1] = 0;
- if (ACE_OS::strcmp (buf, BANNER))
- {
- fprintf(stderr, "BANNER in %s not expected, use default parameter value\n",
- PARAMETER_FILE);
- fclose(fp);
- goto InitBuf_exit1;
- }
- for(i = 0; i < ITEMS; i++)
- {
- Fgets(buf);
- if (para[i].float_tag)
- sscanf(buf, "%f", &fconfig[i]);
- else
- sscanf(buf, "%d", &config[i]);
- }
- fclose(fp);
-}
-
-static void SaveBuf(void)
-{
- int i;
- FILE * fp;
- char buf[256];
- get_full_path(PARAMETER_FILE, buf, 256);
- fp = fopen(buf, "w");
- if (fp == NULL)
- {
- fprintf(stderr, "Fail to open %s for saving para", buf);
- ACE_OS::perror ("");
- return;
- }
- Fputs(BANNER);
- for (i = 0; i < ITEMS; i++)
- if (para[i].float_tag)
- fprintf(fp, "%f\n", fconfig[i]);
- else
- fprintf(fp, "%d\n", config[i]);
- fclose(fp);
-}
-
-
-static int curListPos(void)
-{
- int * poses, count;
-
- if (XmListGetSelectedPos(wparalist, &poses, &count))
- {
- count = poses[0];
- XtFree((char*)poses);
- /*
- fprintf(stderr, "curListPos: current pos = %d\n", count);
- */
- return count - 1;
- }
- return -1;
-}
-
-static void modifyCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- int i, value;
- XmString item;
- char buf[100], * valptr;
- i = curListPos();
- if (i == -1) { beep(); return;}
- valptr = XmTextGetString(wparafield);
- if (para[i].float_tag)
- sscanf(valptr, "%f", &fconfig[i]);
- else
- sscanf(valptr, "%d", &config[i]);
- XtFree(valptr);
- if (para[i].float_tag)
- sprintf(buf, "%s: %f", para[i].title, fconfig[i]);
- else
- sprintf(buf, "%s: %d", para[i].title, config[i]);
- item = (XmString)XmStringCreateLtoR(buf, XmStringTag);
- XmListReplaceItemsPos(wparalist, &item, 1, i+1);
- XmListSelectPos(wparalist, i+1, 0);
- XmStringFree(item);
- SaveBuf();
- /*
- XtManageChild(parashell);
- */
- return;
-}
-
-static void dismissCB(Widget W, XtPointer closure, XtPointer call_data)
-{
-
- XtUnrealizeWidget(parashell);
- /*
- XtUnmanageChild(parashell);
- */
-}
-
-Widget CreateParameterWindow(Widget parent)
-{
- Arg args[20];
- int n;
- Widget wform, frame1, frame2, wlabel,
- wmodify, wdismiss;
- XmFontList fontlist;
- XFontStruct * font;
- XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET;
-
- InitBuf();
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual VCR Parameter List"); n++;
- XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++;
- XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++;
- XtSetArg(args[n], XmNwidth, 350); n++;
- XtSetArg(args[n], XmNheight, 400); n++;
- XtSetArg(args[n], XmNminWidth, 250); n++;
- XtSetArg(args[n], XmNminHeight, 150); n++;
-
- parashell = XtAppCreateShell("Parameter List", "virtual_vcr",
- topLevelShellWidgetClass, display, args, n);
- /*
- parashell = XmCreateDialogShell(parent, "virtual_vcr", args, n);
- */
-
- font = XLoadQueryFont (XtDisplay (parashell), "courB14");
- fontlist = XmStringCreateFontList (font, cset);
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual Parameter List"); n++;
- wform = XmCreateForm(parashell, "Parameters", args, n);
- XtManageChild(wform);
- /*
- parashell = wform = XmCreateForm(parashell, "Parameters", args, n);
- */
-
- n = 0;
- wmodify = XmCreatePushButton (wform, "Update", args, n);
- XtManageChild(wmodify);
- XtAddCallback (wmodify, XmNactivateCallback, (XtCallbackProc)modifyCB, NULL);
- wdismiss = XmCreatePushButton (wform, "Dismiss", args, n);
- XtManageChild(wdismiss);
- XtAddCallback (wdismiss, XmNactivateCallback, (XtCallbackProc)dismissCB, NULL);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 20); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wmodify, args, n);
-
- n = 0;
- XtSetArg(args[n], XmNcolumns, 10); n++;
- XtSetArg (args[n], XmNleftOffset, 90); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- wparafield = XmCreateTextField(wform, "updata_text", args, n);
- XtManageChild(wparafield);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNrightOffset, 20); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wdismiss, args, n);
-
- n = 0;
- XtSetArg (args[n], XmNtopOffset, 5); n++;
- XtSetArg (args[n], XmNleftOffset, 5); n++;
- XtSetArg (args[n], XmNbottomOffset, 45); n++;
- XtSetArg (args[n], XmNrightOffset, 5); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNfontList, fontlist); n++;
- XtSetArg(args[n], XmNvisibleItemCount, NUM_LIST_ITEMS); n++;
-
- {
- int items;
- XmString * item;
- int i;
- /*
- fprintf(stderr, "Total parameter items: %d\n", items);
- */
- for (items = 0; para[items].title[0] != 0; items ++);
- if (items > ITEMS)
- items = ITEMS;
- else if (items < ITEMS)
- {
- fprintf(stderr, "Error in para.c: fewer titles than parameters, %d out of %d.\n",
- items, ITEMS);
- ACE_OS::exit (1);
- }
- item = (XmString *)ACE_OS::malloc(sizeof(*item) * items);
- if (item == NULL)
- {
- ACE_OS::perror ("UI allocate parameter list item(XmString)");
- ACE_OS::exit (1);
- }
- for (i = 0; i < items; i ++)
- {
- char buf[100];
- if (para[i].float_tag)
- sprintf(buf, "%s: %f", para[i].title, fconfig[i]);
- else
- sprintf(buf, "%s: %d", para[i].title, config[i]);
- item[i] = (XmString)XmStringCreateLtoR(buf, XmStringTag);
- }
- XtSetArg(args[n], XmNitems, item); n++;
- XtSetArg(args[n], XmNitemCount, items); n++;
- XtSetArg(args[n], XmNselectedItems, item); n++;
- XtSetArg(args[n], XmNselectedItemCount, 1); n++;
- wparalist = XmCreateScrolledList(wform, "ParameterList", args, n);
- XtManageChild(wparalist);
- for (i = 0; i < items; i++)
- XmStringFree(item[i]);
- ACE_OS::free (item);
- }
- XmFontListFree(fontlist);
-
- n=0;
- XtSetArg (args[n], XmNtopOffset, 5); n++;
- XtSetArg (args[n], XmNleftOffset, 5); n++;
- XtSetArg (args[n], XmNbottomOffset, 45); n++;
- XtSetArg (args[n], XmNrightOffset, 5); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- frame2 = XmCreateFrame (wform, "frame", args, n);
- XtManageChild(frame2);
-
- n=0;
- XtSetArg (args[n], XmNtopOffset, 0); n++;
- XtSetArg (args[n], XmNleftOffset, 0); n++;
- XtSetArg (args[n], XmNbottomOffset, 0); n++;
- XtSetArg (args[n], XmNrightOffset, 0); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- frame1 = XmCreateFrame (wform, "frame", args, n);
- XtManageChild(frame1);
-
- return parashell;
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp
deleted file mode 100644
index 7c22415443c..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp
+++ /dev/null
@@ -1,461 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#define NO_SANITY_CHECKS
-
-#include <assert.h>
-#include "video.h"
-#include "proto.h"
-#include "decoders.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, parseblock, "$Id$")
-
-/* External declarations. */
-
-extern int zigzag_direct[];
-
-/* Macro for returning 1 if num is positive, -1 if negative, 0 if 0. */
-
-#define Sign(num) ((num > 0) ? 1 : ((num == 0) ? 0 : -1))
-
-
-/*
- *--------------------------------------------------------------
- *
- * ParseReconBlock --
- *
- * Parse values for block structure from bitstream.
- * n is an indication of the position of the block within
- * the macroblock (i.e. 0-5) and indicates the type of
- * block (i.e. luminance or chrominance). Reconstructs
- * coefficients from values parsed and puts in
- * block.dct_recon array in vid stream structure.
- * sparseFlag is set when the block contains only one
- * coeffictient and is used by the IDCT.
- *
- * Results:
- *
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-#define DCT_recon blockPtr->dct_recon
-#define DCT_dc_y_past blockPtr->dct_dc_y_past
-#define DCT_dc_cr_past blockPtr->dct_dc_cr_past
-#define DCT_dc_cb_past blockPtr->dct_dc_cb_past
-
-#define DECODE_DCT_COEFF_FIRST DecodeDCTCoeffFirst
-#define DECODE_DCT_COEFF_NEXT DecodeDCTCoeffNext
-
-void
-ParseReconBlock(int n)
-{
-#ifdef RISC
- unsigned int temp_curBits;
- int temp_bitOffset;
- int temp_bufLength;
- unsigned int *temp_bitBuffer;
-#endif
-
- Block *blockPtr = &curVidStream->block;
- int coeffCount;
-
- if (bufLength < 2)
- correct_underflow();
-
-#ifdef RISC
- temp_curBits = curBits;
- temp_bitOffset = bitOffset;
- temp_bufLength = bufLength;
- temp_bitBuffer = bitBuffer;
-#endif
-
- {
- /*
- * Copy the globals curBits, bitOffset, bufLength, and bitBuffer
- * into local variables with the same names, so the macros use the
- * local variables instead. This allows register allocation and
- * can provide 1-2 fps speedup. On machines with not so many registers,
- * don't do this.
- */
-#ifdef RISC
- register unsigned int curBits = temp_curBits;
- register int bitOffset = temp_bitOffset;
- register int bufLength = temp_bufLength;
- register unsigned int *bitBuffer = temp_bitBuffer;
-#endif
-
- int diff;
- int size, level, i, run, pos, coeff;
- short int *reconptr;
- unsigned char *iqmatrixptr, *niqmatrixptr;
- int qscale;
-
- reconptr = DCT_recon[0];
-
- /*
- * Hand coded version of memset that's a little faster...
- * Old call:
- * memset((char *) DCT_recon, 0, 64*sizeof(short int));
- */
- {
- INT32 *p;
- p = (INT32 *) reconptr;
-
- p[0] = p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7] = p[8] = p[9] =
- p[10] = p[11] = p[12] = p[13] = p[14] = p[15] = p[16] = p[17] = p[18] =
- p[19] = p[20] = p[21] = p[22] = p[23] = p[24] = p[25] = p[26] = p[27] =
- p[28] = p[29] = p[30] = p[31] = 0;
-
- }
-
- if (curVidStream->mblock.mb_intra) {
-
- if (n < 4) {
-
- /*
- * Get the luminance bits. This code has been hand optimized to
- * get by the normal bit parsing routines. We get some speedup
- * by grabbing the next 16 bits and parsing things locally.
- * Thus, calls are translated as:
- *
- * show_bitsX <--> next16bits >> (16-X)
- * get_bitsX <--> val = next16bits >> (16-flushed-X);
- * flushed += X;
- * next16bits &= bitMask[flushed];
- * flush_bitsX <--> flushed += X;
- * next16bits &= bitMask[flushed];
- *
- * I've streamlined the code a lot, so that we don't have to mask
- * out the low order bits and a few of the extra adds are removed.
- * bsmith
- */
- unsigned int next16bits, index, flushed;
-
- show_bits16(next16bits);
- index = next16bits >> (16-7);
- size = dct_dc_size_luminance[index].value;
- flushed = dct_dc_size_luminance[index].num_bits;
- next16bits &= bitMask[16+flushed];
-
- if (size != 0) {
- flushed += size;
- diff = next16bits >> (16-flushed);
- if (!(diff & bitTest[32-size])) {
- diff = rBitMask[size] | (diff + 1);
- }
- } else {
- diff = 0;
- }
- flush_bits(flushed);
-
- if (n == 0) {
- coeff = diff << 3;
- if (curVidStream->mblock.mb_address -
- curVidStream->mblock.past_intra_addr > 1)
- coeff += 1024;
- else coeff += DCT_dc_y_past;
- DCT_dc_y_past = coeff;
- } else {
- coeff = DCT_dc_y_past + (diff << 3);
- DCT_dc_y_past = coeff;
- }
- } else {
-
- /*
- * Get the chrominance bits. This code has been hand optimized to
- * as described above
- */
- unsigned int next16bits, index, flushed;
-
- show_bits16(next16bits);
- index = next16bits >> (16-8);
- size = dct_dc_size_chrominance[index].value;
- flushed = dct_dc_size_chrominance[index].num_bits;
- next16bits &= bitMask[16+flushed];
-
- if (size != 0) {
- flushed += size;
- diff = next16bits >> (16-flushed);
- if (!(diff & bitTest[32-size])) {
- diff = rBitMask[size] | (diff + 1);
- }
- } else {
- diff = 0;
- }
- flush_bits(flushed);
-
- if (n == 4) {
- coeff = diff << 3;
- if (curVidStream->mblock.mb_address -
- curVidStream->mblock.past_intra_addr > 1)
- coeff += 1024;
- else coeff += DCT_dc_cr_past;
- DCT_dc_cr_past = coeff;
-
- } else {
- coeff = diff << 3;
- if (curVidStream->mblock.mb_address -
- curVidStream->mblock.past_intra_addr > 1)
- coeff += 1024;
- else coeff += DCT_dc_cb_past;
- DCT_dc_cb_past = coeff;
- }
- }
-
- *reconptr = coeff;
- i = 0; pos = 0;
- coeffCount = (coeff != 0);
-
- if (curVidStream->picture.code_type != 4) {
-
- qscale = curVidStream->slice.quant_scale;
- iqmatrixptr = curVidStream->intra_quant_matrix[0];
-
- while(1) {
-
- DECODE_DCT_COEFF_NEXT(run, level);
-
- if (run == END_OF_BLOCK) break;
- if (i >= 64)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) subscript out of range \n"));
- break;
- }
- i = i + run + 1;
- pos = zigzag_direct[i];
- coeff = (level * qscale * ((int) iqmatrixptr[pos])) >> 3;
- if (level < 0) {
- coeff += (coeff & 1);
- } else {
- coeff -= (coeff & 1);
- }
-
- reconptr[pos] = coeff;
- if (coeff) {
- coeffCount++;
- }
-
- }
-
-#ifdef ANALYSIS
-
- {
- extern unsigned int *mbCoeffPtr;
- mbCoeffPtr[pos]++;
- }
-#endif
-
- flush_bits(2);
-
- goto end;
- }
- }
-
- else {
-
- niqmatrixptr = curVidStream->non_intra_quant_matrix[0];
- qscale = curVidStream->slice.quant_scale;
-
- DECODE_DCT_COEFF_FIRST(run, level);
- i = run;
-
- pos = zigzag_direct[i];
- if (level < 0) {
- coeff = (((level<<1) - 1) * qscale *
- ((int) (niqmatrixptr[pos]))) >> 4;
- coeff += (coeff & 1);
- } else {
- coeff = (((level<<1) + 1) * qscale *
- ((int) (*(niqmatrixptr+pos)))) >> 4;
- coeff -= (coeff & 1);
- }
- reconptr[pos] = coeff;
- if (coeff) {
- coeffCount = 1;
- }
-
- if (curVidStream->picture.code_type != 4) {
-
- while(1) {
-
- DECODE_DCT_COEFF_NEXT(run, level);
-
- if (run == END_OF_BLOCK) break;
-
- i = i+run+1;
- if (i >= 64)
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) subscript out of range \n"));
- break;
- }
- pos = zigzag_direct[i];
- if (level < 0) {
- coeff = (((level<<1) - 1) * qscale *
- ((int) (niqmatrixptr[pos]))) >> 4;
- coeff += (coeff & 1);
- } else {
- coeff = (((level<<1) + 1) * qscale *
- ((int) (*(niqmatrixptr+pos)))) >> 4;
- coeff -= (coeff & 1);
- }
- reconptr[pos] = coeff;
- if (coeff) {
- coeffCount++;
- }
- }
-
-#ifdef ANALYSIS
- {
- extern unsigned int *mbCoeffPtr;
- mbCoeffPtr[pos]++;
- }
-#endif
-
- flush_bits(2);
-
- goto end;
- }
- }
-
- end:
-
- if (coeffCount == 1) j_rev_dct_sparse (reconptr, pos);
- else j_rev_dct(reconptr);
-
-#ifdef RISC
- temp_curBits = curBits;
- temp_bitOffset = bitOffset;
- temp_bufLength = bufLength;
- temp_bitBuffer = bitBuffer;
-#endif
-
- }
-
-#ifdef RISC
- curBits = temp_curBits;
- bitOffset = temp_bitOffset;
- bufLength = temp_bufLength;
- bitBuffer = temp_bitBuffer;
-#endif
-}
-
-#undef DCT_recon
-#undef DCT_dc_y_past
-#undef DCT_dc_cr_past
-#undef DCT_dc_cb_past
-
-
-/*
- *--------------------------------------------------------------
- *
- * ParseAwayBlock --
- *
- * Parses off block values, throwing them away.
- * Used with grayscale dithering.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-ParseAwayBlock(int n)
-{
- unsigned int diff;
- unsigned int size, run;
- int level;
-
- if (bufLength < 2)
- correct_underflow();
-
- if (curVidStream->mblock.mb_intra) {
-
- /* If the block is a luminance block... */
-
- if (n < 4) {
-
- /* Parse and decode size of first coefficient. */
-
- DecodeDCTDCSizeLum(size);
-
- /* Parse first coefficient. */
-
- if (size != 0) {
- get_bitsn(size, diff);
- }
- }
-
- /* Otherwise, block is chrominance block... */
-
- else {
-
- /* Parse and decode size of first coefficient. */
-
- DecodeDCTDCSizeChrom(size);
-
- /* Parse first coefficient. */
-
- if (size != 0) {
- get_bitsn(size, diff);
- }
- }
- }
-
- /* Otherwise, block is not intracoded... */
-
- else {
-
- /* Decode and set first coefficient. */
-
- DECODE_DCT_COEFF_FIRST(run, level);
- }
-
- /* If picture is not D type (i.e. I, P, or B)... */
-
- if (curVidStream->picture.code_type != 4) {
-
- /* While end of macroblock has not been reached... */
-
- while (1) {
-
- /* Get the dct_coeff_next */
-
- DECODE_DCT_COEFF_NEXT(run, level);
-
- if (run == END_OF_BLOCK) break;
- }
-
- /* End_of_block */
-
- flush_bits(2);
- }
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp
deleted file mode 100644
index 1469e13ac6f..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp
+++ /dev/null
@@ -1,933 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "video.h"
-#include <X11/Intrinsic.h>
-#include <Xm/List.h>
-#include <Xm/Frame.h>
-#include <Xm/PushB.h>
-#include <Xm/Form.h>
-#include <Xm/Text.h>
-#include <Xm/TextF.h>
-#include <Xm/DialogS.h>
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-
-ACE_RCSID(mpeg_client, prog, "$Id$")
-
-#define NUM_LIST_ITEMS 20
-#define STRING_SIZE 100
-#define ITEMS 100
-#define PROGRAM_FILE "~/.vcr/vcrPrograms"
-#define BANNER "Virtual VCR Program DataBase. version 2.0 **DO NOT edit**"
-#ifdef XmFONTLIST_DEFAULT_TAG
-#define XmStringTag XmFONTLIST_DEFAULT_TAG
-#else
-#define XmStringTag XmSTRING_DEFAULT_CHARSET
-#endif
-
-static int cmdSocket;
-static int *playtag;
-static Widget titlewidget, progshell, progmodifyshell;
-static Widget wproglist, wprogmodify;
-
-static int items = 0;
-static XmString * item;
-static struct ProgramList
-{
- char title[STRING_SIZE];
- char vh[STRING_SIZE];
- char vf[STRING_SIZE];
- char ah[STRING_SIZE];
- char af[STRING_SIZE];
-} * prog;
-
-static int progcmd, progid; /* progcmd == 0 - insert, 1 - modify*/
-static struct ProgramList deletedprog;
-
-#define LINE1 " Program Title: "
-#define LINE2 "Video file host: "
-#define LINE3 "Video file path: "
-#define LINE4 "Audio file host: "
-#define LINE5 "Audio file path: "
-#define MarginHeight 10
-#define MarginWidth 10
-static int charHeight, charWidth;
-static int titleSize;
-
-#define Fgets(s) {if (feof(fp) || fgets(s, STRING_SIZE, fp) == NULL) break; s[strlen(s)-1] = 0; }
-
-#define Fputs(s) {fputs(s, fp); fputc('\n', fp);}
-
-static void SaveBuf(void);
-
-static void InitBuf(void)
-{
- FILE * fp;
- char *fname;
- char buf[256];
- int copyTag = 0;
-
- deletedprog.title[0] = 0;
-
- item = (XmString *)ACE_OS::malloc(sizeof(*item) * ITEMS);
- if (item == NULL)
- {
- ACE_OS::perror ("UI allocate proglist item(XmString)");
- ACE_OS::exit (1);
- }
- prog = (struct ProgramList *) ACE_OS::malloc(sizeof(*prog) * ITEMS);
- if (prog == NULL)
- {
- ACE_OS::perror ("UI allocate prog");
- ACE_OS::exit (1);
- }
- fp = NULL;
- if (proglistName[0] != 0) { /* file name given in command line */
- get_full_path(proglistName, buf, 256);
- fname = proglistName;
- fp = fopen(buf, "r");
- if (fp == NULL) {
- fprintf(stderr,"PROG.C error opening %s:", proglistName);
- ACE_OS::perror ("");
- }
- }
- if (fp == NULL) {
- get_full_path(PROGRAM_FILE, buf, 256);
- fname = PROGRAM_FILE;
- fp = fopen(buf, "r");
- }
- if (fp == NULL) {
- {
-
- InitBuf_exit1:
-
- get_full_path(PROGRAM_FILE, buf, 256);
- if (access(buf, 0) != 0) { /* PROGRAM_FILE does not exist, create it */
- if (strchr(fname, '/') != NULL) { /* create the default directory */
- char *ptr = strrchr(buf, '/');
- *ptr = 0;
- mkdir(buf, 0755);
- *ptr = '/';
- }
- fname = PROGRAM_FILE;
- fp = fopen(buf, "w+");
- }
- else { /* Exist, create a temp file in /tmp */
- char *ptr = tempnam("/tmp/", "vcr");
- fname = tmpnam(NULL);
- if (ptr != NULL) {
- strncpy(fname, ptr, L_tmpnam);
- ACE_OS::free (ptr);
- }
- strcpy(buf, fname);
- fp = tmpfile();
- }
- if (fp != NULL) {
- if (strncmp(fname, "/tmp/", 5) != 0) {
- fprintf(stderr,
- "Warning: created file %s with default movie list.\n",
- fname);
- }
- else fprintf(stderr, "Warning: using default movie list.\n");
- fprintf(fp, "%s\n", BANNER);
- fprintf(fp, "\
-lemond: (va) Blazers Game 1 (128)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/c1.0.300.128.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/c1.0.300.au\n\
-lemond: (va) Blazers Game 1 (256)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/c1.0.300.256.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/c1.0.300.au\n\
-lemond: (va) Blazers Game 1 (320)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/c1.0.300.320.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/c1.0.300.au\n\
-lemond: (va) Blazers Game 2 (128)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/h1.0.300.128.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/h1.0.300.au\n\
-lemond: (va) Blazers Game 2 (256)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/h1.0.300.256.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/h1.0.300.au\n\
-lemond: (va) Blazers Game 2 (320)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/h1.0.300.320.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/h1.0.300.au\n\
-lemond: (va) Blazers Game 3 (128)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/s1.0.300.128.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/s1.0.300.au\n\
-lemond: (va) Blazers Game 3 (256)\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/s1.0.300.256.mpg\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/s1.0.300.au\n\
-lemond: (vo) Skiing on Mt. Rainer\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/skiRainer.mpeg\n\
-\n\
-\n\
-lemond: (ao) Following the sense (Chinese song)\n\
-\n\
-\n\
-lemond.cse.ogi.edu\n\
-/projects/dsrg/L/multimedia3/sense.au\n\
-");
- fseek(fp, (long)0, 0);
- fgets(buf, 100, fp);
- goto InitBuf_continue;
- /*
- fclose(fp);
- fp = fopen(buf, "r");
- if (fp != NULL) {
- fgets(buf, 100, fp);
- goto InitBuf_continue;
- }
- else {
- fprintf(stderr, "Warning: failed to read newly created %s:", buf);
- ACE_OS::perror ("");
- }
- */
- }
- else {
- fprintf(stderr, "Warning: failed to create %s:", buf);
- perror("");
- }
- items = 0;
- return;
- }
- }
- if (fgets(buf, 100, fp) == NULL)
- {
- fclose(fp);
- goto InitBuf_exit1;
- }
- buf[strlen(buf)-1] = 0;
- if (strncmp(buf, BANNER,ACE_OS::strlen (BANNER)))
- {
- fprintf(stderr, "BANNER in %s not expected\n", fname);
- fprintf(stderr, " Expected: %s\n", BANNER);
- fprintf(stderr, " Actual : %s\n", buf);
- fclose(fp);
- goto InitBuf_exit1;
- }
-
- InitBuf_continue:
-
- items = 0;
- for(;;)
- {
- /*
- fprintf(stderr, "Reading next program.\n");
- */
- Fgets(prog[items].title);
- // Fgets(prog[items].vh);
- Fgets(prog[items].vf);
- // Fgets(prog[items].ah);
- Fgets(prog[items].af);
- item[items] = (XmString)XmStringCreateLtoR(prog[items].title, XmStringTag);
- if ((++items) >= ITEMS) break;
- }
- /*
- fprintf(stderr, "Total programs %d\n", items);
- */
- fclose(fp);
- if (copyTag) {
- SaveBuf();
- }
-}
-
-static void SaveBuf(void)
-{
- int i;
- FILE * fp;
- char buf[256];
- get_full_path(PROGRAM_FILE, buf, 256);
- fp = fopen(buf, "w");
- if (fp == NULL)
- {
- fprintf(stderr, "Fail to open %s for saving programs", buf);
- ACE_OS::perror ("");
- return;
- }
- Fputs(BANNER);
- for (i = 0; i < items; i++)
- {
- Fputs(prog[i].title);
- // Fputs(prog[i].vh);
- Fputs(prog[i].vf);
- // Fputs(prog[i].ah);
- Fputs(prog[i].af);
- }
- fclose(fp);
-}
-
-static void CmdWrite(char * buf, int size)
-{
- if (size == 0) return;
- while (write(cmdSocket, (buf), (size)) == -1)
- {
- if (errno == EINTR) continue;
- ACE_OS::perror ("UI write to cmdSocket");
- ACE_OS::exit (1);
- }
-}
-
-void StartProgram(char * title, char * vh, char * vf, char * ah, char * af)
-{
- extern int cmdBusy;
- char tmp = CmdINIT;
- int len;
- if (!cmdBusy) {
- char *str = title;
- len =ACE_OS::strlen (str);
-// if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
-// str = vh;
- // len =ACE_OS::strlen (str);
- if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
- str = vf;
- // len =ACE_OS::strlen (str);
- // if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
- // str = ah;
- len =ACE_OS::strlen (str);
- if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
- str = af;
- len =ACE_OS::strlen (str);
- if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
- XmTextFieldSetString(titlewidget, title);
- cmdBusy = 1;
- CmdWrite(&tmp, 1);
-// len =ACE_OS::strlen (vh);
-// CmdWrite((char *)&len, 4);
-// cerr << "StartProgram: len =" << len;
-// CmdWrite(vh, len);
-// cerr << " StartProgram: vh =" << vh << endl;
- len =ACE_OS::strlen (vf);
- CmdWrite((char *)&len, 4);
- cerr << "StartProgram: len =" << len;
- CmdWrite(vf, len);
- cerr << " StartProgram: vf =" << vf << endl;
-// len =ACE_OS::strlen (ah);
-// CmdWrite((char *)&len, 4);
-// cerr << "StartProgram: len =" << len;
-// CmdWrite(ah, len);
-// cerr << " StartProgram: ah =" << ah << endl;
- len =ACE_OS::strlen (af);
- CmdWrite((char *)&len, 4);
- cerr << "StartProgram: len =" << len;
- CmdWrite(af, len);
- cerr << " StartProgram: af =" << af << endl;
- }
- else {
- beep();
- }
- cerr << "StartProgram done\n";
-}
-
-static int curListPos(void)
-{
- int * poses, count;
-
- if (XmListGetSelectedPos(wproglist, &poses, &count))
- {
- count = poses[0];
- XtFree((char*)poses);
- /*
- fprintf(stderr, "curListPos: current pos = %d\n", count);
- */
- return count - 1;
- }
- return -1;
-}
-
-
-static void modifyprog(struct ProgramList *p)
-{
- XmString item;
-
- if (items <0 || progid >= items || progid < 0)
- { beep(); return; }
- item = (XmString)XmStringCreateLtoR(p->title, XmStringTag);
- XmListReplaceItemsPos(wproglist, &item, 1, progid+1);
- XmListSelectPos(wproglist, progid+1, 0);
- XmStringFree(item);
- ACE_OS::memcpy (&(prog[progid]), p, sizeof(*p));
- SaveBuf();
-}
-
-static void insertprog(struct ProgramList *p)
-{
- XmString item;
-
- if (items <= 0 || items >= ITEMS) return;
- ACE_OS::memcpy ((char*)&(prog[items]), (char *)p, sizeof(*p));
- item = (XmString)XmStringCreateLtoR(p->title, XmStringTag);
- XmListAddItemUnselected(wproglist, item, items+1);
- XmStringFree(item);
- if (items == 0)
- XmListSelectPos(wproglist, 0, False);
- items ++;
- SaveBuf();
-}
-
-static void verifyCB(Widget w, XtPointer closure, XmTextVerifyCallbackStruct * cd);
-
-static void deleteCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- int i, j;
-
- // return;
-
-
- if (items <= 0) { beep(); return; }
- j = curListPos();
- if (j == -1) return;
- ACE_OS::memcpy (&deletedprog, &prog[j], sizeof(deletedprog));
- for (i = j+1; i < items; i++)
- ACE_OS::memcpy (&prog[i-1], &prog[i], sizeof(*prog));
- XmListDeletePos(wproglist, j+1);
- items --;
- SaveBuf();
- return;
-}
-
-static void undoCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- // return;
-
- if (deletedprog.title[0] != 0)
- {
- insertprog(&deletedprog);
- deletedprog.title[0] = 0;
- }
- else
- beep();
-
-}
-
-static void setposition(Widget w, int x, int y);
-
-static void insertCB (Widget w, XtPointer closure, XtPointer call_data)
-{
- char buf[1000];
-
- // return;
-
- //#if 0
- if (items >= ITEMS -1)
- {
- beep();
- return;
- }
- XtRemoveAllCallbacks(wprogmodify, XmNmodifyVerifyCallback);
- XtRemoveAllCallbacks(wprogmodify, XmNmotionVerifyCallback);
- progcmd = 0;
- sprintf(buf, " *** append a program ***\n");
- strcat(buf, LINE1);
- strcat(buf, "\n");
- strcat(buf, LINE2);
- strcat(buf, "\n");
- strcat(buf, LINE3);
- strcat(buf, "\n");
- strcat(buf, LINE4);
- strcat(buf, "\n");
- strcat(buf, LINE5);
- strcat(buf, "\n\n");
- XmTextSetString(wprogmodify, buf);
-
- setposition(wprogmodify, titleSize, 1);
- XtAddCallback (wprogmodify, XmNmodifyVerifyCallback, (XtCallbackProc)verifyCB, NULL);
- XtAddCallback (wprogmodify, XmNmotionVerifyCallback, (XtCallbackProc)verifyCB, NULL);
-
- // uncommented
- //XtManageChild(progmodifyshell);
-
- XtRealizeWidget(progmodifyshell);
- //#endif
-}
-
-static void modifyCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- int i;
- char buf[1000];
- if (items == 0)
- {
- beep();
- return;
- }
- XtRemoveAllCallbacks(wprogmodify, XmNmodifyVerifyCallback);
- XtRemoveAllCallbacks(wprogmodify, XmNmotionVerifyCallback);
- progid = i = curListPos();
- progcmd = 1;
- sprintf(buf, " *** modify program: %s ***\n", prog[i].title);
- strcat(buf, LINE1);
- strcat(buf, prog[i].title);
- strcat(buf, "\n");
- // strcat(buf, LINE2);
- // strcat(buf, prog[i].vh);
- // strcat(buf, "\n");
- strcat(buf, LINE3);
- strcat(buf, prog[i].vf);
- strcat(buf, "\n");
- // strcat(buf, LINE4);
- // strcat(buf, prog[i].ah);
- // strcat(buf, "\n");
- strcat(buf, LINE5);
- strcat(buf, prog[i].af);
- strcat(buf, "\n\n");
- XmTextSetString(wprogmodify, buf);
-
- setposition(wprogmodify, titleSize, 1);
- XtAddCallback (wprogmodify, XmNmodifyVerifyCallback, (XtCallbackProc)verifyCB, NULL);
- XtAddCallback (wprogmodify, XmNmotionVerifyCallback, (XtCallbackProc)verifyCB, NULL);
- /*
- XtManageChild(progmodifyshell);
- */
- XtRealizeWidget(progmodifyshell);
-}
-
-static void playCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- /*
- fprintf(stderr, "play");
- */
- if (items > 0)
- {
- int i = curListPos();
- if (i >= items || i < 0)
- return;
- cerr << "PlayCB\n";
- cerr << prog[i].title << " " << " " <<prog[i].vf << " " << " " << prog[i].af << endl;
- StartProgram(prog[i].title, prog[i].vh, prog[i].vf, prog[i].ah, prog[i].af);
- }
-}
-
-static void dismissCB(Widget W, XtPointer closure, XtPointer call_data)
-{
-
- XtUnrealizeWidget(progshell);
- /*
- XtUnmanageChild(progshell);
- */
-}
-
-static void setposition(Widget w, int x, int y)
-{
- Position x1, y1;
- x1 = charWidth * x + (MarginWidth+4);
- y1 = charHeight * y + (charHeight+MarginHeight+1);
- XmTextSetInsertionPosition(w, XmTextXYToPos(w, x1, y1));
-}
-
-static int getposition(Widget w, XmTextVerifyCallbackStruct * cd,
- int * x, int *y)
-{
- Position x1, y1;
- if (!XmTextPosToXY(w, cd->newInsert, &x1, &y1))
- return 0;
- *x = (x1-(MarginWidth+4))/charWidth;
- *y = (y1-(charHeight+MarginHeight+1))/charHeight;
- if ((*x)*charWidth != x1-(MarginWidth+4) || (*y)*charHeight != y1-(charHeight+MarginHeight+1))
- {
- /*
- fprintf(stderr, "error: TextCursorConversion failed. \007\n");
- fprintf(stderr, "x-%d, x1-%d, y-%d, y1-%d\n", *x, (int)x1, *y, (int)y1);
- */
- return 1;
- }
- return 1;
-
-}
-
-static void modifydismissCB(Widget w, XtPointer closure, XtPointer call_data)
-{
-
- XtUnrealizeWidget(progmodifyshell);
- /*
- XtUnmanageChild(progmodifyshell);
- */
-}
-
-static void modifysaveCB(Widget w, XtPointer closure, XtPointer call_data)
-{
- return;
-
- //#if 0
- if (progcmd == 1 && items <= progid)
- {
- beep();
- }
- else if (progcmd == 1 || progcmd == 0)
- {
- char * buf, * ptr, *ptr1;
- struct ProgramList p;
- buf = XmTextGetString(wprogmodify);
- ptr = buf;
- fprintf(stderr, "Buf: %s\n", buf);
- while (*ptr != '\n') ptr ++;
- ptr ++;
-
- ptr1 = ptr + titleSize;
- while (*ptr != '\n') ptr ++;
- (*ptr) = 0; ptr ++;
- strncpy(p.title, ptr1, STRING_SIZE);
- p.title[STRING_SIZE-1] = 0;
-
- ptr1 = ptr + titleSize;
- while (*ptr != '\n') ptr ++;
- (*ptr) = 0; ptr ++;
- strncpy(p.vh, ptr1, STRING_SIZE);
- p.vh[STRING_SIZE-1] = 0;
-
- ptr1 = ptr + titleSize;
- while (*ptr != '\n') ptr ++;
- (*ptr) = 0; ptr ++;
- strncpy(p.vf, ptr1, STRING_SIZE);
- p.vf[STRING_SIZE-1] = 0;
-
- ptr1 = ptr + titleSize;
- while (*ptr != '\n') ptr ++;
- (*ptr) = 0; ptr ++;
- strncpy(p.ah, ptr1, STRING_SIZE);
- p.ah[STRING_SIZE-1] = 0;
-
- ptr1 = ptr + titleSize;
- while (*ptr != '\n') ptr ++;
- (*ptr) = 0;
- strncpy(p.af, ptr1, STRING_SIZE);
- p.af[STRING_SIZE-1] = 0;
- /*
- fprintf(stderr, "*|%s||%s||%s||%s||%s||*\n", p.title, p.vh, p.vf, p.ah, p.af);
- */
- XtFree((char *)buf);
- if (progcmd == 1)
- modifyprog(&p);
- else
- insertprog(&p);
- }
- //#endif
-}
-
-static void verifyCB(Widget w, XtPointer closure, XmTextVerifyCallbackStruct * cd)
-{
- int x = 0, y = 0;
-
- if (!getposition(w, cd, &x, &y))
- {
- fprintf(stderr, "error on conversion to x/y\n");
- return;
- }
-/*
- fprintf(stderr, "verifyCB: %d (x-%d, y-%d)\n",cd->newInsert, x, y);
-*/
- if (x < titleSize || x > titleSize+STRING_SIZE || y < 1 || y > 5)
- {
- beep();
- cd->doit = False;
- return;
- }
- else
- return;
-}
-
-static void CreateModifyWindow(Widget parent)
-{
- Arg args[20];
- int n;
- Widget wform, wtext, wdone, wcancel;
- XmFontList fontlist;
- XFontStruct * font;
- XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET;
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual VCR Program List Edit"); n++;
- XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++;
- XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++;
- XtSetArg(args[n], XmNwidth, 700); n++;
- XtSetArg(args[n], XmNheight, 160); n++;
- XtSetArg(args[n], XmNallowShellResize, False); n++;
-
- progmodifyshell = XtAppCreateShell("Program List", "virtual_vcr",
- topLevelShellWidgetClass, display, args, n);
-
- // uncommented.
- // progmodifyshell = XmCreateDialogShell(parent, "virtual_vcr", args, n);
-
- n = 0;
-
- /* Create form widget */
- n = 0;
- XtSetArg (args[n], XmNallowShellResize, False); n++;
- /*
- XtSetArg (args[n], XmNheight, 300); n++;
- XtSetArg (args[n], XmNwidth, 800); n++;
- */
- wform = XmCreateForm(progmodifyshell, "Programs", args, n);
-
- XtManageChild(wform);
-
- font = XLoadQueryFont (XtDisplay (progmodifyshell), "8x13");
- charHeight = 13;
- charWidth = 8;
- fontlist = XmStringCreateFontList (font, cset);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 20); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- wdone = XmCreatePushButton (wform, "Save", args, n);
- XtManageChild(wdone);
- XtAddCallback (wdone, XmNactivateCallback, (XtCallbackProc)modifysaveCB, NULL);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNrightOffset, 20); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- wcancel = XmCreatePushButton (wform, "Dismiss", args, n);
- XtManageChild(wcancel);
- XtAddCallback (wcancel, XmNactivateCallback, (XtCallbackProc)modifydismissCB, NULL);
-
- titleSize =ACE_OS::strlen (LINE1);
-
- n=0;
- XtSetArg (args[n], XmNleftOffset, 5); n++;
- XtSetArg (args[n], XmNtopOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNcolumns, titleSize + STRING_SIZE+1); n++;
- XtSetArg(args[n], XmNrows, 7); n++;
-/*
- XtSetArg(args[n], XmNeditable, True); n++;
-*/
- XtSetArg(args[n], XmNeditable, False); n++;
-
- XtSetArg(args[n], XmNmarginHeight, MarginHeight); n++;
- XtSetArg(args[n], XmNmarginWidth, MarginWidth); n++;
- XtSetArg(args[n], XmNborderWidth, 0); n++;
- XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
- /*
- XtSetArg(args[n], XmNvalue, new_string1); n++;
- */
- XtSetArg(args[n], XmNfontList, fontlist); n++;
- wtext = XmCreateText(wform, "Virtual VCR program list modify text", args, n);
-
- XtManageChild(wtext);
-
- XmFontListFree (fontlist);
- wprogmodify = wtext;
-}
-
-Widget CreateProgramWindow(Widget parent, int cmdSock, int * playflag, Widget frametext)
-{
- Arg args[20];
- int n;
- Widget wform, frame1, frame2, wlist,
- wdelete, wundo, winsert, wmodify, wplay, wdismiss;
- XmFontList fontlist;
- XFontStruct * font;
- XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET;
-
- cmdSocket = cmdSock;
- playtag = playflag;
- titlewidget = frametext;
-
- InitBuf();
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual VCR Program List"); n++;
- XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++;
- XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++;
- XtSetArg(args[n], XmNwidth, 396); n++;
- XtSetArg(args[n], XmNheight, 300); n++;
- XtSetArg(args[n], XmNminWidth, 396); n++;
- XtSetArg(args[n], XmNminHeight, 150); n++;
-
- progshell = XtAppCreateShell("Program List", "virtual_vcr",
- topLevelShellWidgetClass, display, args, n);
- /*
- progshell = XmCreateDialogShell(parent, "virtual_vcr", args, n);
- */
- font = XLoadQueryFont (XtDisplay (progshell), "courB14");
- fontlist = XmStringCreateFontList (font, cset);
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "Program List"); n++;
- wform = XmCreateForm(progshell, "Programs", args, n);
-
- XtManageChild(wform);
-
- n = 0;
- wdelete = XmCreatePushButton (wform, "Delete", args, n);
- XtManageChild(wdelete);
- XtAddCallback (wdelete, XmNactivateCallback, (XtCallbackProc)deleteCB, NULL);
- wundo = XmCreatePushButton (wform, "Undo", args, n);
- XtManageChild(wundo);
- XtAddCallback (wundo, XmNactivateCallback, (XtCallbackProc)undoCB, NULL);
- winsert = XmCreatePushButton (wform, "Insert", args, n);
- XtManageChild(winsert);
- XtAddCallback (winsert, XmNactivateCallback, (XtCallbackProc)insertCB, NULL);
- wmodify = XmCreatePushButton (wform, "Modify", args, n);
- XtManageChild(wmodify);
- XtAddCallback (wmodify, XmNactivateCallback, (XtCallbackProc)modifyCB, NULL);
- wplay = XmCreatePushButton (wform, "Select", args, n);
- XtManageChild(wplay);
- XtAddCallback (wplay, XmNactivateCallback, (XtCallbackProc)playCB, NULL);
- wdismiss = XmCreatePushButton (wform, "Dismiss", args, n);
- XtManageChild(wdismiss);
- XtAddCallback (wdismiss, XmNactivateCallback, (XtCallbackProc)dismissCB, NULL);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 5); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wdelete, args, n);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 70); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wundo, args, n);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 135); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (winsert, args, n);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 200); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wmodify, args, n);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 265); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wplay, args, n);
-
- n=0;
- XtSetArg (args[n], XmNwidth, 60); n++;
- XtSetArg (args[n], XmNheight, 28); n++;
- XtSetArg (args[n], XmNleftOffset, 330); n++;
- XtSetArg (args[n], XmNbottomOffset, 5); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetValues (wdismiss, args, n);
-
- n = 0;
- XtSetArg (args[n], XmNtopOffset, 2); n++;
- XtSetArg (args[n], XmNleftOffset, 2); n++;
- XtSetArg (args[n], XmNbottomOffset, 38); n++;
- XtSetArg (args[n], XmNrightOffset, 2); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(args[n], XmNfontList, fontlist); n++;
- XtSetArg(args[n], XmNvisibleItemCount, NUM_LIST_ITEMS); n++;
- if (items > 0)
- {
- XtSetArg(args[n], XmNitems, item); n++;
- XtSetArg(args[n], XmNitemCount, items); n++;
- XtSetArg(args[n], XmNselectedItems, item); n++;
- XtSetArg(args[n], XmNselectedItemCount, 1); n++;
- }
- wlist = XmCreateScrolledList(wform, "ProgramList", args, n);
- XtManageChild(wlist);
- XmFontListFree(fontlist);
- wproglist = wlist;
- for (n = 0; n < items; n++)
- XmStringFree(item[n]);
- ACE_OS::free (item);
-
- n=0;
- XtSetArg (args[n], XmNtopOffset, 2); n++;
- XtSetArg (args[n], XmNleftOffset, 2); n++;
- XtSetArg (args[n], XmNbottomOffset, 38); n++;
- XtSetArg (args[n], XmNrightOffset, 2); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- frame2 = XmCreateFrame (wform, "frame", args, n);
- XtManageChild(frame2);
-
- n=0;
- XtSetArg (args[n], XmNtopOffset, 0); n++;
- XtSetArg (args[n], XmNleftOffset, 0); n++;
- XtSetArg (args[n], XmNbottomOffset, 0); n++;
- XtSetArg (args[n], XmNrightOffset, 0); n++;
- XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- frame1 = XmCreateFrame (wform, "frame", args, n);
- XtManageChild(frame1);
-
- CreateModifyWindow(parent);
-
- return progshell;
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h
deleted file mode 100644
index 023cd981944..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $Id$ */
-
-
-#ifdef __STDC__
-# define P(s) s
-#else
-# define P(s) ()
-#endif
-
-
-/* util.c */
-void correct_underflow P((void ));
-int next_bits P((int num , unsigned int mask ));
-char *get_ext_data P((void ));
-int next_start_code P((void ));
-char *get_extra_bit_info P((void ));
-
-/* video.c */
-void init_stats P((void ));
-void PrintAllStats P((void ));
-double ReadSysClock P((void ));
-void PrintTimeInfo P((void ));
-VidStream *NewVidStream P((void ));
-void DestroyVidStream P((VidStream *astream ));
-PictImage *NewPictImage P((unsigned int width , unsigned int height ));
-void DestroyPictImage P((PictImage *apictimage ));
-int mpegVidRsrc P((char *p ));
-void ToggleBFlag P((void ));
-void TogglePFlag P((void ));
-
-/* parseblock.c */
-void ParseReconBlock P((int n ));
-void ParseAwayBlock P((int n ));
-
-/* motionvector.c */
-void ComputeForwVector P((int *recon_right_for_ptr , int *recon_down_for_ptr ));
-void ComputeBackVector P((int *recon_right_back_ptr , int *recon_down_back_ptr ));
-
-/* decoders.c */
-void init_tables P((void ));
-void decodeDCTDCSizeLum P((unsigned int *value ));
-void decodeDCTDCSizeChrom P((unsigned int *value ));
-void decodeDCTCoeffFirst P((unsigned int *run , int *level ));
-void decodeDCTCoeffNext P((unsigned int *run , int *level ));
-
-/* main.c */
-int get_more_data P((unsigned int *buf_start , int max_length , int *length_ptr , unsigned int **buf_ptr ));
-int main P((int argc , char **argv ));
-void usage P((char *s ));
-
-/* gdith.c */
-void InitColor P((void ));
-int HandleXError P((Display *dpy , XErrorEvent *event ));
-void InstallXErrorHandler P((void ));
-void DeInstallXErrorHandler P((void ));
-void ResizeDisplay P((int w , int h ));
-void InitDisplay P((char *name ));
-void InitGrayDisplay P((char *name ));
-void InitMonoDisplay P((char *name ));
-void InitColorDisplay P((char *name ));
-void ExecuteDisplay P((VidStream *vid_stream ));
-
-/* fs2.c */
-void InitFS2Dither P((void ));
-void FS2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *disp , int rows , int cols ));
-
-/* fs2fast.c */
-void InitFS2FastDither P((void ));
-void FS2FastDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* fs4.c */
-void InitFS4Dither P((void ));
-void FS4DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *disp , int rows , int cols ));
-
-/* hybrid.c */
-void InitHybridDither P((void ));
-void HybridDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* hybriderr.c */
-void InitHybridErrorDither P((void ));
-void HybridErrorDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* 2x2.c */
-void Init2x2Dither P((void ));
-void RandInit P((int h , int w ));
-void PostInit2x2Dither P((void ));
-void Twox2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* gray.c */
-void GrayDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* mono.c */
-void MonoDitherImage(register unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w);
-void MonoThresholdImage(unsigned char *lum, unsigned char *cr,
- unsigned char *cb, unsigned char *out,
- int h, int w);
-
-/* jrevdct.c */
-void init_pre_idct P((void ));
-void j_rev_dct_sparse P((DCTBLOCK data , int pos ));
-void j_rev_dct P((DCTBLOCK data ));
-void j_rev_dct_sparse P((DCTBLOCK data , int pos ));
-void j_rev_dct P((DCTBLOCK data ));
-
-/* 24bit.c */
-void InitColorDither P((void ));
-void ColorDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int rows , int cols ));
-
-/* util32.c */
-Visual *FindFullColorVisual P((Display *dpy , int *depth ));
-Window CreateFullColorWindow P((Display *dpy , int x , int y , int w , int h ));
-
-/* ordered.c */
-void InitOrderedDither P((void ));
-void OrderedDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* ordered2.c */
-void InitOrdered2Dither P((void ));
-void Ordered2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-
-/* mb_ordered.c */
-void InitMBOrderedDither P((void ));
-void MBOrderedDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w ));
-void MBOrderedDitherDisplayCopy P((VidStream *vid_stream , int mb_addr , int motion_forw , int r_right_forw , int r_down_forw , int motion_back , int r_right_back , int r_down_back , unsigned char *past , unsigned char *future ));
-
-#undef P
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp
deleted file mode 100644
index 734029da118..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp
+++ /dev/null
@@ -1,999 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1994 The Geometry Center; University of Minnesota
- 1300 South Second Street; Minneapolis, MN 55454, USA;
-
-This file is free software; you can redistribute it and/or modify it only
-under the the terms of the GNU GENERAL PUBLIC LICENSE which should be
-included along with this file. This software may be obtained via anonymous
-ftp from geom.umn.edu; email: software@geom.umn.edu. */
-
-/* Author: Daeron Meyer */
-
-/* This software is modified on January 15, 1995 by:
- *
- * Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <X11/IntrinsicP.h>
-#include <Xm/DialogS.h>
-#include "mpeg_mib/mibload.h"
-#include "interface/fb.xbm"
-#include "interface/play.xbm"
-#include "interface/step.xbm"
-#include "interface/stop.xbm"
-#include "interface/loop.xbm"
-#include "interface/ff.xbm"
-#include "interface/MainWindow.mib"
-#include "interface/Info.mib"
-#include "video.h"
-
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, ui, "$Id$")
-
-int cmdBusy = 0;
-
-extern char infomessage[];
-
-/*****************************************************************************/
-
-/* Private Variables and Methods */
-
-static int playtag = 0;
-static int cmdSocket = -1;
-
-/* Intrinsics Application Context */
-static XtAppContext App;
-static Window monitorwindow = (int)NULL;
-static mib_Widget *mainload, *infoload;
-static Widget shell = (int)NULL, infoshell = (int)NULL,
- parashell = (int)NULL, progshell = (int)NULL,
- fileshell = (int)NULL;
-static Widget frametext= (int)NULL;
-static Widget volumescale = (int)NULL, balancescale = (int)NULL,
- speedscale = (int)NULL, positionscale = (int)NULL;
-static int frameshown = 0;
-
-#define MINX 500
-#define MINY 360
-
-static Window displaywin = (int)NULL;
-static int privcolormap = 0;
-
-static void exit_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void info_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void para_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void prog_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void file_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-
-static void loopchange_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void normal_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void fb_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void stop_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void ff_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void step_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void play_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-
-static void volume_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void balance_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void speed_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-static void position_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-
-static void cmdSocket_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-
-static void monitor_expose(Widget, XtPointer, XmDrawingAreaCallbackStruct *);
-
-static void infoclose_callback(Widget, XtPointer, XmAnyCallbackStruct *);
-
-static void CmdWrite(char * buf, int size)
-{
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t)before writing cmd\n"));
- while (ACE_OS::write(cmdSocket, (buf), (size)) == -1)
- {
- if (errno == EINTR) continue;
- ACE_OS::perror ("UI write to cmdSocket");
- ACE_OS::exit (1);
- }
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t)After writing cmd\n"));
-}
-
-/*****************************************************************************
-
- UICreate: Create/load in a motif interface.
-
- *****************************************************************************/
-
-static void UICreate()
-{
-
- Widget toplevel;
-
- Widget mainwindow,
- temp;
-
- Pixel fg, bg;
- Pixmap button_pix;
-
- XmFontList fontlist;
- XFontStruct * font;
-
- Arg args[20];
- int n, depth;
-
- static String fallbacks[] = {
- "*Foreground: black",
- "*BorderWidth: 0",
- "*Background: lavender",
- "*XmToggleButton.selectColor: yellow",
- "*XmToggleButton.indicatorSize: 16",
- "*XmToggleButtonGadget.selectColor: yellow",
- "*XmToggleButtonGadget.indicatorSize: 16",
- "*fontList: -adobe-helvetica-medium-r-normal--14-*-*-*-p-*-iso8859-1",
- "*XmText*fontList: -adobe-courier-medium-r-normal--12-*-*-*-m-70-iso8859-1",
- NULL
- };
-
-/*****************************************************************************/
-
- n = 0;
-
- toplevel = XtAppInitialize(&App, "virtual_vcr", NULL, 0, &argc_share,
- argv_share, fallbacks, args, n);
-
- display = XtDisplay(toplevel);
-
-/******************************************************************************/
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "TAO Mpeg Player"); n++;
- XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++;
- XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++;
- XtSetArg(args[n], XmNwidth, MINX); n++;
- XtSetArg(args[n], XmNminWidth, MINX); n++;
- XtSetArg(args[n], XmNheight, MINY); n++;
- XtSetArg(args[n], XmNminHeight, MINY); n++;
-
- shell = XtAppCreateShell("TAO Mpeg Player", "virtual_vcr",
- topLevelShellWidgetClass, display, args, n);
-
-/*****************************************************************************/
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "TAO Mpeg Player"); n++;
-
- mainwindow = XmCreateForm(shell, "MainForm", args, n);
- XtManageChild(mainwindow);
- {
- XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET;
- XmString titleString;
-
- font = XLoadQueryFont (XtDisplay (shell), "courB14");
- fontlist = XmStringCreateFontList (font, cset);
-
-
- titleString = XmStringCreateLtoR ("Balance", cset);
- n = 0;
- XtSetArg (args[n], XmNfontList, fontlist); n++;
- XtSetArg (args[n], XmNshowValue, True); n++;
- XtSetArg (args[n], XmNtitleString, titleString); n++;
- XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg (args[n], XmNmaximum, 100); n++;
- XtSetArg (args[n], XmNvalue, 50); n++;
- XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg (args[n], XmNscaleHeight, 17);n++;
- XtSetArg (args[n], XmNscaleWidth, 100);n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomOffset, 4);n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftOffset, 8);n++;
- balancescale = XmCreateScale(mainwindow, "scale", args, n);
- XmStringFree (titleString);
- XtManageChild (balancescale);
- XtAddCallback (balancescale, XmNvalueChangedCallback, (XtCallbackProc)balance_callback, NULL);
- XtAddCallback (balancescale, XmNdragCallback, (XtCallbackProc)balance_callback, NULL);
-
-
- titleString = XmStringCreateLtoR ("Volume", cset);
- n = 0;
- XtSetArg (args[n], XmNfontList, fontlist); n++;
- XtSetArg (args[n], XmNshowValue, True); n++;
- XtSetArg (args[n], XmNtitleString, titleString); n++;
- XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg (args[n], XmNmaximum, 100); n++;
- XtSetArg (args[n], XmNvalue, DEFAULT_volume); n++;
- XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg (args[n], XmNscaleHeight, 17);n++;
- XtSetArg (args[n], XmNscaleWidth, 100);n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomOffset, 4);n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftOffset, 128);n++;
- volumescale = XmCreateScale(mainwindow, "scale", args, n);
- XmStringFree (titleString);
- XtManageChild (volumescale);
- XtAddCallback (volumescale, XmNvalueChangedCallback, (XtCallbackProc)volume_callback, NULL);
- XtAddCallback (volumescale, XmNdragCallback, (XtCallbackProc)volume_callback, NULL);
-
-
- titleString = XmStringCreateLtoR ("Play Speed", cset);
- n = 0;
- XtSetArg (args[n], XmNfontList, fontlist); n++;
- XtSetArg (args[n], XmNshowValue, True); n++;
- XtSetArg (args[n], XmNtitleString, titleString); n++;
- XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg (args[n], XmNmaximum, 100); n++;
- XtSetArg (args[n], XmNvalue, 50); n++;
- XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg (args[n], XmNscaleHeight, 17);n++;
- XtSetArg (args[n], XmNscaleWidth, 100);n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomOffset, 4);n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftOffset, 248);n++;
- speedscale = XmCreateScale(mainwindow, "scale", args, n);
- XmStringFree (titleString);
- XtManageChild (speedscale);
- XtAddCallback (speedscale, XmNvalueChangedCallback, (XtCallbackProc)speed_callback, NULL);
- XtAddCallback (speedscale, XmNdragCallback, (XtCallbackProc)speed_callback, NULL);
-
-
- titleString = XmStringCreateLtoR ("Position", cset);
- n = 0;
- XtSetArg (args[n], XmNfontList, fontlist); n++;
- XtSetArg (args[n], XmNshowValue, True); n++;
- XtSetArg (args[n], XmNtitleString, titleString); n++;
- XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++;
- XtSetArg (args[n], XmNmaximum, POSITION_RANGE); n++;
- XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
- XtSetArg (args[n], XmNscaleHeight, 17);n++;
- XtSetArg (args[n], XmNscaleWidth, 100);n++;
- XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNbottomOffset, 4);n++;
- XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (args[n], XmNleftOffset, 368);n++;
- positionscale = XmCreateScale(mainwindow, "scale", args, n);
- XmStringFree (titleString);
- XtManageChild (positionscale);
- XtAddCallback (positionscale, XmNvalueChangedCallback, (XtCallbackProc)position_callback, NULL);
- XtAddCallback (positionscale, XmNdragCallback, (XtCallbackProc)position_callback, NULL);
-
- }
-
- mainload = mib_load_interface(mainwindow, MainMib, MI_FROMSTRING);
- XtSetMappedWhenManaged(shell, False);
- XtRealizeWidget(shell);
-
- frametext = mib_find_name(mainload, "TitleText")->me;
- XtVaSetValues(frametext,
- XmNfontList, fontlist,
- XmNcursorPositionVisible, False,
- XmNeditable, False,
- NULL);
-
- temp = mib_find_name(mainload, "Monitor")->me;
- XtAddCallback(temp, XmNexposeCallback,
- (XtCallbackProc) monitor_expose, (XtPointer) NULL);
- XtVaSetValues(temp, XmNforeground,
- BlackPixel(display, DefaultScreen(display)),
- XmNbackground,
- BlackPixel(display, DefaultScreen(display)),
- NULL);
- monitorwindow = XtWindow(temp);
-
- temp = mib_find_name(mainload, "Info")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) info_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Para")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) para_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Prog")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) prog_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "File")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) file_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Exit")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) exit_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Loop")->me;
- XtVaGetValues(temp, XmNforeground, &fg,
- XmNbackground, &bg, XmNdepth, &depth, NULL);
- button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)loop_bits, loop_width, loop_height, fg, bg, depth);
- /*
- {
- int i;
- for (i = 0; i < sizeof(loop_bits); i++)
- loop_bits[i] = ~loop_bits[i];
- }
- */
- XtVaSetValues(temp,
- XmNshadowThickness, 2,
-
- XmNwidth, 45,
- XmNheight, 28,
-
- XmNindicatorType, XmN_OF_MANY,
-
- XmNindicatorOn, False,
-
- XmNfillOnSelect, True,
- XmNlabelType, XmPIXMAP,
- XmNhighlightThickness, 0,
- XmNrubberPositioning, False,
- XmNlabelPixmap, button_pix,
- XmNselectPixmap, button_pix,
-/*
- XmNselectPixmap, (XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)loop_bits, loop_width, loop_height, fg, bg, depth)),
-*/
- NULL);
- XtAddCallback(temp, XmNvalueChangedCallback, (XtCallbackProc) loopchange_callback,
- (XtPointer) NULL);
-/*
- XtAddCallback(temp, XmNarmCallback, (XtCallbackProc) looparm_callback,
- (XtPointer) NULL);
- XtAddCallback(temp, XmNdisarmCallback, (XtCallbackProc) loopdisarm_callback,
- (XtPointer) NULL);
-*/
- temp = mib_find_name(mainload, "Normal")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) normal_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Rewind")->me;
- XtVaGetValues(temp, XmNforeground, &fg,
- XmNbackground, &bg, XmNdepth, &depth, NULL);
- button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)fb_bits, fb_width, fb_height, fg, bg, depth);
- XtVaSetValues(temp, XmNlabelType, XmPIXMAP,
- XmNlabelPixmap, button_pix, NULL);
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) fb_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Stop")->me;
- XtVaGetValues(temp, XmNforeground, &fg,
- XmNbackground, &bg, XmNdepth, &depth, NULL);
- button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)stop_bits, stop_width, stop_height, fg, bg, depth);
- XtVaSetValues(temp, XmNlabelType, XmPIXMAP,
- XmNlabelPixmap, button_pix, NULL);
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) stop_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "FF")->me;
- XtVaGetValues(temp, XmNforeground, &fg,
- XmNbackground, &bg, XmNdepth, &depth, NULL);
- button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)ff_bits, ff_width, ff_height, fg, bg, depth);
- XtVaSetValues(temp, XmNlabelType, XmPIXMAP,
- XmNlabelPixmap, button_pix, NULL);
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) ff_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Step")->me;
- XtVaGetValues(temp, XmNforeground, &fg,
- XmNbackground, &bg, XmNdepth, &depth, NULL);
- button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)step_bits, step_width, step_height, fg, bg, depth);
- XtVaSetValues(temp, XmNlabelType, XmPIXMAP,
- XmNlabelPixmap, button_pix, NULL);
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) step_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(mainload, "Play")->me;
- XtVaGetValues(temp, XmNforeground, &fg,
- XmNbackground, &bg, XmNdepth, &depth, NULL);
- button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display),
- (char *)play_bits, play_width, play_height, fg, bg, depth);
- XtVaSetValues(temp, XmNlabelType, XmPIXMAP,
- XmNlabelPixmap, button_pix, NULL);
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) play_callback,
- (XtPointer) NULL);
-
-/*****************************************************************************/
-
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual VCR Infomation"); n++;
- XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++;
- XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++;
- XtSetArg(args[n], XmNwidth, MINX); n++;
- XtSetArg(args[n], XmNheight, MINY); n++;
- /*
- infoshell = XtAppCreateShell("Info", "virtual_vcr",
- topLevelShellWidgetClass, display, args, n);
- */
- temp = XmCreateDialogShell(shell, "virtual_vcr", args, n);
- n = 0;
- XtSetArg(args[n], XmNtitle, "Virtual VCR Infomation"); n++;
-
- infoshell = XmCreateForm(temp, "virtual_vcr", args, n);
- infoload = mib_load_interface(infoshell, InfoMib,
- MI_FROMSTRING);
-
- temp = mib_find_name(infoload, "Dismiss")->me;
- XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) infoclose_callback,
- (XtPointer) NULL);
-
- temp = mib_find_name(infoload, "TextBig")->me;
- XtVaSetValues(temp, XmNcursorPositionVisible, False,
- XmNeditable, False, NULL);
- XmTextSetString(temp, infomessage);
-
- XmFontListFree (fontlist);
-
- parashell = CreateParameterWindow(shell);
-
- progshell = CreateProgramWindow(shell, cmdSocket, &playtag, frametext);
-
- fileshell = CreateFileWindow(shell, cmdSocket, &playtag, frametext);
-
-}
-
-/*****************************************************************************/
-
-Window MonitorWindow()
-{
- return monitorwindow;
-}
-
-/*****************************************************************************/
-
-void UISetColormap()
-{
- privcolormap = 1;
-}
-
-/*****************************************************************************/
-
-void UISetwin(Window win)
-{
- displaywin = win;
-}
-
-/*****************************************************************************/
-
-void UISetFrame()
-{
- char framestr[100];
-
- sprintf(framestr, "%d of %d", shared->currentDisplay, shared->totalFrames);
- XmTextFieldSetString(frametext, framestr);
-}
-
-/*****************************************************************************/
-
-void UIMinsize(int x, int y)
-{
- int minx;
- int miny;
- int winx;
- int winy;
-
- winx = x;
- winy = y;
-
- x += 30;
- y += 180;
-
- if (x < 450) x = MINX;
- if (y < 350) y = MINY;
-
- minx = x; miny = y;
-
- if (privcolormap)
- {
- XtVaSetValues(shell, XmNcolormap, cmap, NULL);
- }
- if (shell)
- {
- XtResizeWidget(shell, (Dimension)minx, (Dimension)miny, (Dimension)0);
- XtVaSetValues(shell,
- XmNminWidth, MINX,
- XmNminHeight, MINY,
- XmNmaxWidth, minx,
- XmNmaxHeight, miny,
- NULL);
-
- XtMapWidget(shell); /* Map the shell now to avoid disappearing buttons! */
- if (displaywin)
- {
- x = winx; y = winy;
- winx = minx - 30; winy = miny - 180;
- XMoveWindow(display, displaywin, (winx - x)/2, (winy - y)/2+12);
- }
- }
-}
-
-/*****************************************************************************
-
- From here on we have private methods:
-
- *****************************************************************************/
-
-static void exit_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- ACE_OS::exit (0);
-}
-
-
-static void info_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- /*
- XtRealizeWidget(infoshell);
- */
- XtManageChild(infoshell);
-}
-
-static void infoclose_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- /*
- XtUnrealizeWidget(infoshell);
- */
- XtUnmanageChild(infoshell);
-}
-
-static void para_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
-
- XtRealizeWidget(parashell);
- /*
- XtManageChild(parashell);
- */
-}
-
-static void prog_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
-
- XtRealizeWidget(progshell);
- /*
- XtManageChild(progshell);
- */
-}
-
-static void file_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- /*
- XtRealizeWidget(fileshell);
- */
- XtManageChild (fileshell);
-}
-
-/*****************************************************************************/
-
-static void loopchange_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- static int loop = 0;
- loop = !loop;
- if (playtag)
- {
- char cmd = loop ? CmdLOOPenable : CmdLOOPdisable;
- CmdWrite(&cmd, 1);
- }
- else
- beep();
-}
-
-static void normal_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-/* set speed bar, suppose speed_callback should be called automatically */
-{
- char cmd = CmdSPEED;
- int value = 50;
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Reached in %s line %d\n",__FILE__,__LINE__));
- XmScaleSetValue(speedscale, 50);
-}
-
-static void fb_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- if (playtag && !cmdBusy)
- {
- char cmd = CmdFB;
- cmdBusy = 1;
- CmdWrite(&cmd, 1);
- }
- else
- beep();
-}
-
-static void stop_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- if (playtag && !cmdBusy)
- {
- char cmd = CmdSTOP;
- cmdBusy = 1;
- CmdWrite(&cmd, 1);
- }
- else
- beep();
-}
-
-static void ff_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- if (playtag && !cmdBusy)
- {
- char cmd = CmdFF;
- cmdBusy = 1;
- CmdWrite(&cmd, 1);
- }
- else
- beep();
-}
-
-
-static void step_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- if (playtag && !cmdBusy)
- {
- char cmd = CmdSTEP;
- cmdBusy = 1;
- CmdWrite(&cmd, 1);
- }
- else {
- /*
- beep();
- */
- }
-}
-
-static void play_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- ACE_DEBUG ((LM_DEBUG,"(%P)play_callback:cmdbusy= %d,playtag=%d\n",cmdBusy,playtag));
- if (playtag && !cmdBusy)
- {
- char cmd = CmdPLAY;
- cmdBusy = 1;
- CmdWrite(&cmd, 1);
- }
- else
- beep();
-}
-
-static void volume_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- char cmd;
- XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs;
- int value = call_value ->value;
-
- switch (call_value->reason)
- {
- case XmCR_VALUE_CHANGED:
- case XmCR_DRAG:
- cmd = CmdVOLUME;
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- break;
- default:
- fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n");
- break;
- }
-}
-
-static void speed_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- char cmd;
- XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs;
- int value = call_value ->value;
-
- switch (call_value->reason)
- {
- case XmCR_VALUE_CHANGED:
- case XmCR_DRAG:
- cmd = CmdSPEED;
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- break;
- default:
- fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n");
- break;
- }
-}
-
-static void balance_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- char cmd;
- XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs;
- int value = call_value ->value;
-
- switch (call_value->reason)
- {
- case XmCR_VALUE_CHANGED:
- case XmCR_DRAG:
- cmd = CmdBALANCE;
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- break;
- default:
- fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n");
- break;
- }
-}
-
-static void position_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- char cmd;
- XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs;
- int value = call_value ->value;
-
- switch (call_value->reason)
- {
- case XmCR_VALUE_CHANGED:
- if (playtag && !cmdBusy)
- {
- cmdBusy = 1;
- cmd = CmdPOSITIONrelease;
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- }
- else
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Reached in %s line %d\n",__FILE__,__LINE__));
- XmScaleSetValue(positionscale, shared->locationPosition);
- /*
- fprintf(stderr, "UI: shared->cmd = %d\n", shared->cmd);
- if (shared->cmd != CmdPOSITION)
- beep();
- */
- }
-
- break;
- case XmCR_DRAG:
- if (playtag && !cmdBusy)
- {
- cmdBusy = 1;
- cmd = CmdPOSITION;
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- }
- break;
- default:
- fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n");
- break;
- }
-}
-
-static void cmdSocket_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs)
-{
- char cmd;
-/*
- fprintf(stderr, "UI in CmdSocket_callback.\n");
-*/
- while (read(cmdSocket, &cmd, 1) <= 0)
- {
- if (errno == EINTR) return;
- ACE_OS::perror ("UI by callback read from CmdSocket");
- ACE_OS::exit (1);
- }
- // ACE_DEBUG ((LM_DEBUG,"(%P)cmdSocket_callback:cmd= %d",cmd));
- if (cmd == CmdDONE || cmd == CmdFAIL)
- {
- cmdBusy = 0;
- if (shared->cmd == CmdINIT)
- {
- if (cmd == CmdDONE)
- {
- char cmd = CmdSPEED;
- int value = 50;
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Reached in %s line %d\n",__FILE__,__LINE__));
- XmScaleSetValue(speedscale, 50);
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Reached in %s line %d\n",__FILE__,__LINE__));
- XmScaleSetValue(positionscale, 0);
- CmdWrite(&cmd, 1);
- CmdWrite((char *)&value, 4);
- /*
- fprintf(stderr, "UI: VCR program successfully initialized.\n");
- */
- playtag = 1;
- }
- else
- {
- fprintf(stderr, "UI: VCR program initialization failed.\n");
- playtag = 0;
- }
- }
- else {
- /*
- fprintf(stderr, "UI: cmd-%d finished successfully.\n", shared->cmd);
- */
- }
- /*
- UISetFrame();
- */
- }
- else
- {
- static int prepos = 0;
- int curpos;
- char * ptr;
-
- if (cmd == CmdVPdisplayFrame) {
- ACE_OS::read (cmdSocket, (char *)&ptr, sizeof(char *));
- }
- VPcommand((int)cmd, ptr);
-
- if (cmd == CmdVPaudioPosition)
- {
- curpos = (shared->nextSample * 100) / shared->totalSamples;
- if (shared->cmd == CmdPLAY &&
- (curpos <= prepos - 1 || curpos >= prepos + 1))
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Reached in %s line %d,positionscale = %d,curpos = %d\n",
- // __FILE__,__LINE__,positionscale,curpos));
- XmScaleSetValue(positionscale, curpos);
- prepos = curpos;
- }
- }
- else if (cmd == CmdVPdisplayFrame && shared->totalFrames)
- {
- curpos = (shared->currentDisplay * 100) / shared->totalFrames;
- if ((shared->cmd == CmdSTEP || shared->cmd == CmdPLAY ||
- shared->cmd == CmdFF || shared->cmd == CmdFB) &&
- (curpos <= prepos - 1 || curpos >= prepos + 1))
- {
- // ACE_DEBUG ((LM_DEBUG,"(%P|%t) Reached in %s line %d\n",__FILE__,__LINE__));
- XmScaleSetValue(positionscale, curpos);
- prepos = curpos;
- }
- }
- }
-}
-
-static void monitor_expose(Widget w, XtPointer data,
- XmDrawingAreaCallbackStruct *cbs)
-{
- VPexpose();
-}
-
-#define BUFSIZE 256
-
-void UIprocess(int cmdSock)
-{
- char *title, *vh, *vf, *vb, *ah, *af, *ab;
- int i;
- cmdSocket = cmdSock;
- UICreate();
-
- VPinitWindow(shell, monitorwindow, cmdSock);
- XtAppAddInput(App, cmdSock, (XtPointer)XtInputReadMask,
- (XtInputCallbackProc)cmdSocket_callback, NULL);
-
- title = vh = vf = vb = ah = af = ab = NULL;
-
- for (i = 1; i < argc_share; i++) {
- if (ACE_OS::strcmp (argv_share[i], "-v") == 0) {
- if (argc_share > i + 1) {
- i ++;
- vh = argv_share[i];
- cerr << "vh = " << vh << endl;
- }
- else break;
- }
- else if (ACE_OS::strcmp (argv_share[i], "-a") == 0) {
- if (argc_share > i + 1) {
- i ++;
- ah = argv_share[i];
- cerr << "ah = " << ah << endl;
- }
- else break;
- }
- else if (ACE_OS::strcmp (argv_share[i], "-p") == 0) {
- if (argc_share > i + 1) {
- i ++;
- title = argv_share[i];
- }
- }
- }
-
- if (title != NULL) { /* the init program is supplied by -l */
- cerr << "title is not null \n";
- FILE * fp;
- char buf[PATH_SIZE];
- char vh[PATH_SIZE];
- char vf[PATH_SIZE];
- char ah[PATH_SIZE];
- char af[PATH_SIZE];
-
- get_full_path(title, buf, 256);
- fp = fopen(buf, "r");
- if (fp != NULL) {
- if ((!feof(fp)) && fgets(buf, PATH_SIZE, fp) != NULL) {
- buf[strlen(buf)-1] = 0;
- }
- else buf[0] = 0;
- if ((!feof(fp)) && fgets(vh, PATH_SIZE, fp) != NULL) {
- vh[strlen(vh)-1] = 0;
- }
- else vh[0] = 0;
- if ((!feof(fp)) && fgets(vf, PATH_SIZE, fp) != NULL) {
- vf[strlen(vf)-1] = 0;
- }
- else vf[0] = 0;
- if ((!feof(fp)) && fgets(ah, PATH_SIZE, fp) != NULL) {
- ah[strlen(ah)-1] = 0;
- }
- else ah[0] = 0;
- if ((!feof(fp)) && fgets(af, PATH_SIZE, fp) != NULL) {
- af[strlen(af)-1] = 0;
- }
- else af[0] = 0;
-
- fclose(fp);
- Fprintf(stderr, "Init program: title %s, vh %s, vf %s, ah %s, af %s\n",
- buf, vh, vf, ah, af);
- StartProgram(buf, vh, vf, ah, af);
- }
- }
- else if (vh != NULL || ah != NULL) {/* init program supplied by -v and -a */
- char *ptr;
-
- /* form the title */
- if (vh != NULL) {
- title = (char *)ACE_OS::malloc(strlen(vh) + 1);
- if (title != NULL) {
- strcpy(title, vh);
- }
- }
- else {
- title = (char *)ACE_OS::malloc(strlen(ah) + 1);
- if (title != NULL) {
- strcpy(title, ah);
- }
- }
- if (title == NULL) {
- title = "The program from the command line";
- }
-
- /* generate vh and vf */
- if (vh != NULL) {
- if ((ptr = strchr(vh, ':')) != NULL) {
- * ptr = 0;
- vf = ptr + 1;
- }
- else {
- vf = vh;
- vh = "";
- }
- }
- else vh = vf = "";
-
- /* generate ah and af */
- if (ah != NULL) {
- if ((ptr = strchr(ah, ':')) != NULL) {
- * ptr = 0;
- af = ptr + 1;
- }
- else {
- af = ah;
- ah = "";
- }
- }
- else ah = af = "";
-
- fprintf(stderr, "Init program: title %s, vh %s, vf %s, ah %s, af %s\n",
- title, vh, vf, ah, af);
- StartProgram(title, vh, vf, ah, af);
- ACE_OS::free (title);
- if (ab != NULL) ACE_OS::free (ab);
- if (vb != NULL) ACE_OS::free (vb);
- }
-
- XtAppMainLoop(App);
-}
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h
deleted file mode 100644
index a77b5fdbb4e..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $Id$ */
-/* Copyright (c) 1994 The Geometry Center; University of Minnesota
- 1300 South Second Street; Minneapolis, MN 55454, USA;
-
-This file is free software; you can redistribute it and/or modify it only
-under the the terms of the GNU GENERAL PUBLIC LICENSE which should be
-included along with this file. This software may be obtained via anonymous
-ftp from geom.umn.edu; email: software@geom.umn.edu. */
-
-/* Author: Daeron Meyer */
-
-void UICreate();
-void UIEnd();
-Window MonitorWindow();
-void UISetwin(Window);
-void UIMinsize(int, int);
-void UISetFrame();
-void UISetColormap();
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp
deleted file mode 100644
index 8fc6ac680b6..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <stdlib.h>
-#include "video.h"
-#include "proto.h"
-#include "util.h"
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, util, "$Id$")
-
-#define TRUE 1
-#define FALSE 0
-
-/* Declarations of global variables used. */
-
-unsigned int curBits;
-int bitOffset;
-int bufLength;
-unsigned int *bitBuffer;
-
-/* Bit masks used by bit i/o operations. */
-
-unsigned int nBitMask[] = { 0x00000000, 0x80000000, 0xc0000000, 0xe0000000,
- 0xf0000000, 0xf8000000, 0xfc000000, 0xfe000000,
- 0xff000000, 0xff800000, 0xffc00000, 0xffe00000,
- 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000,
- 0xffff0000, 0xffff8000, 0xffffc000, 0xffffe000,
- 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00,
- 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0,
- 0xfffffff0, 0xfffffff8, 0xfffffffc, 0xfffffffe};
-
-unsigned int bitMask[] = { 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff,
- 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff,
- 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff,
- 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff,
- 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff,
- 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff,
- 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f,
- 0x0000000f, 0x00000007, 0x00000003, 0x00000001};
-
-unsigned int rBitMask[] = { 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8,
- 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80,
- 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800,
- 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000,
- 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000,
- 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000,
- 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000,
- 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000};
-
-unsigned int bitTest[] = { 0x80000000, 0x40000000, 0x20000000, 0x10000000,
- 0x08000000, 0x04000000, 0x02000000, 0x01000000,
- 0x00800000, 0x00400000, 0x00200000, 0x00100000,
- 0x00080000, 0x00040000, 0x00020000, 0x00010000,
- 0x00008000, 0x00004000, 0x00002000, 0x00001000,
- 0x00000800, 0x00000400, 0x00000200, 0x00000100,
- 0x00000080, 0x00000040, 0x00000020, 0x00000010,
- 0x00000008, 0x00000004, 0x00000002, 0x00000001};
-
-
-/*
- *--------------------------------------------------------------
- *
- * correct_underflow --
- *
- * Called when buffer does not have sufficient data to
- * satisfy request for bits.
- * Calls get_more_data, an application specific routine
- * required to fill the buffer with more data.
- *
- * Results:
- * None really.
- *
- * Side effects:
- * buf_length and buffer fields in curVidStream structure
- * may be changed.
- *
- *--------------------------------------------------------------
- */
-
-void
-correct_underflow() {
-
- int status;
-
- status = get_more_data(curVidStream->buf_start,
- curVidStream->max_buf_length,
- &bufLength, &bitBuffer);
-
- if (status < 0) {
- if (!quietFlag) {
- fprintf (stderr, "\n");
- ACE_OS::perror ("Unexpected read error.");
- }
- ACE_OS::exit (1);
- }
- else if ((status == 0) && (bufLength < 1)) {
- if (!quietFlag) {
- fprintf(stderr, "\nImproper or missing sequence end code.\n");
- }
-#ifdef ANALYSIS
- PrintAllStats();
-#endif
- if (!quietFlag) {
- PrintTimeInfo();
- }
-/*
- if (loopFlag) longjmp(env, 1);
- DestroyVidStream(curVidStream);
-*/
- ACE_OS::exit (0);
- }
-#ifdef UTIL2
- curBits = *bitBuffer << bitOffset;
-#else
- curBits = *bitBuffer;
-#endif
-
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * next_bits --
- *
- * Compares next num bits to low order position in mask.
- * Buffer pointer is NOT advanced.
- *
- * Results:
- * TRUE, FALSE, or error code.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-int next_bits(int num, unsigned int mask)
-{
- unsigned int stream;
- int ret_value;
-
- /* If no current stream, return error. */
-
- if (curVidStream == NULL)
- return NO_VID_STREAM;
-
- /* Get next num bits, no buffer pointer advance. */
-
- show_bitsn(num, stream);
-
- /* Compare bit stream and mask. Set return value toTRUE if equal, FALSE if
- differs.
- */
-
- if (mask == stream) {
- ret_value = TRUE;
- } else ret_value = FALSE;
-
- /* Return return value. */
-
- return ret_value;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * get_ext_data --
- *
- * Assumes that bit stream is at begining of extension
- * data. Parses off extension data into dynamically
- * allocated space until start code is hit.
- *
- * Results:
- * Pointer to dynamically allocated memory containing
- * extension data.
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-char *get_ext_data ()
-{
- int size, marker;
- char *dataPtr;
- unsigned int data;
-
- /* Set initial ext data buffer size. */
-
- size = EXT_BUF_SIZE;
-
- /* Allocate ext data buffer. */
-
- dataPtr = (char *) ACE_OS::malloc(size);
-
- /* Initialize marker to keep place in ext data buffer. */
-
- marker = 0;
-
- /* While next data is not start code... */
- while (!next_bits(24, 0x000001)) {
-
- /* Get next byte of ext data. */
-
- get_bits8(data);
-
- /* Put ext data into ext data buffer. Advance marker. */
-
- dataPtr[marker] = (char) data;
- marker++;
-
- /* If end of ext data buffer reached, resize data buffer. */
-
- if (marker == size) {
- size += EXT_BUF_SIZE;
- dataPtr = (char *) realloc(dataPtr, size);
- }
- }
-
- /* Realloc data buffer to free any extra space. */
-
- dataPtr = (char *) realloc(dataPtr, marker);
-
- /* Return pointer to ext data buffer. */
-
- return dataPtr;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * next_start_code --
- *
- * Parses off bitstream until start code reached. When done
- * next 4 bytes of bitstream will be start code. Bit offset
- * reset to 0.
- *
- * Results:
- * Status code.
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-int next_start_code()
-{
- int state;
- int byteoff;
- unsigned int data;
-
- /* If no current stream, return error. */
-
- if (curVidStream == NULL)
- return NO_VID_STREAM;
-
- /* If insufficient buffer length, correct underflow. */
-/*
- if (bufLength < 2) {
- correct_underflow();
- }
- */
-
- /* If bit offset not zero, reset and advance buffer pointer. */
-
- byteoff = bitOffset % 8;
-
- if (byteoff != 0) {
- flush_bits((8-byteoff));
- }
-
- /* Set state = 0. */
-
- state = 0;
-
- /* While buffer has data ... */
-
- while(bufLength > 0) {
-
- /* If insufficient data exists, correct underflow. */
-/*
- if (bufLength < 2) {
- correct_underflow();
- }
-*/
- /* If next byte is zero... */
-
- get_bits8(data);
-
- if (data == 0) {
-
- /* If state < 2, advance state. */
-
- if (state < 2) state++;
- }
-
- /* If next byte is one... */
-
- else if (data == 1) {
-
- /* If state == 2, advance state (i.e. start code found). */
-
- if (state == 2) state++;
-
- /* Otherwise, reset state to zero. */
-
- else state = 0;
- }
-
- /* Otherwise byte is neither 1 or 0, reset state to 0. */
-
- else {
- state = 0;
- }
-
- /* If state == 3 (i.e. start code found)... */
-
- if (state == 3) {
-
- /* Set buffer pointer back and reset length & bit offsets so
- next bytes will be beginning of start code.
- */
-
- bitOffset = bitOffset - 24;
-
-#ifdef ANALYSIS
- bitCount -= 24;
-#endif
-
- if (bitOffset < 0) {
- bitOffset = 32 + bitOffset;
- bufLength++;
- bitBuffer--;
-#ifdef UTIL2
- curBits = *bitBuffer << bitOffset;
-#else
- curBits = *bitBuffer;
-#endif
- }
- else {
-#ifdef UTIL2
- curBits = *bitBuffer << bitOffset;
-#else
- curBits = *bitBuffer;
-#endif
- }
-
- /* Return success. */
-
- return OK;
- }
- }
-
- /* Return underflow error. */
-
- return UNDERFLOW;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * get_extra_bit_info --
- *
- * Parses off extra bit info stream into dynamically
- * allocated memory. Extra bit info is indicated by
- * a flag bit set to 1, followed by 8 bits of data.
- * This continues until the flag bit is zero. Assumes
- * that bit stream set to first flag bit in extra
- * bit info stream.
- *
- * Results:
- * Pointer to dynamically allocated memory with extra
- * bit info in it. Flag bits are NOT included.
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-char *get_extra_bit_info ()
-{
- int size, marker;
- char *dataPtr;
- unsigned int data;
-
- /* Get first flag bit. */
- get_bits1(data);
-
- /* If flag is false, return NULL pointer (i.e. no extra bit info). */
-
- if (!data) return NULL;
-
- /* Initialize size of extra bit info buffer and allocate. */
-
- size = EXT_BUF_SIZE;
- dataPtr = (char *) ACE_OS::malloc(size);
-
- /* Reset marker to hold place in buffer. */
-
- marker = 0;
-
- /* While flag bit is true. */
-
- while (data) {
-
- /* Get next 8 bits of data. */
- get_bits8(data);
-
- /* Place in extra bit info buffer. */
-
- dataPtr[marker] = (char) data;
- marker++;
-
- /* If buffer is full, reallocate. */
-
- if (marker == size) {
- size += EXT_BUF_SIZE;
- dataPtr = (char *) realloc(dataPtr, size);
- }
-
- /* Get next flag bit. */
- get_bits1(data);
- }
-
- /* Reallocate buffer to free extra space. */
-
- dataPtr = (char *) realloc(dataPtr, marker);
-
- /* Return pointer to extra bit info buffer. */
-
- return dataPtr;
-}
-
-
-
-
-
-
-
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h
deleted file mode 100644
index 3c68ea365cd..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* Status codes for bit stream i/o operations. */
-
-#ifndef AV_UTIL_H
-#define AV_UTIL_H
-
-#define NO_VID_STREAM -1
-#define UNDERFLOW -2
-#define OK 1
-/* Size increment of extension data buffers. */
-
-#define EXT_BUF_SIZE 1024
-
-/* External declarations for bitstream i/o operations. */
-extern unsigned int bitMask[];
-extern unsigned int nBitMask[];
-extern unsigned int rBitMask[];
-extern unsigned int bitTest[];
-
-/* External declarations of bitstream global variables. */
-extern unsigned int curBits;
-extern int bitOffset;
-extern int bufLength;
-extern unsigned int *bitBuffer;
-
-/* Macro for updating bit counter if analysis tool is on. */
-#ifdef ANALYSIS
-#define UPDATE_COUNT(numbits) bitCount += numbits
-#else
-#define UPDATE_COUNT(numbits)
-#endif
-
-#ifdef NO_SANITY_CHECKS
-#define get_bits1(result) \
-{ \
- UPDATE_COUNT(1); \
- result = ((curBits & 0x80000000) != 0); \
- curBits <<= 1; \
- bitOffset++; \
- \
- if (bitOffset & 0x20) { \
- bitOffset = 0; \
- bitBuffer++; \
- curBits = *bitBuffer; \
- bufLength--; \
- } \
-}
-
-#define get_bits2(result) \
-{ \
- UPDATE_COUNT(2); \
- bitOffset += 2; \
- \
- if (bitOffset & 0x20) { \
- bitOffset -= 32; \
- bitBuffer++; \
- bufLength--; \
- if (bitOffset) { \
- curBits |= (*bitBuffer >> (2 - bitOffset)); \
- } \
- result = ((curBits & 0xc0000000) >> 30); \
- curBits = *bitBuffer << bitOffset; \
- } \
- \
- result = ((curBits & 0xc0000000) >> 30); \
- curBits <<= 2; \
-}
-
-#define get_bitsX(num, mask, shift, result) \
-{ \
- UPDATE_COUNT(num); \
- bitOffset += num; \
- \
- if (bitOffset & 0x20) { \
- bitOffset -= 32; \
- bitBuffer++; \
- bufLength--; \
- if (bitOffset) { \
- curBits |= (*bitBuffer >> (num - bitOffset)); \
- } \
- result = ((curBits & mask) >> shift); \
- curBits = *bitBuffer << bitOffset; \
- } \
- else { \
- result = ((curBits & mask) >> shift); \
- curBits <<= num; \
- } \
-}
-#else
-
-#define get_bits1(result) \
-{ \
- /* Check for underflow. */ \
- /* \
- if (bufLength < 2) { \
- correct_underflow(); \
- } */ \
- UPDATE_COUNT(1); \
- result = ((curBits & 0x80000000) != 0); \
- curBits <<= 1; \
- bitOffset++; \
- \
- if (bitOffset & 0x20) { \
- bitOffset = 0; \
- bitBuffer++; \
- curBits = *bitBuffer; \
- bufLength--; \
- } \
-}
-
-#define get_bits2(result) \
-{ \
- /* Check for underflow. */ \
- /* \
- if (bufLength < 2) { \
- correct_underflow(); \
- } */ \
- UPDATE_COUNT(2); \
- bitOffset += 2; \
- \
- if (bitOffset & 0x20) { \
- bitOffset -= 32; \
- bitBuffer++; \
- bufLength--; \
- if (bitOffset) { \
- curBits |= (*bitBuffer >> (2 - bitOffset)); \
- } \
- result = ((curBits & 0xc0000000) >> 30); \
- curBits = *bitBuffer << bitOffset; \
- } \
- \
- result = ((curBits & 0xc0000000) >> 30); \
- curBits <<= 2; \
-}
-
-#define get_bitsX(num, mask, shift, result) \
-{ \
- /* Check for underflow. */ \
- /* \
- if (bufLength < 2) { \
- correct_underflow(); \
- } */ \
- UPDATE_COUNT(num); \
- bitOffset += num; \
- \
- if (bitOffset & 0x20) { \
- bitOffset -= 32; \
- bitBuffer++; \
- bufLength--; \
- if (bitOffset) { \
- curBits |= (*bitBuffer >> (num - bitOffset)); \
- } \
- result = ((curBits & mask) >> shift); \
- curBits = *bitBuffer << bitOffset; \
- } \
- else { \
- result = ((curBits & mask) >> shift); \
- curBits <<= num; \
- } \
-}
-#endif
-
-#define get_bits3(result) get_bitsX(3, 0xe0000000, 29, result)
-#define get_bits4(result) get_bitsX(4, 0xf0000000, 28, result)
-#define get_bits5(result) get_bitsX(5, 0xf8000000, 27, result)
-#define get_bits6(result) get_bitsX(6, 0xfc000000, 26, result)
-#define get_bits7(result) get_bitsX(7, 0xfe000000, 25, result)
-#define get_bits8(result) get_bitsX(8, 0xff000000, 24, result)
-#define get_bits9(result) get_bitsX(9, 0xff800000, 23, result)
-#define get_bits10(result) get_bitsX(10, 0xffc00000, 22, result)
-#define get_bits11(result) get_bitsX(11, 0xffe00000, 21, result)
-#define get_bits12(result) get_bitsX(12, 0xfff00000, 20, result)
-#define get_bits14(result) get_bitsX(14, 0xfffc0000, 18, result)
-#define get_bits16(result) get_bitsX(16, 0xffff0000, 16, result)
-#define get_bits18(result) get_bitsX(18, 0xffffc000, 14, result)
-#define get_bits32(result) get_bitsX(32, 0xffffffff, 0, result)
-
-#define get_bitsn(num, result) get_bitsX((num), nBitMask[num], (32-(num)), result)
-
-#ifdef NO_SANITY_CHECKS
-#define show_bits32(result) \
-{ \
- if (bitOffset) { \
- result = curBits | (*(bitBuffer+1) >> (32 - bitOffset)); \
- } \
- else { \
- result = curBits; \
- } \
-}
-
-#define show_bitsX(num, mask, shift, result) \
-{ \
- int bO; \
- bO = bitOffset + num; \
- if (bO > 32) { \
- bO -= 32; \
- result = ((curBits & mask) >> shift) | \
- (*(bitBuffer+1) >> (shift + (num - bO))); \
- } \
- else { \
- result = ((curBits & mask) >> shift); \
- } \
-}
-
-#else
-#define show_bits32(result) \
-{ \
- /* Check for underflow. */ \
- /* if (bufLength < 2) { \
- correct_underflow(); \
- } */ \
- if (bitOffset) { \
- result = curBits | (*(bitBuffer+1) >> (32 - bitOffset)); \
- } \
- else { \
- result = curBits; \
- } \
-}
-
-#define show_bitsX(num, mask, shift, result) \
-{ \
- int bO; \
- \
- /* Check for underflow. */ \
- /* if (bufLength < 2) { \
- correct_underflow(); \
- } */ \
- bO = bitOffset + num; \
- if (bO > 32) { \
- bO -= 32; \
- result = ((curBits & mask) >> shift) | \
- (*(bitBuffer+1) >> (shift + (num - bO))); \
- } \
- else { \
- result = ((curBits & mask) >> shift); \
- } \
-}
-#endif
-
-#define show_bits1(result) show_bitsX(1, 0x80000000, 31, result)
-#define show_bits2(result) show_bitsX(2, 0xc0000000, 30, result)
-#define show_bits3(result) show_bitsX(3, 0xe0000000, 29, result)
-#define show_bits4(result) show_bitsX(4, 0xf0000000, 28, result)
-#define show_bits5(result) show_bitsX(5, 0xf8000000, 27, result)
-#define show_bits6(result) show_bitsX(6, 0xfc000000, 26, result)
-#define show_bits7(result) show_bitsX(7, 0xfe000000, 25, result)
-#define show_bits8(result) show_bitsX(8, 0xff000000, 24, result)
-#define show_bits9(result) show_bitsX(9, 0xff800000, 23, result)
-#define show_bits10(result) show_bitsX(10, 0xffc00000, 22, result)
-#define show_bits11(result) show_bitsX(11, 0xffe00000, 21, result)
-#define show_bits12(result) show_bitsX(12, 0xfff00000, 20, result)
-#define show_bits13(result) show_bitsX(13, 0xfff80000, 19, result)
-#define show_bits14(result) show_bitsX(14, 0xfffc0000, 18, result)
-#define show_bits15(result) show_bitsX(15, 0xfffe0000, 17, result)
-#define show_bits16(result) show_bitsX(16, 0xffff0000, 16, result)
-#define show_bits17(result) show_bitsX(17, 0xffff8000, 15, result)
-#define show_bits18(result) show_bitsX(18, 0xffffc000, 14, result)
-#define show_bits19(result) show_bitsX(19, 0xffffe000, 13, result)
-#define show_bits20(result) show_bitsX(20, 0xfffff000, 12, result)
-#define show_bits21(result) show_bitsX(21, 0xfffff800, 11, result)
-#define show_bits22(result) show_bitsX(22, 0xfffffc00, 10, result)
-#define show_bits23(result) show_bitsX(23, 0xfffffe00, 9, result)
-#define show_bits24(result) show_bitsX(24, 0xffffff00, 8, result)
-#define show_bits25(result) show_bitsX(25, 0xffffff80, 7, result)
-#define show_bits26(result) show_bitsX(26, 0xffffffc0, 6, result)
-#define show_bits27(result) show_bitsX(27, 0xffffffe0, 5, result)
-#define show_bits28(result) show_bitsX(28, 0xfffffff0, 4, result)
-#define show_bits29(result) show_bitsX(29, 0xfffffff8, 3, result)
-#define show_bits30(result) show_bitsX(30, 0xfffffffc, 2, result)
-#define show_bits31(result) show_bitsX(31, 0xfffffffe, 1, result)
-
-#define show_bitsn(num,result) show_bitsX((num), (0xffffffff << (32-(num))), (32-(num)), result)
-
-#ifdef NO_SANITY_CHECKS
-#define flush_bits32 \
-{ \
- UPDATE_COUNT(32); \
- \
- bitBuffer++; \
- bufLength--; \
- curBits = *bitBuffer << bitOffset; \
-}
-
-#define flush_bits(num) \
-{ \
- bitOffset += num; \
- \
- UPDATE_COUNT(num); \
- \
- if (bitOffset & 0x20) { \
- bitOffset -= 32; \
- bitBuffer++; \
- bufLength--; \
- curBits = *bitBuffer << bitOffset; \
- } \
- else { \
- curBits <<= num; \
- } \
-}
-#else
-#define flush_bits32 \
-{ \
- if (curVidStream == NULL) { \
- /* Deal with no vid stream here. */ \
- } \
- /* \
- if (bufLength < 2) { \
- correct_underflow(); \
- } \
- */ \
- UPDATE_COUNT(32); \
- \
- bitBuffer++; \
- bufLength--; \
- curBits = *bitBuffer << bitOffset; \
-}
-
-#define flush_bits(num) \
-{ \
- if (curVidStream == NULL) { \
- /* Deal with no vid stream here. */ \
- } \
- /* \
- if (bufLength < 2) { \
- correct_underflow(); \
- } \
- */ \
- UPDATE_COUNT(num); \
- \
- bitOffset += num; \
- \
- if (bitOffset & 0x20) { \
- bufLength--; \
- bitOffset -= 32; \
- bitBuffer++; \
- curBits = *bitBuffer << bitOffset; \
- } \
- else { \
- curBits <<= num; \
- } \
-}
-#endif
-
-#define UTIL2
-
-#endif /* if !defined (AV_UTIL_H) */
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp
deleted file mode 100644
index 8ac1762823f..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $Id$ */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "video.h"
-#include "proto.h"
-#include "ui.h" /* include user interface */
-#include "ace/OS.h"
-
-ACE_RCSID(mpeg_client, util32, "$Id$")
-
-/*
- * Return a pointer to a full color bit visual on the dpy
- */
-Visual *
-FindFullColorVisual (Display *dpy, int *depth)
-{
- XVisualInfo vinfo;
- XVisualInfo *vinfo_ret;
- int numitems, maxdepth;
-
-#ifdef __cplusplus
- vinfo.c_class = TrueColor;
-#else
- vinfo.class = TrueColor;
-#endif
- vinfo_ret = XGetVisualInfo(dpy, VisualClassMask, &vinfo, &numitems);
-
- if (numitems == 0) return NULL;
-
- maxdepth = 0;
- while(numitems > 0) {
- if (vinfo_ret[numitems-1].depth > maxdepth) {
- maxdepth = vinfo_ret[numitems-1 ].depth;
- }
- numitems--;
- }
- XFree(vinfo_ret);
-
- if (maxdepth < 24) return NULL;
-
- if (XMatchVisualInfo(dpy, DefaultScreen(dpy), maxdepth,
- TrueColor, &vinfo)) {
- *depth = maxdepth;
- return vinfo.visual;
- }
-
- return NULL;
-}
-
-Window
-CreateFullColorWindow (Display *dpy, int x, int y, int w, int h)
-{
- int depth;
- Visual *visual;
- XSetWindowAttributes xswa;
- Window temp;
- unsigned int mask;
- unsigned int valclass;
- int screen;
-
- screen = XDefaultScreen(dpy);
- valclass = InputOutput; /* Could be InputOnly */
- visual = FindFullColorVisual (dpy, &depth);
- if (visual == NULL) {
- return 0;
- }
- mask = CWBackPixel | CWColormap | CWBorderPixel;
- xswa.colormap = XCreateColormap(dpy, XRootWindow(dpy, screen),
- visual, AllocNone);
- xswa.background_pixel = BlackPixel(dpy, DefaultScreen(dpy));
- xswa.border_pixel = WhitePixel(dpy, DefaultScreen(dpy));
-
- temp = XCreateWindow(dpy, MonitorWindow(), x, y, w, h,
- 1, depth, valclass, visual, mask, &xswa);
-
- UISetwin(temp);
-
- return temp;
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp
deleted file mode 100644
index 0f2ab37c5af..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp
+++ /dev/null
@@ -1,1129 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-extern int vsp[2];
-extern void set_exit_routine_tag(int tag);
-
-#include "vb.h"
-
-ACE_RCSID(mpeg_client, vb, "$Id$")
-
-block ** VideoBuffer::head = 0;
-block ** VideoBuffer::tail = 0;
-char * VideoBuffer::buf = 0;
-int VideoBuffer::bufsize = -1;
-int VideoBuffer::sid = -1;
-int VideoBuffer::countid = -1;
-int VideoBuffer::exit_tag = -1;
-int VideoBuffer::conn_tag = -1;
-int VideoBuffer::savedSocket = -1;
-
-//constructor.
-VideoBuffer::VideoBuffer (void)
- :msg (0),
- packet (0),
- msgsn (-1),
- ptr (0),
- ptr1 (0),
- tmp_buf (0),
- cmdsn (-1),
- fb_state (0),
- qosRecomputes (0),
- f (0),
- fa (0),
- reach_limit (0),
- not_action (1)
-#ifdef STAT
- ,to_count (1),
- gap_msgsn (-1)
-#endif
-{
-}
-
-// Destructor.
-VideoBuffer::~VideoBuffer (void)
-{
- if (ACE_Reactor::instance ()->remove_handler (this->handler_,ACE_Event_Handler::READ_MASK) == -1)
- ACE_DEBUG ((LM_ERROR,"(%P)remove handler failed for Video_Notification_Handler\n"));
-
- delete this->handler_;
- if (ACE_Reactor::instance ()->remove_handler (this,ACE_Event_Handler::READ_MASK) == -1)
- ACE_DEBUG ((LM_ERROR,"(%P)remove handler failed for VideoBuffer\n"));
-}
-
-/* size in byte */
-void
-VideoBuffer::VBinitBuf (int size)
-{
- bufsize = size - sizeof(struct header);
- buf = creat_shared_mem(size);
- head = &((struct header *)buf)->h;
- tail = &((struct header *)buf)->t;
- buf += sizeof(struct header);
- sid = creat_semaphore();
- countid = creat_semaphore();
- enter_cs(countid);
- *head = *tail = (struct block *)buf;
- (*tail)->full = 0;
- (*tail)->next = NULL;
- (*tail)->shcode = SHCODE;
-}
-
-/* block version */
-char*
-VideoBuffer::VBgetBuf (int size)
-{
- return 0;
-}
-
-/* non-block check, return True/False*/
-int
-VideoBuffer::VBcheckBuf (int size)
-{
- return 0;
-}
-
-void
-VideoBuffer::VBputMsg (char * msgPtr)
-{
-}
-
-/* block version */
-char *
-VideoBuffer::VBgetMsg ()
-{
- char *vb_ptr;
-
-#ifdef STAT
- if (shared->collectStat && *head == *tail)
- shared->stat.VBemptyTimes ++;
-#endif
- // ACE_DEBUG ((LM_DEBUG,"(%P)waiting for countid\n"));
- enter_cs(countid);
- enter_cs(sid);
- while (*tail != *head && (*tail)->full == 0)
- *tail = (*tail)->next;
- leave_cs(sid);
- if (*head == *tail)
- {
- fprintf(stderr, "VB: getMsg run out of msg unexpectedly.\n");
- ACE_OS::exit (1);
- }
- vb_ptr = ((char*)*tail)+sizeof(**tail)+sizeof(VideoMessage);
-
- // fprintf(stderr,"VBgetMsg: buf:%x, msg:%x\n", (int)buf, (int)vb_ptr);
-
- return vb_ptr;
-}
-
-/* non-block check, return Number of Msgs in buffer */
-int
-VideoBuffer::VBcheckMsg ()
-{
- return get_semval(countid);
-}
-
-int
-VideoBuffer::VBbufEmpty (void)
-{
- /*
- Fprintf(stderr, "VB countid %d\n", get_semval(countid));
- */
- return get_semval(countid) <= 0;
-}
-
-void
-VideoBuffer::VBreclaimMsg (char * msgPtr)
-{
- enter_cs(sid);
- *tail = (*tail)->next;
- leave_cs(sid);
-}
-
-void
-VideoBuffer::VBdeleteBuf (void)
-{
- remove_shared_mem (buf - sizeof(struct header));
-}
-
-void
-VideoBuffer::VBdeleteSem (void)
-{
- remove_semaphore(sid);
- remove_semaphore(countid);
-}
-
-int
-VideoBuffer::VBprocess (int init_socket, int normal_socket)
-{
- this->initSocket = init_socket;
- this->normalSocket = normal_socket;
- msgsn = -1;
- dataSocket = initSocket;
- exit_tag = 0;
- conn_tag = shared->videoMaxPktSize;
- savedSocket = normalSocket;
-
- // ACE_DEBUG ((LM_DEBUG,"VideoBuffer::VBProcess ()\n"));
- /* buffer big enough for discard mode packet stream */
- if (conn_tag < 0)
- {
- tmp_buf = (char *)ACE_OS::malloc(-conn_tag);
- if (tmp_buf == NULL) {
- fprintf(stderr, "AB failed to allocate %d bytes");
- ACE_OS::perror ("of tmp_buf");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- }
-
- ACE_NEW_RETURN (this->handler_,
- Video_Notification_Handler (),
- -1);
-
- // Register the notification handler with the reactor.
- int result = ACE_Reactor::instance ()->register_handler (this->handler_,
- ACE_Event_Handler::READ_MASK);
- if (result != 0)
- return result;
-
- result = ACE_Reactor::instance ()->register_handler (this,
- ACE_Event_Handler::READ_MASK);
-
- if (result != 0)
- return result;
-
- this->state_ = READ_HEADER;
- temp = (char *)&msghd;
- bytes = sizeof (msghd);
- return 0;
-}
-
-ACE_HANDLE
-VideoBuffer::get_handle (void) const
-{
- if (this->socket_flag_)
- return this->normalSocket;
- else
- return this->initSocket;
-}
-
-int
-VideoBuffer::handle_input (ACE_HANDLE fd)
-{
- // ACE_DEBUG ((LM_DEBUG,"VideoBuffer::handle_input:state = %d\n",this->state_));
- switch (this->state_)
- {
- case READ_NEXT_HEADER:
- case READ_HEADER:
- {
- if (conn_tag >= 0)
- len = ACE_OS::read (dataSocket,temp,bytes);
- else
- {
- len = ACE_OS::read (dataSocket,tmp_buf,-conn_tag);
- // fprintf (stderr,"VB read packet len = %d\n",len);
- ACE_OS::memcpy ((char *)&msghd, tmp_buf, sizeof(msghd));
- }
- if (len == -1) {
- if (errno == EWOULDBLOCK || errno == EAGAIN) {
- perror("VB sleep for 10ms");
- usleep(10000);
- // set the pointers before going into the next loop.
- temp = (char *)&msghd;
- bytes = sizeof (msghd);
- return 0;
- }
- ACE_OS::perror ("VB ACE_OS::read () data");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- if (len == 0) { /* EOF, connection closed by peer */
- fprintf(stderr, "Error: VB found dataSocket broken\n");
- for (;;) {
- usleep(1000000);
- }
- }
- if (conn_tag >= 0)
- {
- temp += len;
- bytes -= len;
- if (bytes != 0)
- return 0;
- else
- len = sizeof (msghd);
- }
- if (len < sizeof(msghd))
- {
- // go back to reading the next header.
- temp = (char *)&msghd;
- bytes = sizeof (msghd);
- fprintf(stderr, "VD warn: PEEK1ed %dB < expected %dB\n",len, sizeof(msghd));
- // continue;
- }
-#ifdef NeedByteOrderConversion
- msghd.packetsn = ntohl(msghd.packetsn);
- msghd.packetSize = ntohl(msghd.packetSize);
- msghd.msgsn = ntohl(msghd.msgsn);
- msghd.msgOffset = ntohl(msghd.msgOffset);
- msghd.msgSize = ntohl(msghd.msgSize);
-#endif
-
- if (this->state_ == READ_NEXT_HEADER)
- {
-#ifdef STAT
- {
- int gap = msghd.msgsn - gap_msgsn;
- gap = (gap >MSGGAP_MAX) ? MSGGAP_MAX : gap < MSGGAP_MIN ? MSGGAP_MIN : gap;
- shared->stat.VBmsgGaps[gap - MSGGAP_MIN] ++;
- if (gap >0) gap_msgsn = msghd.msgsn;
- }
-#endif
- if (msghd.msgsn <= msgsn)
- { /* outdated message, wait for next one */
-
- fprintf(stderr, "VB discard outdated or dup msgsn %d, pktsn %d\n",
- msghd.msgsn, msghd.packetsn);
-
- this->state_ = SKIP_NEXT_MESSAGE;
- bytes = msghd.msgSize;
- // skip_message(dataSocket, &msghd);
- // continue;
- return 0;
- }
-
- if ((msghd.msgsn > msgsn + 1) || (msghd.msgOffset == 0))
- {
- /* message out of order, abandon current packet */
- /*
- fprintf(stderr, "VB msg out of order for current packet, discard it.\n");
- */
-#ifdef STAT
- to_count = 0;
-#endif
- }
- else
- {
- // ACE_DEBUG ((LM_DEBUG,"assigning next msgsn %d\n",msghd.msgsn));
- msgsn = msghd.msgsn;
- this->state_ = READ_MESSAGE;
- temp = ptr +sizeof (msghd);
- bytes = msghd.msgSize;
- // make a recursive call as we just have to do a memcpy from the buffer.
- this->handle_input (dataSocket);
- return 0;
- }
- }
-
- // fprintf(stderr, "VB PEEK1 a msg sn-%d, size-%d, pkt-%d, pktsize-%d\n",msghd.msgsn, msghd.msgSize, msghd.packetsn, msghd.packetSize);
-
-#ifdef STAT
- if (to_count) {
- int gap = msghd.msgsn - gap_msgsn;
- gap = (gap >MSGGAP_MAX) ? MSGGAP_MAX : gap < MSGGAP_MIN ? MSGGAP_MIN : gap;
- shared->stat.VBmsgGaps[gap - MSGGAP_MIN] ++;
- if (gap >0) gap_msgsn = msghd.msgsn;
- }
- to_count = 1;
-#endif
- if (msghd.msgsn <= msgsn) /* outdated msg */
- {
- fprintf(stderr, "VB discard outdated msgsn %d, pktsn %d when expecting first %d\n",
- msghd.msgsn, msghd.packetsn,msgsn);
- this->state_ = SKIP_MESSAGE;
- bytes = msghd.msgSize;
- // skip_message(dataSocket, &msghd);
- // continue;
- return 0;
- }
- else if (msghd.msgOffset != 0) /* not first msg of a packet */
- {
-
- /*
- Fprintf(stderr, "VB discard non-first msg msgsn %d, pktsn %d\n",
- msghd.msgsn, msghd.packetsn);
- */
- this->state_ = SKIP_MESSAGE;
- bytes = msghd.msgSize;
- // skip_message(dataSocket, &msghd);
- // continue;
- return 0;
- }
- else
- {
- // ACE_DEBUG ((LM_DEBUG,"assigning msgsn %d\n",msghd.msgsn));
- msgsn = msghd.msgsn;
- }
-
- /* allocate packet for the incoming msg */
- bsize = msghd.packetSize + sizeof(**head)*2 + sizeof(msghd);
- bsize = ((bsize+3)>>2)<<2;
- enter_cs(sid);
- if (*head >= *tail)
- {
- if (bufsize - (int)((char*)*head - buf) >= bsize )
- msg =(VideoMessage *)((char*)*head + sizeof(**head));
- else if ((int)((char*)*tail - buf) >= bsize)
- {
- (*head)->next = (struct block *)buf;
- (*head)->full = 0;
- *head = (struct block *)buf;
- msg = (VideoMessage *)(buf + sizeof(**head));
- *head = (struct block *)buf;
- (*head)->shcode = SHCODE;
- }
- else /* not enough buffer, discard current message */
- {
- leave_cs(sid);
-#ifdef STAT
- if (shared->collectStat)
- shared->stat.VBdroppedFrames ++;
-#endif
- /*
- Fprintf(stderr, "VB not enough space 1, drop msg.sn %d pktsn %d\n",
- msghd.msgsn, msghd.packetsn);
- */
- this->state_ = SKIP_MESSAGE;
- bytes = msghd.msgSize;
- // skip_message(dataSocket, &msghd);
- // continue;
- return 0;
- }
- }
- else /* *head < *tail */
- if ((char*)*tail - (char*)*head >= bsize)
- msg = (VideoMessage *)((char*)*head + sizeof(**head));
- else /* not enough buffer, abandon current message */
- {
- leave_cs(sid);
-#ifdef STAT
- if (shared->collectStat)
- shared->stat.VBdroppedFrames ++;
-#endif
- /*
- Fprintf(stderr, "VB not enough space 1, drop msg.sn %d pktsn %d\n",
- msghd.msgsn, msghd.packetsn);
-
- */
- this->state_ = SKIP_MESSAGE;
- bytes = msghd.msgSize;
- // skip_message(dataSocket, &msghd);
- // continue;
- return 0;
- }
- leave_cs(sid);
-
- //fprintf(stderr, "VB allocated a buffer for comming packet.\n");
-
- psize = msghd.packetSize;
- poffset = 0;
- packet = (VideoPacket *)((char*)msg + sizeof(msghd));
- *(((int*)packet)+(msghd.packetSize>>2)) = 0;
- /* clear the last no more than three bytes, for
- proper detecting the end of packet by VD */
- ptr = (char*)msg;
- this->state_ = READ_MESSAGE;
- temp = ptr +sizeof (msghd);
- bytes = msghd.msgSize;
- }
- break;
- case SKIP_NEXT_MESSAGE:
- case SKIP_MESSAGE:
- {
- char buffer[BUFSIZ];
- if (conn_tag >= 0)
- {
- int size = bytes > BUFSIZ ? BUFSIZ : bytes;
- int res =ACE_OS::read (dataSocket, buffer, size);
- bytes -= res;
-
- if (bytes != 0)
- return 0;
- }
- if (this->state_ == SKIP_MESSAGE)
- this->state_ = READ_HEADER;
- else if (this->state_ == SKIP_NEXT_MESSAGE)
- this->state_ = READ_NEXT_HEADER;
- temp = (char *)&msghd;
- bytes = sizeof (msghd);
- break;
- }
- case READ_MESSAGE:
- {
- if (conn_tag >= 0)
- {
- int val;
- val = ACE_OS::read (dataSocket,temp,bytes);
-
- if (val == -1 && (errno == EINTR || errno == EAGAIN | errno == EWOULDBLOCK))
- { /* interrupted or need to wait, try again */
- if (errno == EAGAIN | errno == EWOULDBLOCK) usleep(10000);
- errno = 0;
- return 0;
- }
- if (val == -1)
- {
- ACE_OS::perror ("Error -- Read from socket");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- if (val == 0) /* EOF encountered */
- {
- ACE_DEBUG ((LM_DEBUG, "Error -- EOF reached while trying to read %d bytes.\n"));
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- temp += val;
- bytes -= val;
- if (bytes < 0) /* weird thing is happening */
- {
- ACE_DEBUG ((LM_DEBUG, "Error: read too much from socket, %d out of %d bytes.\n"));
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- if (bytes != 0)
- return 0;
- }
- else
- memcpy(temp, tmp_buf + sizeof(msghd), bytes);
- poffset += msghd.msgSize;
- psize -= msghd.msgSize;
- ptr += msghd.msgSize;
-
- // fprintf(stderr, "VB packet remain size %d\n", psize);
-
- if (psize == 0)
- {
- // ACE_DEBUG ((LM_DEBUG,"finished receiving current packet\n"));
- /* finished receiving the current packet */
-#ifdef NeedByteOrderConversion
- packet->cmd = ntohl(packet->cmd);
- packet->cmdsn = ntohl(packet->cmdsn);
- packet->sh = ntohl(packet->sh);
- packet->gop = ntohl(packet->gop);
- packet->frame = ntohl(packet->frame);
- packet->display = ntohl(packet->display);
- packet->future = ntohl(packet->future);
- packet->past = ntohl(packet->past);
- packet->currentUPF = ntohl(packet->currentUPF);
- packet->dataBytes = ntohl(packet->dataBytes);
-#endif
- pcmdsn = packet->cmdsn;
- pcmd = packet->cmd;
- pfid = packet->frame;
- pgop = packet->gop;
- shared->VBheadFrame = (pcmd == CmdPLAY) ? pfid : pgop;
-
- shared->currentUPF = packet->currentUPF;
- enter_cs(sid);
- (*head)->full = 1;
- psize = sizeof(**head) + sizeof(*msg) + msghd.packetSize;
- psize = ((psize+3)>>2)<<2;
- ptr = (char*)*head + psize;
- (*head)->next = (struct block *) ptr;
- (*head) = (struct block *)ptr;
- (*head)->shcode = SHCODE;
- leave_cs(countid);
- leave_cs(sid);
-
- /* VB receives all frame except for the INIT one through normalSocket */
- if (dataSocket != normalSocket)
- {
- this->socket_flag_ = 1;
- fprintf(stderr, "VB got INIT frame.\n");
- ACE_OS::write (initSocket, (char *)&initSocket, 1); /* write a garbage byte */
- // ACE_OS::close (initSocket);
- // dataSocket = normalSocket;
- // int result = ACE_Reactor::instance ()->remove_handler (this,ACE_Event_Handler::READ_MASK);
- // if (result != 0)
- // ACE_DEBUG ((LM_DEBUG,"remove handler failed for read_mask\n"));
-
- }
-
- /* following is synchronization feedback algorithm */
- this->sync_feedback ();
- if (dataSocket != normalSocket)
- {
- dataSocket = normalSocket;
- int result = ACE_Reactor::instance ()->register_handler (this,ACE_Event_Handler::READ_MASK);
- if (result != 0)
- ACE_DEBUG ((LM_DEBUG,"register handler failed for read_mask after datasocket change\n"));
- return -1;
- }
- // return 0;
- break; /* got the whole packet, break to the out-most loop for next packet */
- } /* end if (psize == 0) */
- else if (psize < 0)
- {
- fprintf(stderr, "VB error: received too many msgs for a packet.\n");
- ACE_Reactor::instance ()->end_event_loop ();
- return -1;
- }
- this->state_ = READ_NEXT_HEADER;
- temp = (char *)&msghd;
- bytes = sizeof (msghd);
- break;
- }
- }
- return 0;
-}
-
-int
-VideoBuffer::handle_output (ACE_HANDLE fd)
-{
- if ((this->state_ == WRITE_FEEDBACK1) || (this->state_ == WRITE_FEEDBACK2))
- {
- // send the feedback to the server.
- VideoFeedBackPara para;
- para.cmdsn = htonl(shared->cmdsn);
- para.addUsecPerFrame = htonl(fb_addupf);
- para.addFrames = htonl(fb_addf);
- para.needHeader = htonl(shared->needHeader);
- shared->needHeader = 0;
- para.frameRateLimit1000 =
- htonl((long)(shared->frameRateLimit * 1000.0));
- para.sendPatternGops = htonl(shared->sendPatternGops);
- ACE_OS::memcpy (para.sendPattern, shared->sendPattern, PATTERN_SIZE);
-
- // fprintf(stderr, "VB to send a fb packet...");
-
- int res;
- if (conn_tag != 0)
- { /* packet stream */
- if (temp == 0)
- {
- temp = (char *)&para;
- bytes = sizeof (para);
- }
- res = ACE_OS::write (dataSocket, temp, bytes);
- if (res == -1)
- {
- if (errno == EINTR)
- return 0;
- if (errno == ENOBUFS) {
- perror("VB Warning, fb packet discarded for");
- // Here we should handle the return -1 case!
- fb_state = 4;
- }
- else
- {
- ACE_OS::perror ("VB error, fb packet sending failed");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- }
- else if (res == 0)
- {
- ACE_OS::perror ("VB error, sending fb,socket closed");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- else
- {
- temp += res;
- bytes -= res;
- if (bytes != 0)
- return 0;
- }
- }
- else
- {
- res = ACE_OS::write (dataSocket, (char *)&para, sizeof(para));
- if (res == -1)
- {
- ACE_OS::perror ("VB error, fb packet sending failed");
- ACE_Reactor::instance ()->end_event_loop (); return -1;
- }
- if (res < sizeof(para))
- {
- fprintf(stderr, "VB send_feedback() warn: res %dB < sizeof(para) %dB\n",
- res, sizeof(para));
- }
- }
- if (errno != ENOBUFS) // fb_state == 4;
- qosRecomputes = len;
- ACE_Reactor::instance ()->remove_handler (this,
- ACE_Event_Handler::WRITE_MASK);
- if (this->state_ == WRITE_FEEDBACK2)
- {
- if (fb_state == 6)
- { /* record the time if an action packet is
- successfully send, and indicate that an
- feedback action leads to state 6, which after
- delay sometime leads to state 3.
- The action_delay should have been related
- to round-trip time. */
- action_time = get_usec();
- action_delay = shared->usecPerFrame * 100;
- not_action = 0;
- }
- }
- else if (this->state_ == WRITE_FEEDBACK2)
- {
- this->feedback_action ();
- }
-#ifdef STAT
- {
- int i;
- if ((i = shared->stat.fbPacketNumber) < MAX_FB_PACKETS) {
- shared->stat.fbPackets[i].frameId = shared->nextFrame;
- shared->stat.fbPackets[i].addUsecPerFrame = addupf;
- shared->stat.fbPackets[i].addFrames = addf;
- shared->stat.fbPackets[i].frames = shared->sendPatternGops *
- shared->patternSize;
- shared->stat.fbPackets[i].framesDropped = shared->framesDropped;
- shared->stat.fbPackets[i].frameRateLimit = shared->frameRateLimit;
- shared->stat.fbPackets[i].advance = advance;
- }
- shared->stat.fbPacketNumber ++;
- }
-#endif
- // Now return to the reading header position.
- this->state_ = READ_HEADER;
- temp = (char *)&msghd;
- bytes = sizeof (msghd);
- int result = ACE_Reactor::instance ()->remove_handler (this,
- ACE_Event_Handler::WRITE_MASK);
- if (result != 0)
- ACE_DEBUG ((LM_DEBUG,"remove_handler failed for write"));
- }
- return 0;
-}
-
-int
-VideoBuffer::sync_feedback (void)
-{
- int result;
- if (shared->config.syncEffective)
- {
- if (fb_state > 1 && fb_state != 4 && (len = shared->qosRecomputes) != qosRecomputes)
- {
- /* QoS feedback packet is sent if at any time send pattern is
- recomputed, and sync feedback is not in active fb_state*/
- this->state_ = WRITE_FEEDBACK1;
- result = ACE_Reactor::instance ()->register_handler (this,ACE_Event_Handler::WRITE_MASK);
- if (result != 0)
- return result;
- fb_addupf = 0;
- fb_addf = 0;
- fb_advance = advance;
- temp = 0;
- return 0;
- }
- this->feedback_action ();
- } /* end if (shared->config.syncEffective) */
- else
- fb_state = 0;
- return 0;
-}
-
-int
-VideoBuffer::feedback_action (void)
-{
- switch (fb_state)
- {
- case 4: /* active */
- if (pcmdsn != cmdsn)
- {
- cmdsn = pcmdsn;
- if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB))
- fb_state = 0;
- else
- fb_state = 1;
- break;
- }
- if (pcmd == CmdPLAY && shared->usecPerFrame != upf)
- {
- /* jump to fb_state 5 if speed changes */
- fb_state = 5;
- break;
- }
- {
- int interval = shared->usecPerFrame;
- double val = (double)(pcmd == CmdPLAY ?
- pfid - shared->nextFrame :
- (pcmd == CmdFF ?
- pgop - shared->nextGroup :
- shared->nextGroup - pgop));
- fv = DoFilter(f, val); /* get average #frames in the whole client
- pipeline, including all stages */
- val = val - fv;
- fav = DoFilter(fa, val >= 0.0 ? val : -val);
- /* get average #frames jitter in the whole client pipeline */
-
- val = fav * interval * 6;
- /* convert deviation in frame into microseconds, 6 is a magic number */
-
- /* tries to recompute advance (in microseconds), and med/high/low
- in adaptation to current jitter level */
- if ((val > advance && !reach_limit) ||
- (advance > min_advance && val < advance >> 3)) {
- advance = (int) max(2 * val, min_advance);
- med = advance / interval;
- /*
- if (pcmd == CmdPLAY) {
- if (med < shared->VDframeNumber) {
- med = shared->VDframeNumber;
- }
- }
- else
- */
- if (med < 2 ) { /* but keep minimum buffer fill level */
- med = 2;
- }
- if (med > (VB_BUF_SIZE / shared->averageFrameSize) / 2) {
- reach_limit = 1;
- med = (VB_BUF_SIZE / shared->averageFrameSize) / 2;
- Fprintf(stderr,
- "VB VSadvance control: VBbuf limit reached, med %d.\n", med);
- }
- else reach_limit = 0;
- high = med + med / 2;
- low = med - med / 2;
- period = med * MAX_CLOCK_DRIFT;
- Fprintf(stderr,
- "VB: VS advance control: fav %5.2f, med %d, advance %d at nextFrame %d\n",
- fav, med, advance, shared->nextFrame);
- }
- }
- /* record the current time (fid or gopid) if buffer fill level drift
- only very little */
- if ((int)fv == med)
- {
- init_fv = fv;
- init_pos = pcmd == CmdPLAY ? pfid : pgop;
- break;
- }
- /*
- fprintf(stderr, "VB fb: fv %lf\n", fv);
- */
- /* try send action if low/high water mark is passed, or qos recomputed */
- /* There is problem here, the deltas of upf are sent, instead of upf
- and frame themself. This scheme is not robust in case case feedback
- packets are lost, and get resent */
- len = shared->qosRecomputes;
- if (fv >= high || fv <= low || len != qosRecomputes)
- {
- int addupf, addf;
- int pos = pcmd == CmdPLAY ? pfid : pgop;
- int dist = (int)(pcmd == CmdFB ? init_pos - pos : pos - init_pos);
- if (fv >= high || fv <= low)
- {
- if (dist < period)
- { /* try skip or stall */
- addf = (int)(med - fv);
- addupf = 0;
- }
- else
- { /* try adjust VS clock rate */
- int added = (int)((double)cupf * (fv - (double)med) / (double) dist);
- addf = (int)(med - fv);
- addupf = added;
- cupf += added;
- }
- fb_state = 6;
- }
- else
- { /* fb only recomputed sendpattern, no fb_state change */
- addupf = 0;
- addf = 0;
- }
-
- /* tries to send a feedback packet. */
- if (shared->live)
- /* no sync feedback with live video */
- qosRecomputes = len;
- else
- {
- this->state_ = WRITE_FEEDBACK2;
- int result = ACE_Reactor::instance ()->register_handler (this,ACE_Event_Handler::WRITE_MASK);
- if (result != 0)
- return result;
- fb_addupf = addupf;
- fb_addf = addf;
- fb_advance = advance;
- return 0;
- }
- if (fb_state == 6)
- { /* record the time if an action packet is
- successfully send, and indicate that an
- feedback action leads to fb_state 6, which after
- delay sometime leads to fb_state 3.
- The action_delay should have been related
- to round-trip time. */
- action_time = get_usec();
- action_delay = shared->usecPerFrame * 100;
- not_action = 0;
- }
- }
- break;
- case 6: /* reset after action */
- if (pcmdsn != cmdsn)
- {
- cmdsn = pcmdsn;
- if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB))
- fb_state = 0;
- else
- fb_state = 1;
- break;
- }
- if (pcmd == CmdPLAY && shared->usecPerFrame != upf)
- {
- fb_state = 5;
- break;
- }
- /* Jump to transition fb_state 3 only after delay for some
- time, when feedback action has been taken, and the
- effect has been propogated back to the client */
- if (get_duration(action_time, get_usec()) >= action_delay)
- fb_state = 3;
- break;
- case 5: /* reset after speed change, feedback stays in this
- fb_state as long as play speed is changing */
- if (pcmdsn != cmdsn)
- {
- cmdsn = pcmdsn;
- if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB))
- fb_state = 0;
- else
- fb_state = 1;
- break;
- }
- /* Jump to transition fb_state 3, indicating that the transition
- is not caused by feedback action */
- if (shared->currentUPF == shared->usecPerFrame)
- {
- not_action = 1;
- fb_state = 3;
- }
- break;
- case 2: /* delay after start, this delay is for avoiding feedback
- action during server fast start-up. */
- if (pcmdsn != cmdsn) {
- cmdsn = pcmdsn;
- if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) {
- fb_state = 0;
- }
- else {
- fb_state = 1;
- }
- break;
- }
- if (pcmd == CmdPLAY) {
- if (pfid - startpos >= delay) {
- advance = shared->VStimeAdvance;
- fb_state = 3;
- }
- }
- else if (pcmd == CmdFF) {
- if (pgop - startpos >= delay) {
- advance = shared->VStimeAdvance;
- fb_state = 3;
- }
- }
- else { /* CmdFB */
- if (startpos - pgop >= delay) {
- advance = shared->VStimeAdvance;
- fb_state = 3;
- }
- }
- break;
- case 3: /* transient fb_state, entered after start-up delay,
- action-delay, or play-speed change */
- if (pcmdsn != cmdsn) {
- cmdsn = pcmdsn;
- if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) {
- fb_state = 0;
- }
- else {
- fb_state = 1;
- }
- break;
- }
- /* Initialize both buffer-fill-level and jitter filters */
- if (f == NULL) {
- f = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- }
- else {
- f = ResetFilter(f, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- }
- if (fa == NULL) {
- fa = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- DoFilter(fa, 0.0);
- }
- else if (not_action) { /* reset jitter level filter only
- if entering this fb_state is not
- cause by feedback action */
- fa = ResetFilter(fa, shared->config.filterPara >= 1 ?
- shared->config.filterPara : 100);
- }
- if (f == NULL || fa == NULL) {
- ACE_OS::perror ("VB failed to allocate space for filters");
- fb_state = 0;
- }
- else {
- init_fv =
- DoFilter(f, (double)(pcmd == CmdPLAY ?
- pfid - shared->nextFrame :
- (pcmd == CmdFF ?
- pgop - shared->nextGroup :
- shared->nextGroup - pgop)));
- init_pos = pcmd == CmdPLAY ? pfid : pgop;
- upf = shared->currentUPF;
- cupf = upf;
- {
- int interval = shared->usecPerFrame;
-
- /* upon speed change, 'advance', in microseconds, will
- not change, but med/high/low will be updated. This
- may suggest that in the new toolkit version of the
- same feedback systems, the buffer-fill level and
- jitter is measured directly in microseconds, not in
- #frames then converting to microseconds. */
- med = advance / interval;
- /*
- if (pcmd == CmdPLAY) {
- if (med < shared->VDframeNumber) {
- med = shared->VDframeNumber;
- min_advance = advance = med * interval;
- }
- }
- else
- */
- if (med < 2 ) {
- med = 2;
- advance = med * interval;
- min_advance = max(advance, shared->VStimeAdvance);
- }
- else min_advance = shared->VStimeAdvance;
- if (med > (VB_BUF_SIZE / shared->averageFrameSize) / 2) {
- reach_limit = 1;
- med = (VB_BUF_SIZE / shared->averageFrameSize) / 2;
- if (not_action) {
- Fprintf(stderr,
- "VB start/speed-change: VBbuf limit reached, med %d.\n", med);
- }
- }
- else reach_limit = 0;
- }
- high = med + med / 2;
- low = med - med / 2;
- delay = med * (SPEEDUP_INV_SCALE - 1); /* this delay is to avoid
- feedback when VS is in
- fast-start period */
- period = med * MAX_CLOCK_DRIFT;
- if (not_action) {
- Fprintf(stderr,
- "VB start/speed-change: med %d, advance %d at nextFrame %d\n",
- med, advance, shared->nextFrame);
- }
- fb_state = 4;
- }
- break;
- case 0: /* idle */
- if (pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB) {
- cmdsn = pcmdsn;
- fb_state = 1;
- }
- break;
- case 1: /* start */
- if (pcmdsn != cmdsn) {
- cmdsn = pcmdsn;
- if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) {
- fb_state = 0;
- }
- break;
- }
- startpos = pcmd == CmdPLAY ? pfid : pgop;
- advance = shared->VStimeAdvance;
-
- /* following from vs.c:
- timerAdjust = (VStimeAdvance * SPEEDUP_INV_SCALE) / currentUPF;
- */
- med = advance / shared->usecPerFrame;
- /*
- if (pcmd != CmdPLAY) med /= shared->patternSize;
- */
- delay = med * (SPEEDUP_INV_SCALE - 1); /* this delay is to avoid
- feedback when VS is in
- fast-start period */
- not_action = 1;
- fb_state = 2;
- break;
- default:
- fprintf(stderr, "VB: unknown Feedback fb_state %d reached.\n", fb_state);
- fb_state = 0;
- break;
- }
-}
-
-ACE_HANDLE
-Notification_Handler::get_handle (void) const
-{
- return -1;
-}
-
-int
-Notification_Handler::handle_input (ACE_HANDLE fd)
-{
- ACE_DEBUG ((LM_DEBUG,"Notification_Handler::handle_input"));
- char message[BUFSIZ];
- message [0] = 0;
- // used to indicate that we should exit.
- int result =
- ACE_OS::read (fd,message,BUFSIZ);
-
- ACE_DEBUG ((LM_DEBUG,"result:%d,message[0]:%d\n",result,message[0]));
- if (result == 0)
- {
- ACE_DEBUG ((LM_DEBUG,"AB process exiting, notification socket eof while reading\n"));
- ACE_Reactor::instance ()->end_event_loop ();
- return -1;
- }
- if (result == -1)
- {
- ACE_DEBUG ((LM_DEBUG,"AB process exiting, notification socket error while reading\n"));
- ACE_Reactor::instance ()->end_event_loop ();
- return -1;
- }
- ACE_DEBUG ((LM_DEBUG," %d %d\n",result,message[0]));
-
- switch (message[0])
- {
- case EXIT:
- ACE_DEBUG ((LM_DEBUG,"AB process exiting because of exit signal\n"));
- set_exit_routine_tag(0);
- VideoBuffer::VBdeleteBuf();
- ACE_Reactor::instance ()->end_event_loop ();
- return -1;
- default:
- break;
- }
- return 0;
-}
-
-ACE_HANDLE
-Video_Notification_Handler::get_handle (void) const
-{
- return vsp[1];
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.h
deleted file mode 100644
index 6c0e4e69a86..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.h
+++ /dev/null
@@ -1,265 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// mpeg_client
-//
-// = FILENAME
-// vb.h
-//
-// = DESCRIPTION
-// Defines the video packet buffering process.
-//
-// = AUTHORS
-// Nagarajan Surendran (naga@cs.wustl.edu)
-//
-// ============================================================================
-
-#if !defined (AV_VB_H)
-#define AV_VB_H
-
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-#if defined(__svr4__) || defined(IRIX)
-#include <stropts.h>
-#include <sys/conf.h>
-#endif
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-#include "mpeg_shared/filters.h"
-#include "mpeg_shared/fileio.h"
-#include "mpeg_shared/com.h"
-#include "ace/Event_Handler.h"
-#include "ace/Reactor.h"
-
-/* magic number -- deviation is considered
- caused by clock drift only if rate <= 1/MAX_CLOCK_DRIFT.
- */
-#define MAX_CLOCK_DRIFT 50
-#define SHCODE 0x000001b3
-#define max(a,b) ((a)>(b) ? (a) : (b))
-
-struct block
-{
- unsigned shcode;
- struct block * next;
- int full;
-};
-
-struct header
-{
- struct block *h, *t;
-};
-
-class Notification_Handler;
-
-class VideoBuffer :public ACE_Event_Handler
-{
-public:
- VideoBuffer (void);
- // constructor.
-
- virtual ~VideoBuffer (void);
- // destructor.
-
- virtual int handle_input (ACE_HANDLE fd);
- // callback when data arrives on the video socket.
-
- virtual int handle_output (ACE_HANDLE fd);
- // callback when data can be written on the video socket.
-
- ACE_HANDLE get_handle (void) const;
- // gets the video socket.
-
- void VBinitBuf (int size);
- // size in byte.
-
- char * VBgetBuf (int size);
- // block version.
-
- int VBcheckBuf (int size);
- // non-block check, return True/False
-
- void VBputMsg (char * msgPtr);
-
- char * VBgetMsg ();
- // block version.
-
- int VBcheckMsg();
- // non-block check, return Number of Msgs in buffer.
-
- int VBbufEmpty(void);
-
- void VBreclaimMsg(char * msgPtr);
-
- static void VBdeleteBuf(void);
-
- static void VBdeleteSem(void);
-
- static void exit_on_kill(void);
-
- int VBprocess(int initSocket, int normalSocket);
-
-private:
-
- int sync_feedback (void);
- int feedback_action (void);
-
- static block ** head;
- static block ** tail;
- static char * buf;
- static int bufsize;
- static int sid, countid;
- static int exit_tag;
- static int conn_tag;
- static int savedSocket;
-
- VideoMessage *msg, msghd;
- VideoPacket *packet;
- int len, bsize, msgsn;
- int psize, poffset;
- char * ptr, *ptr1;
- char *tmp_buf;
- int dataSocket;
- int initSocket,normalSocket;
-
- // following variables are for feedback
- int pcmdsn, pcmd;
- // to store the cmdsn and cmd of previous frame,
- // to detect new commands
-
- int pfid, pgop;
- // frame-id of gopid of previous frame
-
- int cmdsn;
- // cmdsn of previous command
-
- int fb_state;
- // state of the control law/regulator
-
- int startpos;
- // gopid or frameid when the regulator is in 'start' state 1
-
- int delay;
- // #frames to delay after 'start'
-
- int qosRecomputes;
- // indicate if qos has been recomputed recently
-
- int action_delay;
- // microseconds to delay after feedback action
-
- int action_time;
- // the time when feedback action is taken, used to enforce
- // action_delay
-
- int upf, cupf;
- // upf -- currentUPF as carried in all frames,
- // cupf -- real current UPF, being adjusted by FB
-
- double fv;
- // current buffer fill level in term of #frames
-
- double init_fv;
- // init_fv and init_pos record the fv value and position
- // (frameid or gopid) when fv is very close to med
-
- double init_pos;
- int high, low, med;
- // median, high and low water marks, in term of #frames
-
- int period;
- // interms of #frames, (high-med, period) defined the max
- // buffer fill drift which can be assumed as caused by
- // clock drift
-
- Filter * f;
- // buffer fill level filter
-
- int advance, min_advance;
- // in microseconds, advance holds the
- // current target buffer-fill-level as
- // determined by jitter level
- // estimate. min_advance sets a absolute
- // minimun level, no matter how low jitter
- // level is.'advance' does not change when
- // play-speed changes, but med/high/low
- // will be updated upon speed change
-
- double fav;
- // #frames, jitter level output by the filter.
-
- Filter * fa;
- // jitter filter.
-
- int reach_limit;
- // indicate that the target 'advance' has reached client VB
- // buffer limit, and can not further increase, even if
- // jitter increases.
-
- int not_action;
- // indicates entering state=3 is not caused by
- // feedback action. If not_action = 1 entering state=3
- // is caused either by 'start' or speed change, and
- // the jitter filter needs to be reset.
-
-#ifdef STAT
- int to_count;
- int gap_msgsn;
-#endif
-
- Notification_Handler *handler_;
- // handler to be used for exit notification.
-
- enum state {INVALID = -1,
- READ_HEADER = 0,
- READ_NEXT_HEADER = 1,
- READ_MESSAGE = 2,
- SKIP_MESSAGE = 3,
- SKIP_NEXT_MESSAGE = 4,
- WRITE_FEEDBACK1 = 5,
- WRITE_FEEDBACK2 = 6};
- state state_;
-
- char *temp;
- // temporary pointer.
- int bytes;
- // temporary placeholder for no.of bytes to be read.
-
- int fb_addupf;
- int fb_addf;
- int fb_advance;
-
- int socket_flag_;
- // flag to indicate which socket to be used.
-};
-
-class Notification_Handler :public ACE_Event_Handler
-{
-public:
- virtual ACE_HANDLE get_handle (void) const;
- // Get the Notification handle.
-
- virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE);
- // called when input events occur.
-
-};
-
-class Video_Notification_Handler :public Notification_Handler
-{
-public:
- virtual ACE_HANDLE get_handle (void) const;
- // Returns the video notification handle.
-};
-#endif /* AV_VB_H */
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp
deleted file mode 100644
index 9eb3e6e1c57..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp
+++ /dev/null
@@ -1,933 +0,0 @@
-/* $Id$ */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-extern int vdsp[2];
-
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include <stdlib.h>
-/*
-#include <sys/types.h>
-#include <sys/socket.h>
-*/
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-#include "dither.h"
-#include "video.h"
-#include "proto.h"
-#include "vb.h"
-
-ACE_RCSID(mpeg_client, vd, "$Id$")
-
-#define MAX_VDBLOCK_NUM 8
-#define CQUEUE_SIZE MAX_VDBLOCK_NUM + 2
-#define ESTACK 0
-#define CQUEUE 1
-
-static int win_width, win_height;
-static int ecountid, ccountid;
-static int sid;
-
-extern VidStream * curVidStream;
-extern VideoBuffer *vbuffer;
-
-static struct shared_mem_block
-{
- int size;
- int block_num;
- int width, height;
- int sptr, qhead, qtail;
- FrameBlock *estack[MAX_VDBLOCK_NUM];
- FrameBlock *cqueue[CQUEUE_SIZE]; /* cqueue will never get full */
-} * shm = NULL;
-
-static void InitDitherEnv(void);
-static void DitherFrame(PictImage * pict, FrameBlock * frame);
-static void DoDitherImage(unsigned char *l, unsigned char *Cr, unsigned char *Cb,
- unsigned char *disp, int h, int w);
-
-void VDinitBuf(int size)
-/* size in bytes */
-{
- shm = (struct shared_mem_block *)creat_shared_mem_id(size, &shared->VDbufId);
- shared->VDbufAddr = (char *)shm;
-
- shm->width = shm->height = 0;
- shm->size = size - sizeof(*shm);
- sid = creat_semaphore();
- ecountid = creat_semaphore();
- ccountid = creat_semaphore();
- enter_cs(ccountid);
- enter_cs(ecountid);
-}
-
-static void put_block(FrameBlock * bptr, int tag)
-{
- if (tag == ESTACK)
- {
- shm->estack[shm->sptr] = bptr;
- shm->sptr ++;
- if (shm->sptr > MAX_VDBLOCK_NUM)
- {
- fprintf(stderr, "VD weird error: ESTACK full.\n");
- ACE_OS::exit (1);
- }
- }
- else
- {
- if (shm->qtail == shm->qhead) /* empty queue */
- {
- shm->qtail = 0;
- shm->qhead = 1;
- shm->cqueue[0] = bptr;
- }
- else
- {
- int val = CQUEUE_SIZE;
- int pos = (shm->qhead - 1 + val) % val; /* pos = shm->qhead - 1 */
- if (shared->cmd == CmdPLAY)
- while ((pos + 1) % val != shm->qtail)
- {
- if (shm->cqueue[pos]->display > bptr->display)
- {
- shm->cqueue[(pos + 1) % val] = shm->cqueue[pos];
- pos = (pos - 1 + val) % val; /* pos -= 1 */
- }
- else
- break;
- }
- shm->cqueue[(pos + 1) % val] = bptr;
- shm->qhead = (shm->qhead + 1) % val;
- }
- }
-}
-
-static FrameBlock * get_block(int tag)
-{
- FrameBlock * ptr;
-
- if (tag == ESTACK)
- {
- if (shm->sptr <= 0)
- {
- fprintf(stderr, "VD get_block error: ESTACK empty.\n");
- return NULL;
- }
- shm->sptr --;
- ptr = shm->estack[shm->sptr];
- }
- else
- {
- if (shm->qtail == shm->qhead)
- {
- fprintf(stderr, "VD get_block error: CQUEUE empty.\n");
- return NULL;
- }
- ptr = shm->cqueue[shm->qtail];
- shm->qtail = (shm->qtail + 1) % (CQUEUE_SIZE);
- }
- return ptr;
-}
-
-void VDresizeBuf(int height, int width)
-{
- char * ptr = (char*)shm + sizeof(*shm);
- int imagesize;
- int i;
-
- enter_cs(sid);
-
- if (get_semval(ecountid) < 0) {
- fprintf(stderr, "Error<weird>: pid %d get (ecountid) = %d < 0\n",
- ACE_OS::getpid (), get_semval(ecountid));
- ACE_OS::exit (1);
- }
- /*
- fprintf(stderr, "VD before resizeBuf(): get_semval(ecountid) = %d\n",
- get_semval(ecountid));
- */
- while (get_semval(ecountid) > 0) enter_cs(ecountid);
-
- shm->width = width;
- shm->height = height;
- width = ((width+15)>>4) << 4;
- height = ((height+15)>>4) << 4;
- imagesize = (((height * width)+3)>>2)<<2;
- if ((ditherType == Twox2_DITHER) || (ditherType == FULL_COLOR_DITHER))
- imagesize <<= 2;
-
- shm->block_num = (shm->size)/(sizeof(FrameBlock) + imagesize);
- if (shm->block_num > MAX_VDBLOCK_NUM)
- shm->block_num = MAX_VDBLOCK_NUM;
-
- Fprintf(stderr, "VD resizeBuf: got %d(max %d) blocks of size %d.\n",
- shm->block_num,
- (shm->size)/(sizeof(FrameBlock) + imagesize),
- (sizeof(FrameBlock) + imagesize));
-
- if (shm->block_num < 3)
- {
- fprintf(stderr,
- "VD error: VDbuf fails to hold at least 3(three) block.\n");
- ACE_OS::exit (1);
- }
- shm->sptr = 0; /* empty stack */
- shm->qhead = shm->qtail = 0; /* empty cqueue */
- for (i=0; i<shm->block_num; i++)
- {
- put_block((FrameBlock *)ptr, ESTACK);
- ((FrameBlock *)ptr)->data = (unsigned char *)(ptr + sizeof(FrameBlock));
- ptr += sizeof(FrameBlock) + imagesize;
- leave_cs(ecountid);
- }
- leave_cs(sid);
-
- shared->VDframeNumber = shm->block_num;
- /*
- fprintf(stderr, "VD after resizeBuf(): get_semval(ecountid) = %d\n",
- get_semval(ecountid));
- */
-}
-
-FrameBlock * VDgetBuf(void) /* block version, return with interrupt */
-{
- FrameBlock * ptr;
- enter_cs(ecountid);
- enter_cs(sid);
- ptr = get_block(ESTACK);
- if (ptr != NULL)
- ptr->refcount = 1;
- leave_cs(sid);
- if (ptr == NULL)
- fprintf(stderr, "VD error: VDgetBuf should not return NULL.\n");
- /*
- fprintf(stderr, "pid %d VDgetBuf() %u, ref %d, ecount %d\n",
- ACE_OS::getpid (), (unsigned)ptr, ptr->refcount, get_semval(ecountid));
- */
- return ptr;
-}
-
-int VDcheckBuf(void) /* non-block check, return True/False */
-{
- if (get_semval(ecountid) > 0)
- return 1;
- else
- return 0;
-}
-
-void VDputMsg(FrameBlock * msgPtr)
-{
- enter_cs(sid);
- put_block(msgPtr, CQUEUE);
- leave_cs(ccountid);
- leave_cs(sid);
- /*
- fprintf(stderr, "pid %d VDputMsg() %u, ref %d, ccount %d\n",
- ACE_OS::getpid (), (unsigned)msgPtr, msgPtr->refcount, get_semval(ccountid));
- */
-}
-
-FrameBlock * VDgetMsg(void) /* block version, return with interrupt */
-{
- FrameBlock * ptr;
- enter_cs(ccountid);
- enter_cs(sid);
- ptr = get_block(CQUEUE);
- leave_cs(sid);
- if (ptr == NULL)
- fprintf(stderr, "VD error: VDgetMsg should not return NULL.\n");
- /*
- fprintf(stderr, "pid %d VDgetMsg() %u, ref %d, ccount %d\n",
- ACE_OS::getpid (), (unsigned)ptr, ptr->refcount, get_semval(ccountid));
- */
- return ptr;
-}
-
-int VDcheckMsg(void) /* non-block check, return Number of Msg in buffer */
-{
- return get_semval(ccountid);
-}
-
-int VDbufEmpty(void)
-{
- /*
- Fprintf(stderr, "VD ecountid %d, shm-block_num %d\n",
- get_semval(ecountid), shm->block_num);
- */
- return (get_semval(ecountid) == shm->block_num);
-}
-
-FrameBlock * VDpeekMsg(void)
-{
- FrameBlock * ptr;
-
- enter_cs(sid);
-
- if (shm->qhead == shm->qtail)
- ptr = NULL;
- else
- ptr = shm->cqueue[shm->qtail];
- leave_cs(sid);
- /*
- if (ptr != NULL) {
- fprintf(stderr, "pid %d VDpeekMsg() = %u, ref=%d\n",
- ACE_OS::getpid (), (unsigned)ptr, ptr->refcount);
- }
- */
- return ptr;
-}
-
-void VDreferMsg(FrameBlock * msgPtr)
-{
- enter_cs(sid);
- msgPtr->refcount ++;
- leave_cs(sid);
- /*
- fprintf(stderr, "pid %d VDreferMsg() %u, ccount %d\n",
- ACE_OS::getpid (), (unsigned)msgPtr, get_semval(ccountid));
- */
-}
-
-void VDreclaimMsg(FrameBlock * msgPtr)
-{
- int ref;
- enter_cs(sid);
- ref = msgPtr->refcount;
- if (msgPtr->refcount <= 1)
- {
- put_block(msgPtr, ESTACK);
- leave_cs(ecountid);
- }
- else
- msgPtr->refcount --;
- leave_cs(sid);
- /*
- fprintf(stderr, "pid %d VDreclaimMsg() %u, ref %d, ecount %d\n",
- ACE_OS::getpid (), (unsigned)msgPtr, ref, get_semval(ecountid));
- */
- if (ref <= 0) {
- Fprintf(stderr, "pid %d VDreclaimMsg() %u WEIRD, :ref %d:, ecount %d\n",
- ACE_OS::getpid (), (unsigned)msgPtr, ref, get_semval(ecountid));
- }
-}
-
-void VDdeleteBuf(void)
-{
- remove_shared_mem((char*)shm);
-}
-
-void VDdeleteSem(void)
-{
- remove_semaphore(ecountid);
- remove_semaphore(ccountid);
- remove_semaphore(sid);
-}
-
-int
-get_more_data(unsigned int *buf_start, int max_length,
- int *length_ptr, unsigned int **buf_ptr)
-{
- fprintf(stderr,
- "Fatel error: vd.c get_more_data() should not be called, bufLength = %d.!\n",
- *length_ptr);
- fprintf(stderr, " **** Please report this bug. ****\n");
- // ACE_OS::exit (1);
- return 0;
-}
-
-static void printPacket(VideoPacket *p)
-{
- fprintf(stderr, "VD: Packet(%x)=cmd-%d, cmdsn-%d sh-%d, gop-%d\n",
- (int)p, p->cmd, p->cmdsn, p->sh, p->gop);
- fprintf(stderr, " frame-%d, display-%d, future-%d, past-%d, bytes-%d\n",
- p->frame, p->display, p->future,
- p->past, p->dataBytes);
-}
-
-
-void VDprocess (int CTRpid)
-{
- FrameBlock * curBlk = NULL;
- PictImage * curPict = NULL;
-
- InitDitherEnv();
-
- curVidStream = NewVidStream();
- if (curVidStream == NULL)
- {
- fprintf(stderr, "VD: unable to allocat curVidStream.\n");
- ACE_OS::exit (1);
- }
-
- for(;;)
- {
- int curcmd, curcmdsn;
- int i;
- int single_tag;
- VideoPacket *p;
-
- if (curBlk != NULL) {
- VDreclaimMsg(curBlk);
- curBlk = NULL;
- }
- p = (VideoPacket*)vbuffer->VBgetMsg(); /* guarranteed to get a Packet */
-
- // printPacket(p);
- // fprintf(stderr, "VD: got frame %d\n", p->frame);
-
- curcmd = shared->cmd;
- curcmdsn = shared->cmdsn;
- if (p->cmdsn != shared->cmdsn)
- {
- /*
- fprintf(stderr, "VD: frame not for current Cmd, discard it:p->cmdsn:%d,shared->cmdsn:%d\n",
- p->cmdsn,shared->cmdsn);
- printPacket(p);
- */
- vbuffer->VBreclaimMsg((char*)p);
- continue;
- }
- if (curcmd == CmdINIT)
- {
- /* free/allocate all PictImages, resize VDbuffer */
- curVidStream->future = curVidStream->past = curVidStream->current = NULL;
- win_width = ((shared->horizontalSize + 15)>>4)<<4;
- win_height = ((shared->verticalSize + 15)>>4)<<4;
- for (i = 0; i < RING_BUF_SIZE; i++)
- {
- if (curVidStream->ring[i] != NULL)
- DestroyPictImage(curVidStream->ring[i]);
- curVidStream->ring[i] =
- NewPictImage(win_width, win_height);
- }
- for (i = 0; i < 500; i ++) {
- if (!VDbufEmpty()) usleep(1000);
- else break;
- }
- if (!VDbufEmpty()) {
- fprintf(stderr, "VD error<weired>: VDbuf can't become empty.\n");
- exit(1);
- }
- VDresizeBuf(shared->verticalSize, shared->horizontalSize);
- }
- else if (curcmd == CmdPLAY || curcmd == CmdSTEP)
- {
- /* to check if the packet can be decoded or not */
- if (p->future == -1)
- { /* swap because the existing VD decoding algorithm refer to 'future' frame
- to decode a P frame */
- int tmp = p->past;
- p->past = p->future;
- /* following is the bug found on 2-14-96, this may be the cause of decoding
- P frames incorrectly, and showing corrupted messages, when previous I/P
- frames are dropped. This happens frequently when the server is a remote one.
-
- p->future = p->past;
-
- */
- p->future = tmp;
-
- }
- if ((p->future >= 0 &&
- (curVidStream->future == NULL || curVidStream->future->frame != p->future)) ||
- (p->past >= 0 &&
- (curVidStream->past == NULL || curVidStream->past->frame != p->past)))
- {
- /*
- fprintf(stderr,
- "VD: unable to decode packet -- future and/or past frame no available.\n");
- printPacket(p);
- */
- if (curcmd == CmdSTEP && curcmdsn == shared->cmdsn) {
- /*
- Fprintf(stderr, "VD failed to decode f%d, USR1 to CTR for STEP\n", p->frame);
- */
- char message[BUFSIZ];
- message [0]= DECODED;
- int result = ACE_OS::write (vdsp[1],&message,BUFSIZ);
- if (result == -1)
- perror ("VD:Decode Notify");
- if (result == 0)
- perror ("VD:Socket Closed");
- }
-#ifdef STAT
- else if (shared->collectStat && curcmd == CmdPLAY)
- shared->stat.VDnoRef ++;
-#endif
- vbuffer->VBreclaimMsg((char*)p);
- continue;
- }
- }
- curBlk = VDgetBuf();
-
- single_tag = 0;
- /* to check if it's in time for PLAY, FF and FB */
- if (curcmd == CmdPLAY)
- {
-
-#if 0
- /* checking against sendPattern seems irreasonable, because send-pattern of a less
- frame-rate is not necessarily a subset of the one of a bigger frame-rate.
- */
- /* check against sendPattern */
- if (p->frame - shared->firstGopFrames > 0)
- {
- int i = (p->frame - shared->firstGopFrames) %
- (shared->patternSize * shared->sendPatternGops);
- if (shared->sendPattern[i] == 0)
- {
- vbuffer->VBreclaimMsg((char*)p);
-#ifdef STAT
- if (shared->collectStat)
- shared->stat.VDagainstSendPattern ++;
-#endif
- continue;
- }
- }
-#endif
-
- if (vbuffer->VBcheckMsg() > 0) { /* a frame is to be dropped only if
- there are more frames in VB */
- if (p->past >= 0) { /* 'B' */
- if (p->display <= shared->nextFrame) {
-#ifdef STAT
- if (shared->collectStat)
- shared->stat.VDtooLateB ++;
-#endif
- goto frameTooLate;
- }
- }
- else if (p->future >= 0) { /* 'P' */
- if (shared->lastIframeDecoded + shared->IframeGap <= shared->nextFrame) {
-#ifdef STAT
- if (shared->collectStat)
- shared->stat.VDtooLateP ++;
-#endif
- goto frameTooLate;
- }
- }
- else { /* 'I' */
- if (!shared->live)
- {
- if (p->display + shared->IframeGap <= shared->nextFrame) {
-#ifdef STAT
- if (shared->collectStat)
- shared->stat.VDtooLateI ++;
-#endif
- frameTooLate:
- if (shared->rtplay) /* too late, drop the frame */
- {
- vbuffer->VBreclaimMsg((char*)p);
- /*
- Fprintf(stderr, "VD: frame %d too late, shared->nextFrame %d.\n",
- p->frame, shared->nextFrame);
- */
- continue;
- }
- }
- }
- else { /* live video */
- if (p->display < shared->nextFrame) {
- vbuffer->VBreclaimMsg((char*)p);
- /*
- Fprintf(stderr, "VD live video frame %d too late, nextFrame=%d\n",
- p->frame, shared->nextFrame);
- */
- continue;
- }
- }
- }
- }
- }
- else if (curcmd == CmdFF)
- {
- if (p->gop < shared->nextGroup && VDcheckMsg() > 0)
- {
- /*
- fprintf(stderr, "VD: a frame too late and dropped when FF.\n");
- printPacket(p);
- */
- vbuffer->VBreclaimMsg((char*)p);
- continue;
- }
- }
- else if (curcmd == CmdFB)
- {
- if (p->gop > shared->nextGroup && VDcheckMsg() > 0)
- {
- /*
- fprintf(stderr, "VD: a frame too late and dropped when FB.\n");
- printPacket(p);
- */
- vbuffer->VBreclaimMsg((char*)p);
- continue;
- }
- }
- else
- single_tag = 1;
-
- if (shared->videoFormat == VIDEO_JPEG || shared->videoFormat == VIDEO_SIF) {
- int picsize = win_width * win_height;
- unsigned char * l, *cr, *cb;
-
- if (shared->videoFormat == VIDEO_SIF) {
- l = (unsigned char*)p + sizeof(*p);
- cr = l + picsize;
- cb = l + picsize + (picsize >> 2);
- }
- else { /* decode the JPEG frame */
- l = cr = cb = (unsigned char *)curBlk->data;
- memcpy(l, (unsigned char*)p + sizeof(*p), p->dataBytes);
- }
- DoDitherImage(l, cr, cb,
- (unsigned char *)curBlk->data, win_height, win_width);
- curBlk->sh = p->sh;
- curBlk->gop = p->gop;
- curBlk->frame = p->frame;
- curBlk->display = p->display;
- curBlk->future = p->future;
- curBlk->past = p->past;
- VDputMsg(curBlk);
- curBlk = NULL;
- /*
- Fprintf(stderr, "VD: SIF frame %d decoded.\n", p->frame);
- */
- goto end_decode_loop;
- }
-#ifdef NeedByteOrderConversion
- else {
- unsigned int * ptr = (unsigned int *)((char*)p + sizeof(*p));
- /* the added two extra words to max_buf_length: one is for SHCODE, already
- in right byte order, the second is for prevent calling of get_more_data().
- (which seem required for the UCB decoder used here ), this second word
- contains value used by VB algorithm, and can't be changed elsewhere.
- So they should not be swapped byte order. */
- for (i=0; i<((p->dataBytes + 11)>>2) - 2; i++)
- {
- *ptr = ntohl(*ptr);
- ptr++;
- }
- }
-#endif
-
- if (!mpegVidRsrc((char*)p)) /* successfully decoded */
- {
- curPict = curVidStream->current;
-
- // fprintf(stderr, "VD successfully decodes a frame.\n");
- // printPacket(p);
-
- if (curcmd == CmdPLAY && shared->rtplay)
- {
- if ((curVidStream->picture.code_type == I_TYPE) ||
- (curVidStream->picture.code_type == P_TYPE))
- {
- if (curVidStream->future == NULL)
- {
- curVidStream->future = curVidStream->current;
- curVidStream->future->locked |= FUTURE_LOCK;
- }
- else
- {
- if (curVidStream->past != NULL)
- {
- curVidStream->past->locked &= ~PAST_LOCK;
- }
- else if (curcmd == CmdPLAY) {
- /* this case should happen only at the begining of PLAY */
- DitherFrame(curVidStream->future, VDgetBuf());
- }
- curVidStream->past = curVidStream->future;
- curVidStream->past->locked &= ~FUTURE_LOCK;
- curVidStream->past->locked |= PAST_LOCK;
- curVidStream->future = curVidStream->current;
- curVidStream->future->locked |= FUTURE_LOCK;
- }
- }
- }
- else if (curcmd == CmdSTEP || curcmd == CmdPLAY) /* !shared->rtplay */
- {
- if ((curVidStream->picture.code_type == I_TYPE) ||
- (curVidStream->picture.code_type == P_TYPE))
- {
- if (curVidStream->future == NULL)
- {
- curVidStream->future = curVidStream->current;
- curVidStream->future->locked |= FUTURE_LOCK;
- }
- else
- {
- if (curVidStream->past != NULL)
- {
- curVidStream->past->locked &= ~PAST_LOCK;
- }
- curVidStream->past = curVidStream->future;
- curVidStream->past->locked &= ~FUTURE_LOCK;
- curVidStream->past->locked |= PAST_LOCK;
- curVidStream->future = curVidStream->current;
- curVidStream->future->locked |= FUTURE_LOCK;
- curPict = curVidStream->past;
- }
- }
- }
- else /* only I-frame for all other Cmds */
- {
- if (curVidStream->future != NULL) {
- curVidStream->future->locked &= ~FUTURE_LOCK;
- curVidStream->future = NULL;
- }
- if (curVidStream->past != NULL)
- {
- curVidStream->past->locked &= ~PAST_LOCK;
- curVidStream->past = NULL;
- }
- /*
- curVidStream->future = curVidStream->current;
- curVidStream->future->locked |= FUTURE_LOCK;
- */
- }
-
- if (p->past == -1 && p->future == -1)
- shared->lastIframeDecoded = p->frame;
-
-#ifdef STAT
- if (shared->collectStat && p->cmd != CmdREF)
- {
- int val = curPict->frame;
- shared->stat.VDframesDecoded[val>>3] |= 1 << (val % 8);
- shared->stat.VDlastFrameDecoded = val;
- }
-#endif
- /*
- if (single_tag && p->cmd != CmdREF)
- {
- fprintf(stderr, "VD: display %d for single.\n", curPict->display);
- }
- */
- /*
- Fprintf(stderr, "p->cmd %d, p->cmdsn %d, shared->cmdsn %d\n",
- p->cmd, p->cmdsn, shared->cmdsn);
- */
- if (p->cmd != CmdREF && curcmdsn == shared->cmdsn) {
- DitherFrame(curPict, curBlk);
- curBlk = NULL;
- }
- }
- else /* decoding failed */
- {
-
- fprintf(stderr, "VD error -- tried but failed decoding the packet.\n");
- printPacket(p);
- }
-
- end_decode_loop:
-
- /* signal CTR for singlular operation: STEP, POSITION, INIT */
- if (single_tag && p->cmd != CmdREF && curcmdsn == shared->cmdsn)
- {
-
- fprintf(stderr, "VD decoded f%d, USR1 to CTR\n", p->frame);
- char message[BUFSIZ];
- message[0]= DECODED;
- int result = ACE_OS::write (vdsp[1],&message,BUFSIZ);
- if (result == -1)
- perror ("VD:Decode Notify");
- if (result == 0)
- perror ("VD:Socket Closed");
- }
- vbuffer->VBreclaimMsg((char*)p);
- }
-}
-
-
-static void InitDitherEnv(void)
-{
- lum_values = (int *) ACE_OS::malloc(LUM_RANGE*sizeof(int));
- cr_values = (int *) ACE_OS::malloc(CR_RANGE*sizeof(int));
- cb_values = (int *) ACE_OS::malloc(CB_RANGE*sizeof(int));
- init_tables();
-
- while (!shared->pixelValid) {
- usleep(10000);
- }
- ACE_OS::memcpy (pixel, shared->pixel, 256);
-
- switch (ditherType) {
-
- case HYBRID_DITHER:
-
- InitColor();
- InitHybridDither();
- break;
-
- case HYBRID2_DITHER:
- InitColor();
- InitHybridErrorDither();
- break;
-
- case FS4_DITHER:
- InitColor();
- InitFS4Dither();
- break;
-
- case FS2_DITHER:
- InitColor();
- InitFS2Dither();
- break;
-
- case FS2FAST_DITHER:
- InitColor();
- InitFS2FastDither();
- break;
-
- case Twox2_DITHER:
- InitColor();
- Init2x2Dither();
- PostInit2x2Dither();
- break;
-
- case GRAY_DITHER:
- break;
-
- case FULL_COLOR_DITHER:
- InitColorDither();
- break;
-
- case ORDERED_DITHER:
- InitColor();
- InitOrderedDither();
- break;
-
- case MONO_DITHER:
- case MONO_THRESHOLD:
- break;
-
- case ORDERED2_DITHER:
- InitColor();
- InitOrdered2Dither();
- break;
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * DoDitherImage --
- *
- * Called when image needs to be dithered. Selects correct
- * dither routine based on info in ditherType.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void DoDitherImage(unsigned char *l, unsigned char *Cr, unsigned char *Cb,
- unsigned char *disp, int h, int w)
-{
-
- switch(ditherType) {
- case HYBRID_DITHER:
- HybridDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case HYBRID2_DITHER:
- HybridErrorDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case FS2FAST_DITHER:
- FS2FastDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case FS2_DITHER:
- FS2DitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case FS4_DITHER:
- FS4DitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case Twox2_DITHER:
- Twox2DitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case FULL_COLOR_DITHER:
- ColorDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case GRAY_DITHER:
- GrayDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case NO_DITHER:
- break;
-
- case ORDERED_DITHER:
- OrderedDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case MONO_DITHER:
- MonoDitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case MONO_THRESHOLD:
- MonoThresholdImage(l, Cr, Cb, disp, h, w);
- break;
-
- case ORDERED2_DITHER:
- Ordered2DitherImage(l, Cr, Cb, disp, h, w);
- break;
-
- case MBORDERED_DITHER:
- MBOrderedDitherImage(l, Cr, Cb, disp, h, w);
- break;
- }
-}
-
-static void DitherFrame(PictImage * pict, FrameBlock *frame)
-{
- DoDitherImage((unsigned char *)pict->luminance,
- (unsigned char *)pict->Cr, (unsigned char *)pict->Cb,
- (unsigned char *)frame->data, win_height, win_width);
- frame->sh = pict->sh;
- frame->gop = pict->gop;
- frame->frame = pict->frame;
- frame->display = pict->display;
- frame->future = pict->future;
- frame->past = pict->past;
- VDputMsg(frame);
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp
deleted file mode 100644
index 31666f570e2..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp
+++ /dev/null
@@ -1,3761 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/*
- * This file contains C code that implements
- * the video decoder model.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#ifndef MIPS
-#include <sys/time.h>
-#else
-#include <sys/types.h>
-#include <sys/system.h>
-#endif
-
-#include "include/common.h"
-#include "decoders.h"
-#include "video.h"
-#include "util.h"
-#include "proto.h"
-#include "global.h"
-#include "ui.h"
-
-ACE_RCSID(mpeg_client, video, "$Id$")
-
-/* Declarations of functions. */
-static void ReconIMBlock(VidStream *vid_stream, int bnum);
-static void ReconPMBlock(VidStream *vid_stream, int bnum,
- int recon_right_for, int recon_down_for, int zflag);
-static void ReconBMBlock(VidStream *vid_stream,
- int bnum, int recon_right_back,
- int recon_down_back, int zflag);
-static void ReconBiMBlock(VidStream *vid_stream, int bnum, int recon_right_for,
- int recon_down_for, int recon_right_back,
- int recon_down_back, int zflag);
-static void ReconSkippedBlock(unsigned char *source, unsigned char *dest,
- int row, int col, int row_size, int right, int down,
- int right_half, int down_half, int width);
-static int ParseSeqHead(VidStream *vid_stream);
-static int ParseGOP(VidStream *vid_stream);
-static int ParsePicture(VidStream *vid_stream,TimeStamp time_stamp);
-static int ParseSlice(VidStream *vid_stream);
-static int ParseMacroBlock(VidStream *vid_stream);
-static void ProcessSkippedPFrameMBlocks(VidStream *vid_stream);
-static void ProcessSkippedBFrameMBlocks(VidStream *vid_stream);
-
-extern int ditherType;
-char *ditherFlags;
-
-/* Macro for returning 1 if num is positive, -1 if negative, 0 if 0. */
-
-#define Sign(num) ((num > 0) ? 1 : ((num == 0) ? 0 : -1))
-
-/* Declare global pointer to vid stream used for current decoding. */
-
-VidStream *curVidStream = NULL;
-
-/* Set up array for fast conversion from zig zag order to row/column
- coordinates.
-*/
-
-int zigzag[64][2] = {
- 0, 0, 1, 0, 0, 1, 0, 2, 1, 1, 2, 0, 3, 0, 2, 1, 1, 2, 0, 3, 0, 4, 1, 3,
- 2, 2, 3, 1, 4, 0, 5, 0, 4, 1, 3, 2, 2, 3, 1, 4, 0, 5, 0, 6, 1, 5, 2, 4,
- 3, 3, 4, 2, 5, 1, 6, 0, 7, 0, 6, 1, 5, 2, 4, 3, 3, 4, 2, 5, 1, 6, 0, 7,
- 1, 7, 2, 6, 3, 5, 4, 4, 5, 3, 6, 2, 7, 1, 7, 2, 6, 3, 5, 4, 4, 5, 3, 6,
- 2, 7, 3, 7, 4, 6, 5, 5, 6, 4, 7, 3, 7, 4, 6, 5, 5, 6, 4, 7, 5, 7, 6, 6,
-7, 5, 7, 6, 6, 7, 7, 7};
-/* Array mapping zigzag to array pointer offset. */
-
-int zigzag_direct[64] = {
- 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12,
- 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35,
- 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
-58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63};
-/* Set up array for fast conversion from row/column coordinates to
- zig zag order.
-*/
-
-int scan[8][8] = {
- {0, 1, 5, 6, 14, 15, 27, 28},
- {2, 4, 7, 13, 16, 26, 29, 42},
- {3, 8, 12, 17, 25, 30, 41, 43},
- {9, 11, 18, 24, 31, 40, 44, 53},
- {10, 19, 23, 32, 39, 45, 52, 54},
- {20, 22, 33, 38, 46, 51, 55, 60},
- {21, 34, 37, 47, 50, 56, 59, 61},
-{35, 36, 48, 49, 57, 58, 62, 63}};
-/* Initialize P and B skip flags. */
-
-static int No_P_Flag = 0;
-static int No_B_Flag = 0;
-
-/* Max lum, chrom indices for illegal block checking. */
-
-static int lmaxx;
-static int lmaxy;
-static int cmaxx;
-static int cmaxy;
-
-/*
- * We use a lookup table to make sure values stay in the 0..255 range.
- * Since this is cropping (ie, x = (x < 0)?0:(x>255)?255:x; ), wee call this
- * table the "crop table".
- * MAX_NEG_CROP is the maximum neg/pos value we can handle.
- */
-
-#define MAX_NEG_CROP 384
-#define NUM_CROP_ENTRIES (256+2*MAX_NEG_CROP)
-#define assertCrop(x) assert(((x) >= -MAX_NEG_CROP) && \
- ((x) <= 256+MAX_NEG_CROP))
-static unsigned char cropTbl[NUM_CROP_ENTRIES];
-
-/*
- The following accounts for time and size spent in various parsing acitivites
- if ANALYSIS has been defined.
-*/
-
-#ifdef ANALYSIS
-
-
-unsigned int bitCount = 0;
-
-int showmb_flag = 0;
-int showEachFlag = 0;
-
-typedef struct {
- int frametype;
- unsigned int totsize;
- unsigned int number;
- unsigned int i_mbsize;
- unsigned int p_mbsize;
- unsigned int b_mbsize;
- unsigned int bi_mbsize;
- unsigned int i_mbnum;
- unsigned int p_mbnum;
- unsigned int b_mbnum;
- unsigned int bi_mbnum;
- unsigned int i_mbcbp[64];
- unsigned int p_mbcbp[64];
- unsigned int b_mbcbp[64];
- unsigned int bi_mbcbp[64];
- unsigned int i_mbcoeff[64];
- unsigned int p_mbcoeff[64];
- unsigned int b_mbcoeff[64];
- unsigned int bi_mbcoeff[64];
- double tottime;
-} Statval;
-
-Statval stat_a[4];
-unsigned int pictureSizeCount;
-unsigned int mbSizeCount;
-unsigned int *mbCBPPtr, *mbCoeffPtr, *mbSizePtr;
-unsigned int cacheHit[8][8];
-unsigned int cacheMiss[8][8];
-
-static void
-init_stat_struct(astat)
- Statval *astat;
-{
- int j;
-
- astat->frametype = 0;
- astat->totsize = 0;
- astat->number = 0;
- astat->i_mbsize = 0;
- astat->p_mbsize = 0;
- astat->b_mbsize = 0;
- astat->bi_mbsize = 0;
- astat->i_mbnum = 0;
- astat->p_mbnum = 0;
- astat->b_mbnum = 0;
- astat->bi_mbnum = 0;
-
- for (j = 0; j < 64; j++) {
-
- astat->i_mbcbp[j] = 0;
- astat->p_mbcbp[j] = 0;
- astat->b_mbcbp[j] = 0;
- astat->bi_mbcbp[j] = 0;
- astat->i_mbcoeff[j] = 0;
- astat->p_mbcoeff[j] = 0;
- astat->b_mbcoeff[j] = 0;
- astat->bi_mbcoeff[j] = 0;
- }
- astat->tottime = 0.0;
-}
-
-void
-init_stats()
-{
- int i, j;
-
- for (i = 0; i < 4; i++) {
- init_stat_struct(&(stat_a[i]));
- stat_a[i].frametype = i;
- }
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- cacheHit[i][j] = 0;
- cacheMiss[i][j] = 0;
- }
- }
-
- bitCount = 0;
-}
-
-static void
-PrintOneStat()
-{
- int i;
-
- printf("\n");
- switch (stat_a[0].frametype) {
- case I_TYPE:
- printf("I FRAME\n");
- break;
- case P_TYPE:
- printf("P FRAME\n");
- break;
- case B_TYPE:
- printf("B FRAME\n");
- break;
- }
-
- printf("Size: %d bytes + %d bits\n", stat_a[0].totsize / 8, stat_a[0].totsize % 8);
- if (stat_a[0].i_mbnum > 0) {
- printf("\tI Macro Block Stats:\n");
- printf("\t%d I Macroblocks\n", stat_a[0].i_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[0].i_mbsize / (8 * stat_a[0].i_mbnum),
- (stat_a[0].i_mbsize * stat_a[0].i_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].i_mbcbp[i],
- stat_a[0].i_mbcbp[i + 1], stat_a[0].i_mbcbp[i + 2], stat_a[0].i_mbcbp[i + 3],
- stat_a[0].i_mbcbp[i + 4], stat_a[0].i_mbcbp[i + 5], stat_a[0].i_mbcbp[i + 6],
- stat_a[0].i_mbcbp[i + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].i_mbcoeff[i],
- stat_a[0].i_mbcoeff[i + 1], stat_a[0].i_mbcoeff[i + 2],
- stat_a[0].i_mbcoeff[i + 3], stat_a[0].i_mbcoeff[i + 4],
- stat_a[0].i_mbcoeff[i + 5], stat_a[0].i_mbcoeff[i + 6],
- stat_a[0].i_mbcoeff[i + 7]);
- }
- }
- if (stat_a[0].p_mbnum > 0) {
- printf("\tP Macro Block Stats:\n");
- printf("\t%d P Macroblocks\n", stat_a[0].p_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[0].p_mbsize / (8 * stat_a[0].p_mbnum),
- (stat_a[0].p_mbsize / stat_a[0].p_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].p_mbcbp[i],
- stat_a[0].p_mbcbp[i + 1], stat_a[0].p_mbcbp[i + 2], stat_a[0].p_mbcbp[i + 3],
- stat_a[0].p_mbcbp[i + 4], stat_a[0].p_mbcbp[i + 5], stat_a[0].p_mbcbp[i + 6],
- stat_a[0].p_mbcbp[i + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].p_mbcoeff[i],
- stat_a[0].p_mbcoeff[i + 1], stat_a[0].p_mbcoeff[i + 2],
- stat_a[0].p_mbcoeff[i + 3], stat_a[0].p_mbcoeff[i + 4],
- stat_a[0].p_mbcoeff[i + 5], stat_a[0].p_mbcoeff[i + 6],
- stat_a[0].p_mbcoeff[i + 7]);
- }
- }
- if (stat_a[0].b_mbnum > 0) {
- printf("\tB Macro Block Stats:\n");
- printf("\t%d B Macroblocks\n", stat_a[0].b_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[0].b_mbsize / (8 * stat_a[0].b_mbnum),
- (stat_a[0].b_mbsize / stat_a[0].b_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].b_mbcbp[i],
- stat_a[0].b_mbcbp[i + 1], stat_a[0].b_mbcbp[i + 2], stat_a[0].b_mbcbp[i + 3],
- stat_a[0].b_mbcbp[i + 4], stat_a[0].b_mbcbp[i + 5], stat_a[0].b_mbcbp[i + 6],
- stat_a[0].b_mbcbp[i + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].b_mbcoeff[i],
- stat_a[0].b_mbcoeff[i + 1], stat_a[0].b_mbcoeff[i + 2],
- stat_a[0].b_mbcoeff[i + 3], stat_a[0].b_mbcoeff[i + 4],
- stat_a[0].b_mbcoeff[i + 5], stat_a[0].b_mbcoeff[i + 6],
- stat_a[0].b_mbcoeff[i + 7]);
- }
- }
- if (stat_a[0].bi_mbnum > 0) {
- printf("\tBi Macro Block Stats:\n");
- printf("\t%d Bi Macroblocks\n", stat_a[0].bi_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[0].bi_mbsize / (8 * stat_a[0].bi_mbnum),
- (stat_a[0].bi_mbsize * stat_a[0].bi_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].bi_mbcbp[i],
- stat_a[0].bi_mbcbp[i + 1], stat_a[0].bi_mbcbp[i + 2], stat_a[0].bi_mbcbp[i + 3],
- stat_a[0].bi_mbcbp[i + 4], stat_a[0].bi_mbcbp[i + 5], stat_a[0].bi_mbcbp[i + 6],
- stat_a[0].bi_mbcbp[i + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (i = 0; i < 64; i += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].bi_mbcoeff[i],
- stat_a[0].bi_mbcoeff[i + 1], stat_a[0].bi_mbcoeff[i + 2],
- stat_a[0].bi_mbcoeff[i + 3], stat_a[0].bi_mbcoeff[i + 4],
- stat_a[0].bi_mbcoeff[i + 5], stat_a[0].bi_mbcoeff[i + 6],
- stat_a[0].bi_mbcoeff[i + 7]);
- }
- }
- printf("\nTime to Decode: %g secs.\n", stat_a[0].tottime);
- printf("****************\n");
-}
-
-void
-PrintAllStats()
-{
- int i, j;
- unsigned int supertot, supernum;
- double supertime;
-
- printf("\n");
- printf("General Info: \n");
- printf("Width: %d\nHeight: %d\n", curVidStream->mb_width * 16, curVidStream->mb_height * 16);
-
- for (i = 1; i < 4; i++) {
-
- if (stat_a[i].number == 0)
- continue;
-
- switch (i) {
- case 1:
- printf("I FRAMES\n");
- break;
- case 2:
- printf("P FRAMES\n");
- break;
- case 3:
- printf("B FRAMES\n");
- break;
- }
-
- printf("Number: %d\n", stat_a[i].number);
- printf("Avg. Size: %d bytes + %d bits\n",
- stat_a[i].totsize / (8 * stat_a[i].number), (stat_a[i].totsize / stat_a[i].number) % 8);
- if (stat_a[i].i_mbnum > 0) {
- printf("\tI Macro Block Stats:\n");
- printf("\t%d I Macroblocks\n", stat_a[i].i_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[i].i_mbsize / (8 * stat_a[i].i_mbnum),
- (stat_a[i].i_mbsize / stat_a[i].i_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].i_mbcbp[j],
- stat_a[i].i_mbcbp[j + 1], stat_a[i].i_mbcbp[j + 2], stat_a[i].i_mbcbp[j + 3],
- stat_a[i].i_mbcbp[j + 4], stat_a[i].i_mbcbp[j + 5], stat_a[i].i_mbcbp[j + 6],
- stat_a[i].i_mbcbp[j + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].i_mbcoeff[j],
- stat_a[i].i_mbcoeff[j + 1], stat_a[i].i_mbcoeff[j + 2],
- stat_a[i].i_mbcoeff[j + 3], stat_a[i].i_mbcoeff[j + 4],
- stat_a[i].i_mbcoeff[j + 5], stat_a[i].i_mbcoeff[j + 6],
- stat_a[i].i_mbcoeff[j + 7]);
- }
- }
- if (stat_a[i].p_mbnum > 0) {
- printf("\tP Macro Block Stats:\n");
- printf("\t%d P Macroblocks\n", stat_a[i].p_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[i].p_mbsize / (8 * stat_a[i].p_mbnum),
- (stat_a[i].p_mbsize / stat_a[i].p_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].p_mbcbp[j],
- stat_a[i].p_mbcbp[j + 1], stat_a[i].p_mbcbp[j + 2], stat_a[i].p_mbcbp[j + 3],
- stat_a[i].p_mbcbp[j + 4], stat_a[i].p_mbcbp[j + 5], stat_a[i].p_mbcbp[j + 6],
- stat_a[i].p_mbcbp[j + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].p_mbcoeff[j],
- stat_a[i].p_mbcoeff[j + 1], stat_a[i].p_mbcoeff[j + 2],
- stat_a[i].p_mbcoeff[j + 3], stat_a[i].p_mbcoeff[j + 4],
- stat_a[i].p_mbcoeff[j + 5], stat_a[i].p_mbcoeff[j + 6],
- stat_a[i].p_mbcoeff[j + 7]);
- }
- }
- if (stat_a[i].b_mbnum > 0) {
- printf("\tB Macro Block Stats:\n");
- printf("\t%d B Macroblocks\n", stat_a[i].b_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[i].b_mbsize / (8 * stat_a[i].b_mbnum),
- (stat_a[i].b_mbsize * stat_a[i].b_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].b_mbcbp[j],
- stat_a[i].b_mbcbp[j + 1], stat_a[i].b_mbcbp[j + 2], stat_a[i].b_mbcbp[j + 3],
- stat_a[i].b_mbcbp[j + 4], stat_a[i].b_mbcbp[j + 5], stat_a[i].b_mbcbp[j + 6],
- stat_a[i].b_mbcbp[j + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].b_mbcoeff[j],
- stat_a[i].b_mbcoeff[j + 1], stat_a[i].b_mbcoeff[j + 2],
- stat_a[i].b_mbcoeff[j + 3], stat_a[i].b_mbcoeff[j + 4],
- stat_a[i].b_mbcoeff[j + 5], stat_a[i].b_mbcoeff[j + 6],
- stat_a[i].b_mbcoeff[j + 7]);
- }
- }
- if (stat_a[i].bi_mbnum > 0) {
- printf("\tBi Macro Block Stats:\n");
- printf("\t%d Bi Macroblocks\n", stat_a[i].bi_mbnum);
- printf("\tAvg. Size: %d bytes + %d bits\n",
- stat_a[i].bi_mbsize / (8 * stat_a[i].bi_mbnum),
- (stat_a[i].bi_mbsize * stat_a[i].bi_mbnum) % 8);
- printf("\t\tCoded Block Pattern Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].bi_mbcbp[j],
- stat_a[i].bi_mbcbp[j + 1], stat_a[i].bi_mbcbp[j + 2], stat_a[i].bi_mbcbp[j + 3],
- stat_a[i].bi_mbcbp[j + 4], stat_a[i].bi_mbcbp[j + 5], stat_a[i].bi_mbcbp[j + 6],
- stat_a[i].bi_mbcbp[j + 7]);
- }
- printf("\n\t\tNumber of Coefficients/Block Histogram:\n");
- for (j = 0; j < 64; j += 8) {
- printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].bi_mbcoeff[j],
- stat_a[i].bi_mbcoeff[j + 1], stat_a[i].bi_mbcoeff[j + 2],
- stat_a[i].bi_mbcoeff[j + 3], stat_a[i].bi_mbcoeff[j + 4],
- stat_a[i].bi_mbcoeff[j + 5], stat_a[i].bi_mbcoeff[j + 6],
- stat_a[i].bi_mbcoeff[j + 7]);
- }
- }
- printf("\nAvg. Time to Decode: %f secs.\n",
- (stat_a[i].tottime / ((double) stat_a[i].number)));
- printf("\n");
- printf("*************************\n\n");
- }
-
- supertot = stat_a[1].totsize + stat_a[2].totsize + stat_a[3].totsize;
- supernum = stat_a[1].number + stat_a[2].number + stat_a[3].number;
- supertime = stat_a[1].tottime + stat_a[2].tottime + stat_a[3].tottime;
-
- printf("Total Number of Frames: %d\n", supernum);
- printf("Avg Frame Size: %d bytes %d bits\n",
- supertot / (8 * supernum), (supertot / supernum) % 8);
- printf("Total Time Decoding: %g secs.\n", supertime);
- printf("Avg Decoding Time/Frame: %g secs.\n", supertime / ((double) supernum));
- printf("Avg Decoding Frames/Sec: %g secs.\n", ((double) supernum) / supertime);
- printf("\n");
-
- printf("Cache Hits/Miss\n");
- for (i = 0; i < 8; i++) {
- printf("%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\n",
- cacheHit[i][0], cacheMiss[i][0], cacheHit[i][1], cacheMiss[i][1],
- cacheHit[i][2], cacheMiss[i][2], cacheHit[i][3], cacheMiss[i][3]);
- printf("%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\n",
- cacheHit[i][4], cacheMiss[i][4], cacheHit[i][5], cacheMiss[i][5],
- cacheHit[i][6], cacheMiss[i][6], cacheHit[i][7], cacheMiss[i][7]);
- }
-
-}
-
-static void
-CollectStats()
-{
- int i, j;
-
- i = stat_a[0].frametype;
-
- stat_a[i].totsize += stat_a[0].totsize;
- stat_a[i].number += stat_a[0].number;
- stat_a[i].i_mbsize += stat_a[0].i_mbsize;
- stat_a[i].p_mbsize += stat_a[0].p_mbsize;
- stat_a[i].b_mbsize += stat_a[0].b_mbsize;
- stat_a[i].bi_mbsize += stat_a[0].bi_mbsize;
- stat_a[i].i_mbnum += stat_a[0].i_mbnum;
- stat_a[i].p_mbnum += stat_a[0].p_mbnum;
- stat_a[i].b_mbnum += stat_a[0].b_mbnum;
- stat_a[i].bi_mbnum += stat_a[0].bi_mbnum;
-
- for (j = 0; j < 64; j++) {
-
- stat_a[i].i_mbcbp[j] += stat_a[0].i_mbcbp[j];
- stat_a[i].p_mbcbp[j] += stat_a[0].p_mbcbp[j];
- stat_a[i].b_mbcbp[j] += stat_a[0].b_mbcbp[j];
- stat_a[i].bi_mbcbp[j] += stat_a[0].bi_mbcbp[j];
- stat_a[i].i_mbcoeff[j] += stat_a[0].i_mbcoeff[j];
- stat_a[i].p_mbcoeff[j] += stat_a[0].p_mbcoeff[j];
- stat_a[i].b_mbcoeff[j] += stat_a[0].b_mbcoeff[j];
- stat_a[i].bi_mbcoeff[j] += stat_a[0].bi_mbcoeff[j];
- }
-
- stat_a[i].tottime += stat_a[0].tottime;
-
- init_stat_struct(&(stat_a[0]));
-}
-
-static unsigned int
-bitCountRead()
-{
- return bitCount;
-}
-
-static void
-StartTime()
-{
- stat_a[0].tottime = ReadSysClock();
-}
-
-static void
-EndTime()
-{
- stat_a[0].tottime = ReadSysClock() - stat_a[0].tottime;
-}
-#endif
-
-double realTimeStart;
-int totNumFrames = 0;
-
-double
-ReadSysClock()
-{
- struct timeval tv;
- (void) gettimeofday(&tv, (struct timezone *)NULL);
- return (tv.tv_sec + tv.tv_usec / 1000000.0);
-}
-
-void
-PrintTimeInfo()
-{
- double spent;
-
- spent = ReadSysClock() - realTimeStart;
-
- if (!quietFlag) {
- printf("\nReal Time Spent (After Initializations): %f secs.\n", spent);
- printf("Avg. Frames/Sec: %f\n", ((double) totNumFrames) / spent);
-/*
- print_delta();
-*/
- }
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * NewVidStream --
- *
- * Allocates and initializes a VidStream structure. Takes
- * as parameter requested size for buffer length.
- *
- * Results:
- * A pointer to the new VidStream structure.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-VidStream * NewVidStream(void)
-{
- int i, j;
- VidStream *new_stream;
- static unsigned char default_intra_matrix[64] = {
- 8, 16, 19, 22, 26, 27, 29, 34,
- 16, 16, 22, 24, 27, 29, 34, 37,
- 19, 22, 26, 27, 29, 34, 34, 38,
- 22, 22, 26, 27, 29, 34, 37, 40,
- 22, 26, 27, 29, 32, 35, 40, 48,
- 26, 27, 29, 32, 35, 40, 48, 58,
- 26, 27, 29, 34, 38, 46, 56, 69,
- 27, 29, 35, 38, 46, 56, 69, 83};
-
- /* Allocate memory for new structure. */
-
- new_stream = (VidStream *) ACE_OS::malloc(sizeof(VidStream));
-
- /* Initialize pointers to extension and user data. */
-
- new_stream->group.ext_data = new_stream->group.user_data =
- new_stream->picture.extra_info = new_stream->picture.user_data =
- new_stream->picture.ext_data = new_stream->slice.extra_info =
- new_stream->ext_data = new_stream->user_data = NULL;
-
- /* Copy default intra matrix. */
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- new_stream->intra_quant_matrix[j][i] = default_intra_matrix[i * 8 + j];
- }
- }
-
- /* Initialize crop table. */
-
- for (i = (-MAX_NEG_CROP); i < NUM_CROP_ENTRIES - MAX_NEG_CROP; i++) {
- if (i <= 0) {
- cropTbl[i + MAX_NEG_CROP] = 0;
- } else if (i >= 255) {
- cropTbl[i + MAX_NEG_CROP] = 255;
- } else {
- cropTbl[i + MAX_NEG_CROP] = i;
- }
- }
-
- /* Initialize non intra quantization matrix. */
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- new_stream->non_intra_quant_matrix[j][i] = 16;
- }
- }
-
- /* Initialize pointers to image spaces. */
-
- new_stream->current = new_stream->past = new_stream->future = NULL;
- for (i = 0; i < RING_BUF_SIZE; i++) {
- new_stream->ring[i] = NULL;
- }
-
-
- /* Initialize bitstream i/o fields. */
-
- new_stream->max_buf_length = 0;
- new_stream->bit_offset = 0;
- new_stream->buf_length = 0;
- new_stream->buffer = new_stream->buf_start = NULL;
-
-
- /* Return structure. */
-
- return new_stream;
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * DestroyVidStream --
- *
- * Deallocates a VidStream structure.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-DestroyVidStream(VidStream *astream)
-{
- int i;
-
- if (astream->ext_data != NULL)
- ACE_OS::free (astream->ext_data);
-
- if (astream->user_data != NULL)
- ACE_OS::free (astream->user_data);
-
- if (astream->group.ext_data != NULL)
- ACE_OS::free (astream->group.ext_data);
-
- if (astream->group.user_data != NULL)
- ACE_OS::free (astream->group.user_data);
-
- if (astream->picture.extra_info != NULL)
- ACE_OS::free (astream->picture.extra_info);
-
- if (astream->picture.ext_data != NULL)
- ACE_OS::free (astream->picture.ext_data);
-
- if (astream->picture.user_data != NULL)
- ACE_OS::free (astream->picture.user_data);
-
- if (astream->slice.extra_info != NULL)
- ACE_OS::free (astream->slice.extra_info);
-
- if (astream->buf_start != NULL)
- ACE_OS::free (astream->buf_start);
-
- for (i = 0; i < RING_BUF_SIZE; i++) {
- if (astream->ring[i] != NULL) {
- DestroyPictImage(astream->ring[i]);
- astream->ring[i] = NULL;
- }
- }
-
- ACE_OS::free ((char *) astream);
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * NewPictImage --
- *
- * Allocates and initializes a PictImage structure.
- * The width and height of the image space are passed in
- * as parameters.
- *
- * Results:
- * A pointer to the new PictImage structure.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-PictImage *
-NewPictImage(unsigned int width, unsigned int height)
-{
- PictImage *new_pi;
-
- /* Allocate memory space for new structure. */
-
- new_pi = (PictImage *) ACE_OS::malloc(sizeof(PictImage));
- new_pi->luminance = (unsigned char *) ACE_OS::malloc(width * height);
- new_pi->Cr = (unsigned char *) ACE_OS::malloc(width * height / 4);
- new_pi->Cb = (unsigned char *) ACE_OS::malloc(width * height / 4);
-
- /* Reset locked flag. */
-
- new_pi->locked = 0;
-
- /* Return pointer to new structure. */
-
- return new_pi;
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * DestroyPictImage --
- *
- * Deallocates a PictImage structure.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-void
-DestroyPictImage(PictImage *apictimage)
-{
- if (apictimage->luminance != NULL) {
- ACE_OS::free (apictimage->luminance);
- }
- if (apictimage->Cr != NULL) {
- ACE_OS::free (apictimage->Cr);
- }
- if (apictimage->Cb != NULL) {
- ACE_OS::free (apictimage->Cb);
- }
- ACE_OS::free (apictimage);
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * mpegVidRsrc --
- *
- * Parses bit stream until a picture is decoded
- *
- * Results:
- * 0 - successfully decoded a frame, -1 - failed
- *
- * Side effects:
- * Bit stream is irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-int mpegVidRsrc(char *packet)
-{
- TimeStamp time_stamp = 0;
- VidStream *vid_stream = curVidStream;
- unsigned int data;
- int i, status;
- VideoPacket *p = (VideoPacket *) packet;
-
- /* initialize buffer info and allocate ring item for current frame */
- (curVidStream->buf_start) = (curVidStream->buffer) =
- (unsigned int *)(packet + sizeof(*p));
- curVidStream->max_buf_length = curVidStream->buf_length =
- (p->dataBytes + 11)>>2;
- curVidStream->bit_offset = 0;
-
- i = 0;
- while (curVidStream->ring[i]->locked != 0)
- if (++i >= RING_BUF_SIZE) {
- ACE_OS::perror ("VD fatal error. Ring buffer full.");
- ACE_OS::exit (1);
- }
- curVidStream->current = curVidStream->ring[i];
- curVidStream->current->sh = p->sh;
- curVidStream->current->gop = p->gop;
- curVidStream->current->frame = p->frame;
- curVidStream->current->display = p->display;
- curVidStream->current->future = p->future;
- curVidStream->current->past = p->past;
-
- bitOffset = curVidStream->bit_offset;
-#ifdef UTIL2
- curBits = *curVidStream->buffer << bitOffset;
-#else
- curBits = *curVidStream->buffer;
-#endif
- bufLength = curVidStream->buf_length;
- bitBuffer = curVidStream->buffer;
-
- /*
- * If called for the INIT command, find start code, make sure it is a
- * sequence start code.
- */
-
- if (shared->cmd == CmdINIT) {
- next_start_code();
- show_bits32(data);
- if (data != SEQ_START_CODE) {
- fprintf(stderr, "VD error: This is not first packet of the an MPEG stream, data %u.", data);
- DestroyVidStream(curVidStream);
- ACE_OS::exit (1);
- }
- }
- /* Get next 32 bits (size of start codes). */
-
- show_bits32(data);
-
- /* Process according to start code */
-
- switch (data)
- {
- case SEQ_END_CODE:
-
- /* Display last frame. */
- /*
- fprintf(stderr, "VD: SEQ_END_CODE decoded.\n");
- */
- if (vid_stream->future != NULL)
- {
- vid_stream->current = vid_stream->future;
- return 0;
- }
- else
- {
- fprintf(stderr, "VD error: no more picture for SEQ_END_CODE\n");
- return -1;
- }
-
- case SEQ_START_CODE:
-
- /* Sequence start code. Parse sequence header. */
-
- if (ParseSeqHead(vid_stream) != PARSE_OK)
- {
- fprintf(stderr, "VD error on decoding SequenceHeader.\n");
- return -1;
- }
-
- /*
- * modify vid_stream after sequence start code so that application above can use
- * info in header.
- */
-
- vid_stream->buffer = bitBuffer;
- vid_stream->buf_length = bufLength;
- vid_stream->bit_offset = bitOffset;
- vid_stream->shid = ((VideoPacket *)packet)->sh;
-
- case GOP_START_CODE:
-
- /* Group of Pictures start code. Parse gop header. */
-
- if (ParseGOP(vid_stream) != PARSE_OK)
- {
- fprintf(stderr, "VD error on decoding GOP\n");
- return -1;
- }
-
- vid_stream->gopid = ((VideoPacket *)packet)->gop;
-
- case PICTURE_START_CODE:
-
- /* Picture start code. Parse picture header and first slice header. */
-
- if (vid_stream->gopid != ((VideoPacket *)packet)->gop ||
- vid_stream->shid != ((VideoPacket *)packet)->sh)
- {
- shared->needHeader = 1;
- /*
- fprintf(stderr, "VD error: SeqHeader and/or GOP not available for the picture");
- */
- return -1;
- }
-
- if (ParsePicture(vid_stream, time_stamp) != PARSE_OK)
- {
- /*
- fprintf(stderr, "VD error on parsing Picture header\n");
- */
- return -1;
- }
- /* parse all the following slices */
- for (;;)
- {
- if (ParseSlice(vid_stream) != PARSE_OK)
- {
- fprintf(stderr, "VD error on decoding a Slice header.\n");
- return -1;
- }
- /* Parse all following macroblocks. */
- for (;;)
- {
- int res;
- /* Check to see if actually a startcode and not a macroblock. */
- if (!next_bits(23, 0x00000000))
- {
- /* Not start code. Parse Macroblock. */
- if ((res = ParseMacroBlock(vid_stream)) != PARSE_OK)
- {
- fprintf(stderr, "VD error on parsing a MacroBlock, res = %d\n", res);
- return -1;
- }
- }
- else
- {
- /* Not macroblock, actually start code. Get start code. */
- next_start_code();
- show_bits32(data);
-
- /* If start code is outside range of slice start codes, frame is
- complete, display frame, otherwise another slice */
- if ((data < SLICE_MIN_START_CODE) || (data > SLICE_MAX_START_CODE))
- return 0;
- else
- break;
- }
- }
- }
- break;
- default:
- fprintf(stderr, "VD error: fail to clasify the packet.\n");
- return -1;
- }
- fprintf(stderr, "VD get wired.\n");
- return -1;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * ParseSeqHead --
- *
- * Assumes bit stream is at the begining of the sequence
- * header start code. Parses off the sequence header.
- *
- * Results:
- * Fills the vid_stream structure with values derived and
- * decoded from the sequence header. Allocates the pict image
- * structures based on the dimensions of the image space
- * found in the sequence header.
- *
- * Side effects:
- * Bit stream irreversibly parsed off.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ParseSeqHead(VidStream *vid_stream)
-{
-
- unsigned int data;
- int i;
-
- /* Flush off sequence start code. */
-
- flush_bits32;
-
- /* Get horizontal size of image space. */
-
- get_bits12(data);
- vid_stream->h_size = data;
-
- /* Get vertical size of image space. */
-
- get_bits12(data);
- vid_stream->v_size = data;
-
- /* Calculate macroblock width and height of image space. */
-
- vid_stream->mb_width = (vid_stream->h_size + 15) / 16;
- vid_stream->mb_height = (vid_stream->v_size + 15) / 16;
-
- /* If dither type is MBORDERED allocate ditherFlags. */
-
- if (ditherType == MBORDERED_DITHER) {
- ditherFlags = (char *) ACE_OS::malloc(vid_stream->mb_width*vid_stream->mb_height);
- }
-
- /* Initialize lmaxx, lmaxy, cmaxx, cmaxy. */
-
- lmaxx = vid_stream->mb_width*16-1;
- lmaxy = vid_stream->mb_height*16-1;
- cmaxx = vid_stream->mb_width*8-1;
- cmaxy = vid_stream->mb_height*8-1;
-
- /* Parse of aspect ratio code. */
-
- get_bits4(data);
- vid_stream->aspect_ratio = (unsigned char) data;
-
- /* Parse off picture rate code. */
-
- get_bits4(data);
- vid_stream->picture_rate = (unsigned char) data;
-
- /* Parse off bit rate. */
-
- get_bits18(data);
- vid_stream->bit_rate = data;
-
- /* Flush marker bit. */
-
- flush_bits(1);
-
- /* Parse off vbv buffer size. */
-
- get_bits10(data);
- vid_stream->vbv_buffer_size = data;
-
- /* Parse off contrained parameter flag. */
-
- get_bits1(data);
- if (data) {
- vid_stream->const_param_flag = TRUE;
- } else
- vid_stream->const_param_flag = FALSE;
-
- /*
- * If intra_quant_matrix_flag set, parse off intra quant matrix values.
- */
-
- get_bits1(data);
- if (data) {
- for (i = 0; i < 64; i++) {
- get_bits8(data);
-
- vid_stream->intra_quant_matrix[zigzag[i][1]][zigzag[i][0]] =
- (unsigned char) data;
- }
- }
- /*
- * If non intra quant matrix flag set, parse off non intra quant matrix
- * values.
- */
-
- get_bits1(data);
- if (data) {
- for (i = 0; i < 64; i++) {
- get_bits8(data);
-
- vid_stream->non_intra_quant_matrix[zigzag[i][1]][zigzag[i][0]] =
- (unsigned char) data;
- }
- }
- /* Go to next start code. */
-
- next_start_code();
-
- /*
- * If next start code is extension start code, parse off extension data.
- */
-
- if (next_bits(32, EXT_START_CODE)) {
- flush_bits32;
- if (vid_stream->ext_data != NULL) {
- ACE_OS::free (vid_stream->ext_data);
- vid_stream->ext_data = NULL;
- }
- vid_stream->ext_data = get_ext_data();
- }
- /* If next start code is user start code, parse off user data. */
-
- if (next_bits(32, USER_START_CODE)) {
- flush_bits32;
- if (vid_stream->user_data != NULL) {
- ACE_OS::free (vid_stream->user_data);
- vid_stream->user_data = NULL;
- }
- vid_stream->user_data = get_ext_data();
- }
- return PARSE_OK;
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ParseGOP --
- *
- * Parses of group of pictures header from bit stream
- * associated with vid_stream.
- *
- * Results:
- * Values in gop header placed into video stream structure.
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ParseGOP(VidStream *vid_stream)
-{
- unsigned int data;
-
- /* Flush group of pictures start code. WWWWWWOOOOOOOSSSSSSHHHHH!!! */
-
- flush_bits32;
-
- /* Parse off drop frame flag. */
-
- get_bits1(data);
- if (data) {
- vid_stream->group.drop_flag = TRUE;
- } else
- vid_stream->group.drop_flag = FALSE;
-
- /* Parse off hour component of time code. */
-
- get_bits5(data);
- vid_stream->group.tc_hours = data;
-
- /* Parse off minute component of time code. */
-
- get_bits6(data);
- vid_stream->group.tc_minutes = data;
-
- /* Flush marker bit. */
-
- flush_bits(1);
-
- /* Parse off second component of time code. */
-
- get_bits6(data);
- vid_stream->group.tc_seconds = data;
-
- /* Parse off picture count component of time code. */
-
- get_bits6(data);
- vid_stream->group.tc_pictures = data;
- /*
- Fprintf(stderr, "GOP time_code:%d:%02d:%02d-%02d\n",
- vid_stream->group.tc_hours,
- vid_stream->group.tc_minutes,
- vid_stream->group.tc_seconds,
- vid_stream->group.tc_pictures);
- */
- /* Parse off closed gop and broken link flags. */
-
- get_bits2(data);
- if (data > 1) {
- vid_stream->group.closed_gop = TRUE;
- if (data > 2) {
- vid_stream->group.broken_link = TRUE;
- } else
- vid_stream->group.broken_link = FALSE;
- } else {
- vid_stream->group.closed_gop = FALSE;
- if (data) {
- vid_stream->group.broken_link = TRUE;
- } else
- vid_stream->group.broken_link = FALSE;
- }
-
- /* Goto next start code. */
-
- next_start_code();
-
- /* If next start code is extension data, parse off extension data. */
-
- if (next_bits(32, EXT_START_CODE)) {
- flush_bits32;
- if (vid_stream->group.ext_data != NULL) {
- ACE_OS::free (vid_stream->group.ext_data);
- vid_stream->group.ext_data = NULL;
- }
- vid_stream->group.ext_data = get_ext_data();
- }
- /* If next start code is user data, parse off user data. */
-
- if (next_bits(32, USER_START_CODE)) {
- flush_bits32;
- if (vid_stream->group.user_data != NULL) {
- ACE_OS::free (vid_stream->group.user_data);
- vid_stream->group.user_data = NULL;
- }
- vid_stream->group.user_data = get_ext_data();
- }
- return PARSE_OK;
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ParsePicture --
- *
- * Parses picture header. Marks picture to be presented
- * at particular time given a time stamp.
- *
- * Results:
- * Values from picture header put into video stream structure.
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ParsePicture(VidStream *vid_stream,TimeStamp time_stamp)
-{
- unsigned int data;
- int i;
-
- /* Flush header start code. */
- flush_bits32;
-
- /* Parse off temporal reference. */
- get_bits10(data);
- vid_stream->picture.temp_ref = data;
- /*
- Fprintf(stderr, "Pic temp_ref %d\n", vid_stream->picture.temp_ref);
- */
- /* Parse of picture type. */
- get_bits3(data);
- vid_stream->picture.code_type = data;
-
- if ((vid_stream->picture.code_type == B_TYPE) &&
- (No_B_Flag ||
- (vid_stream->past == NULL) ||
- (vid_stream->future == NULL)))
- return SKIP_PICTURE;
-
- if ((vid_stream->picture.code_type == P_TYPE) &&
- (No_P_Flag || (vid_stream->future == NULL)))
- return SKIP_PICTURE;
-
- /* Parse off vbv buffer delay value. */
- get_bits16(data);
- vid_stream->picture.vbv_delay = data;
-
- /* If P or B type frame... */
-
- if ((vid_stream->picture.code_type == 2) || (vid_stream->picture.code_type == 3)) {
-
- /* Parse off forward vector full pixel flag. */
- get_bits1(data);
- if (data)
- vid_stream->picture.full_pel_forw_vector = TRUE;
- else
- vid_stream->picture.full_pel_forw_vector = FALSE;
-
- /* Parse of forw_r_code. */
- get_bits3(data);
-
- /* Decode forw_r_code into forw_r_size and forw_f. */
-
- vid_stream->picture.forw_r_size = data - 1;
- vid_stream->picture.forw_f = (1 << vid_stream->picture.forw_r_size);
- }
- /* If B type frame... */
-
- if (vid_stream->picture.code_type == 3) {
-
- /* Parse off back vector full pixel flag. */
- get_bits1(data);
- if (data)
- vid_stream->picture.full_pel_back_vector = TRUE;
- else
- vid_stream->picture.full_pel_back_vector = FALSE;
-
- /* Parse off back_r_code. */
- get_bits3(data);
-
- /* Decode back_r_code into back_r_size and back_f. */
-
- vid_stream->picture.back_r_size = data - 1;
- vid_stream->picture.back_f = (1 << vid_stream->picture.back_r_size);
- }
- /* Get extra bit picture info. */
-
- if (vid_stream->picture.extra_info != NULL) {
- ACE_OS::free (vid_stream->picture.extra_info);
- vid_stream->picture.extra_info = NULL;
- }
- vid_stream->picture.extra_info = get_extra_bit_info();
-
- /* Goto next start code. */
- next_start_code();
-
- /* If start code is extension start code, parse off extension data. */
-
- if (next_bits(32, EXT_START_CODE)) {
- flush_bits32;
-
- if (vid_stream->picture.ext_data != NULL) {
- ACE_OS::free (vid_stream->picture.ext_data);
- vid_stream->picture.ext_data = NULL;
- }
- vid_stream->picture.ext_data = get_ext_data();
- }
- /* If start code is user start code, parse off user data. */
-
- if (next_bits(32, USER_START_CODE)) {
- flush_bits32;
-
- if (vid_stream->picture.user_data != NULL) {
- ACE_OS::free (vid_stream->picture.user_data);
- vid_stream->picture.user_data = NULL;
- }
- vid_stream->picture.user_data = get_ext_data();
- }
-
- /* Reset past macroblock address field. */
-
- vid_stream->mblock.past_mb_addr = -1;
-
- return PARSE_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ParseSlice --
- *
- * Parses off slice header.
- *
- * Results:
- * Values found in slice header put into video stream structure.
- *
- * Side effects:
- * Bit stream irreversibly parsed.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ParseSlice(VidStream *vid_stream)
-{
- unsigned int data;
-
- /* Flush slice start code. */
-
- flush_bits(24);
-
- /* Parse off slice vertical position. */
-
- get_bits8(data);
- vid_stream->slice.vert_pos = data;
-
- /* Parse off quantization scale. */
-
- get_bits5(data);
- vid_stream->slice.quant_scale = data;
-
- /* Parse off extra bit slice info. */
-
- if (vid_stream->slice.extra_info != NULL) {
- ACE_OS::free (vid_stream->slice.extra_info);
- vid_stream->slice.extra_info = NULL;
- }
- vid_stream->slice.extra_info = get_extra_bit_info();
-
- /* Reset past intrablock address. */
-
- vid_stream->mblock.past_intra_addr = -2;
-
- /* Reset previous recon motion vectors. */
-
- vid_stream->mblock.recon_right_for_prev = 0;
- vid_stream->mblock.recon_down_for_prev = 0;
- vid_stream->mblock.recon_right_back_prev = 0;
- vid_stream->mblock.recon_down_back_prev = 0;
-
- /* Reset macroblock address. */
-
- vid_stream->mblock.mb_address = ((vid_stream->slice.vert_pos - 1) *
- vid_stream->mb_width) - 1;
-
- /* Reset past dct dc y, cr, and cb values. */
-
- vid_stream->block.dct_dc_y_past = 1024;
- vid_stream->block.dct_dc_cr_past = 1024;
- vid_stream->block.dct_dc_cb_past = 1024;
-
- return PARSE_OK;
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ParseMacroBlock --
- *
- * Parseoff macroblock. Reconstructs DCT values. Applies
- * inverse DCT, reconstructs motion vectors, calculates and
- * set pixel values for macroblock in current pict image
- * structure.
- *
- * Results:
- * Here's where everything really happens. Welcome to the
- * heart of darkness.
- *
- * Side effects:
- * Bit stream irreversibly parsed off.
- *
- *--------------------------------------------------------------
- */
-
-static int
-ParseMacroBlock(VidStream *vid_stream)
-{
- int addr_incr;
- unsigned int data;
- int mask, i, recon_right_for, recon_down_for, recon_right_back,
- recon_down_back;
- int zero_block_flag;
- BOOLEAN mb_quant, mb_motion_forw, mb_motion_back, mb_pattern;
- int no_dith_flag = 0;
-
-#ifdef ANALYSIS
- mbSizeCount = bitCountRead();
-#endif
-
- /*
- * Parse off macroblock address increment and add to macroblock address.
- */
- do {
- DecodeMBAddrInc(addr_incr);
- if (addr_incr == MB_ESCAPE) {
- vid_stream->mblock.mb_address += 33;
- addr_incr = MB_STUFFING;
- }
- } while (addr_incr == MB_STUFFING);
- vid_stream->mblock.mb_address += addr_incr;
-
- if (vid_stream->mblock.mb_address > ((vid_stream->mb_height) * (vid_stream->mb_width) - 1))
- {
- fprintf(stderr, "mblock.mb_address-%d, mb_height-%d, mb_width-%d, addr_incr-%d\n",
- vid_stream->mblock.mb_address, vid_stream->mb_height, vid_stream->mb_width, addr_incr);
- return SKIP_TO_START_CODE;
- }
-
- /*
- * If macroblocks have been skipped, process skipped macroblocks.
- */
-
- if (vid_stream->mblock.mb_address - vid_stream->mblock.past_mb_addr > 1) {
- if (vid_stream->picture.code_type == P_TYPE)
- ProcessSkippedPFrameMBlocks(vid_stream);
- else if (vid_stream->picture.code_type == B_TYPE)
- ProcessSkippedBFrameMBlocks(vid_stream);
- }
- /* Set past macroblock address to current macroblock address. */
- vid_stream->mblock.past_mb_addr = vid_stream->mblock.mb_address;
-
- /* Based on picture type decode macroblock type. */
- switch (vid_stream->picture.code_type) {
- case I_TYPE:
- DecodeMBTypeI(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern,
- vid_stream->mblock.mb_intra);
- break;
-
- case P_TYPE:
- DecodeMBTypeP(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern,
- vid_stream->mblock.mb_intra);
- break;
-
- case B_TYPE:
- DecodeMBTypeB(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern,
- vid_stream->mblock.mb_intra);
- break;
- }
-
- /* If quantization flag set, parse off new quantization scale. */
-
- if (mb_quant == TRUE) {
- get_bits5(data);
- vid_stream->slice.quant_scale = data;
- }
- /* If forward motion vectors exist... */
- if (mb_motion_forw == TRUE) {
-
- /* Parse off and decode horizontal forward motion vector. */
- DecodeMotionVectors(vid_stream->mblock.motion_h_forw_code);
-
- /* If horiz. forward r data exists, parse off. */
-
- if ((vid_stream->picture.forw_f != 1) &&
- (vid_stream->mblock.motion_h_forw_code != 0)) {
- get_bitsn(vid_stream->picture.forw_r_size, data);
- vid_stream->mblock.motion_h_forw_r = data;
- }
- /* Parse off and decode vertical forward motion vector. */
- DecodeMotionVectors(vid_stream->mblock.motion_v_forw_code);
-
- /* If vert. forw. r data exists, parse off. */
-
- if ((vid_stream->picture.forw_f != 1) &&
- (vid_stream->mblock.motion_v_forw_code != 0)) {
- get_bitsn(vid_stream->picture.forw_r_size, data);
- vid_stream->mblock.motion_v_forw_r = data;
- }
- }
- /* If back motion vectors exist... */
- if (mb_motion_back == TRUE) {
-
- /* Parse off and decode horiz. back motion vector. */
- DecodeMotionVectors(vid_stream->mblock.motion_h_back_code);
-
- /* If horiz. back r data exists, parse off. */
-
- if ((vid_stream->picture.back_f != 1) &&
- (vid_stream->mblock.motion_h_back_code != 0)) {
- get_bitsn(vid_stream->picture.back_r_size, data);
- vid_stream->mblock.motion_h_back_r = data;
- }
- /* Parse off and decode vert. back motion vector. */
- DecodeMotionVectors(vid_stream->mblock.motion_v_back_code);
-
- /* If vert. back r data exists, parse off. */
-
- if ((vid_stream->picture.back_f != 1) &&
- (vid_stream->mblock.motion_v_back_code != 0)) {
- get_bitsn(vid_stream->picture.back_r_size, data);
- vid_stream->mblock.motion_v_back_r = data;
- }
- }
-#ifdef ANALYSIS
- if (vid_stream->mblock.mb_intra) {
- stat_a[0].i_mbnum++;
- mbCBPPtr = stat_a[0].i_mbcbp;
- mbCoeffPtr = stat_a[0].i_mbcoeff;
- mbSizePtr = &(stat_a[0].i_mbsize);
- } else if (mb_motion_back && mb_motion_forw) {
- stat_a[0].bi_mbnum++;
- mbCBPPtr = stat_a[0].bi_mbcbp;
- mbCoeffPtr = stat_a[0].bi_mbcoeff;
- mbSizePtr = &(stat_a[0].bi_mbsize);
- } else if (mb_motion_back) {
- stat_a[0].b_mbnum++;
- mbCBPPtr = stat_a[0].b_mbcbp;
- mbCoeffPtr = stat_a[0].b_mbcoeff;
- mbSizePtr = &(stat_a[0].b_mbsize);
- } else {
- stat_a[0].p_mbnum++;
- mbCBPPtr = stat_a[0].p_mbcbp;
- mbCoeffPtr = stat_a[0].p_mbcoeff;
- mbSizePtr = &(stat_a[0].p_mbsize);
- }
-#endif
-
- /* If mblock pattern flag set, parse and decode CBP (code block pattern). */
- if (mb_pattern == TRUE) {
- DecodeCBP(vid_stream->mblock.cbp);
- }
- /* Otherwise, set CBP to zero. */
- else
- vid_stream->mblock.cbp = 0;
-
-
-#ifdef ANALYSIS
- mbCBPPtr[vid_stream->mblock.cbp]++;
-#endif
-
- /* Reconstruct motion vectors depending on picture type. */
- if (vid_stream->picture.code_type == P_TYPE) {
-
- /*
- * If no forw motion vectors, reset previous and current vectors to 0.
- */
-
- if (!mb_motion_forw) {
- recon_right_for = 0;
- recon_down_for = 0;
- vid_stream->mblock.recon_right_for_prev = 0;
- vid_stream->mblock.recon_down_for_prev = 0;
- }
- /*
- * Otherwise, compute new forw motion vectors. Reset previous vectors to
- * current vectors.
- */
-
- else {
- ComputeForwVector(&recon_right_for, &recon_down_for);
- }
- }
- if (vid_stream->picture.code_type == B_TYPE) {
-
- /* Reset prev. and current vectors to zero if mblock is intracoded. */
-
- if (vid_stream->mblock.mb_intra) {
- vid_stream->mblock.recon_right_for_prev = 0;
- vid_stream->mblock.recon_down_for_prev = 0;
- vid_stream->mblock.recon_right_back_prev = 0;
- vid_stream->mblock.recon_down_back_prev = 0;
- } else {
-
- /* If no forw vectors, current vectors equal prev. vectors. */
-
- if (!mb_motion_forw) {
- recon_right_for = vid_stream->mblock.recon_right_for_prev;
- recon_down_for = vid_stream->mblock.recon_down_for_prev;
- }
- /*
- * Otherwise compute forw. vectors. Reset prev vectors to new values.
- */
-
- else {
- ComputeForwVector(&recon_right_for, &recon_down_for);
- }
-
- /* If no back vectors, set back vectors to prev back vectors. */
-
- if (!mb_motion_back) {
- recon_right_back = vid_stream->mblock.recon_right_back_prev;
- recon_down_back = vid_stream->mblock.recon_down_back_prev;
- }
- /* Otherwise compute new vectors and reset prev. back vectors. */
-
- else {
- ComputeBackVector(&recon_right_back, &recon_down_back);
- }
-
- /*
- * Store vector existance flags in structure for possible skipped
- * macroblocks to follow.
- */
-
- vid_stream->mblock.bpict_past_forw = mb_motion_forw;
- vid_stream->mblock.bpict_past_back = mb_motion_back;
- }
- }
-
- /* For each possible block in macroblock. */
- if (ditherType == GRAY_DITHER ||
- ditherType == MONO_DITHER ||
- ditherType == MONO_THRESHOLD) {
- for (mask = 32, i = 0; i < 4; mask >>= 1, i++) {
-
- /* If block exists... */
- if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & mask)) {
- zero_block_flag = 0;
- ParseReconBlock(i);
- } else {
- zero_block_flag = 1;
- }
-
- /* If macroblock is intra coded... */
- if (vid_stream->mblock.mb_intra) {
- ReconIMBlock(vid_stream, i);
- } else if (mb_motion_forw && mb_motion_back) {
- ReconBiMBlock(vid_stream, i, recon_right_for, recon_down_for,
- recon_right_back, recon_down_back, zero_block_flag);
- } else if (mb_motion_forw || (vid_stream->picture.code_type == P_TYPE)) {
- ReconPMBlock(vid_stream, i, recon_right_for, recon_down_for,
- zero_block_flag);
- } else if (mb_motion_back) {
- ReconBMBlock(vid_stream, i, recon_right_back, recon_down_back,
- zero_block_flag);
- }
- }
- /* Kill the Chrominace blocks... */
- if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & 0x2)) {
- ParseAwayBlock(4);
- }
- if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & 0x1)) {
- ParseAwayBlock(5);
- }
- } else {
- if ((ditherType == MBORDERED_DITHER) &&
- (vid_stream->mblock.cbp == 0) &&
- (vid_stream->picture.code_type == 3) &&
- (!vid_stream->mblock.mb_intra) &&
- (!(mb_motion_forw && mb_motion_back))) {
- /*
- MBOrderedDitherDisplayCopy(vid_stream, vid_stream->mblock.mb_address,
- mb_motion_forw, recon_right_for, recon_down_for,
- mb_motion_back, recon_right_back, recon_down_back,
- vid_stream->past->display, vid_stream->future->display);
- ditherFlags[vid_stream->mblock.mb_address] = 0;
- no_dith_flag = 1;
- */
- }
- else {
- for (mask = 32, i = 0; i < 6; mask >>= 1, i++) {
-
- /* If block exists... */
- if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & mask)) {
- zero_block_flag = 0;
- ParseReconBlock(i);
- } else {
- zero_block_flag = 1;
- }
-
- /* If macroblock is intra coded... */
- if (vid_stream->mblock.mb_intra) {
- ReconIMBlock(vid_stream, i);
- } else if (mb_motion_forw && mb_motion_back) {
- ReconBiMBlock(vid_stream, i, recon_right_for, recon_down_for,
- recon_right_back, recon_down_back, zero_block_flag);
- } else if (mb_motion_forw || (vid_stream->picture.code_type == P_TYPE)) {
- ReconPMBlock(vid_stream, i, recon_right_for, recon_down_for,
- zero_block_flag);
- } else if (mb_motion_back) {
- ReconBMBlock(vid_stream, i, recon_right_back, recon_down_back,
- zero_block_flag);
- }
- }
- }
- }
-
- if ((ditherType == MBORDERED_DITHER) && (!no_dith_flag)) {
- if ((vid_stream->picture.code_type == 2) &&
- (vid_stream->mblock.cbp == 0) &&
- (!vid_stream->mblock.mb_intra)) {
- /*
- MBOrderedDitherDisplayCopy(vid_stream, vid_stream->mblock.mb_address,
- 1, recon_right_for, recon_down_for,
- 0, 0, 0,
- vid_stream->future->display,
- (unsigned char *) NULL);
- ditherFlags[vid_stream->mblock.mb_address] = 0;
- */
- }
- else {
- ditherFlags[vid_stream->mblock.mb_address] = 1;
- }
- }
-
-
- /* If D Type picture, flush marker bit. */
- if (vid_stream->picture.code_type == 4)
- flush_bits(1);
-
- /* If macroblock was intracoded, set macroblock past intra address. */
- if (vid_stream->mblock.mb_intra)
- vid_stream->mblock.past_intra_addr =
- vid_stream->mblock.mb_address;
-
-#ifdef ANALYSIS
- *mbSizePtr += bitCountRead() - mbSizeCount;
-#endif
- return PARSE_OK;
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ReconIMBlock --
- *
- * Reconstructs intra coded macroblock.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ReconIMBlock(VidStream *vid_stream, int bnum)
-{
- int mb_row, mb_col, row, col, row_size, rr;
- unsigned char *dest;
-
- /* Calculate macroblock row and column from address. */
-
- mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width;
- mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width;
-
-
- /* If block is luminance block... */
-
- if (bnum < 4) {
-
- /* Calculate row and col values for upper left pixel of block. */
-
- row = mb_row * 16;
- col = mb_col * 16;
- if (bnum > 1)
- row += 8;
- if (bnum % 2)
- col += 8;
-
- /* Set dest to luminance plane of current pict image. */
-
- dest = vid_stream->current->luminance;
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width * 16;
- }
- /* Otherwise if block is Cr block... */
-
- else if (bnum == 4) {
-
- /* Set dest to Cr plane of current pict image. */
-
- dest = vid_stream->current->Cr;
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width * 8;
-
- /* Calculate row,col for upper left pixel of block. */
-
- row = mb_row * 8;
- col = mb_col * 8;
- }
- /* Otherwise block is Cb block, and ... */
-
- else {
-
- /* Set dest to Cb plane of current pict image. */
-
- dest = vid_stream->current->Cb;
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width * 8;
-
- /* Calculate row,col for upper left pixel value of block. */
-
- row = mb_row * 8;
- col = mb_col * 8;
- }
-
- /*
- * For each pixel in block, set to cropped reconstructed value from inverse
- * dct.
- */
- {
- short *sp = &vid_stream->block.dct_recon[0][0];
- unsigned char *cm = cropTbl + MAX_NEG_CROP;
- dest += row * row_size + col;
- for (rr = 0; rr < 4; rr++, sp += 16, dest += row_size) {
- dest[0] = cm[sp[0]];
- assertCrop(sp[0]);
- dest[1] = cm[sp[1]];
- assertCrop(sp[1]);
- dest[2] = cm[sp[2]];
- assertCrop(sp[2]);
- dest[3] = cm[sp[3]];
- assertCrop(sp[3]);
- dest[4] = cm[sp[4]];
- assertCrop(sp[4]);
- dest[5] = cm[sp[5]];
- assertCrop(sp[5]);
- dest[6] = cm[sp[6]];
- assertCrop(sp[6]);
- dest[7] = cm[sp[7]];
- assertCrop(sp[7]);
-
- dest += row_size;
- dest[0] = cm[sp[8]];
- assertCrop(sp[8]);
- dest[1] = cm[sp[9]];
- assertCrop(sp[9]);
- dest[2] = cm[sp[10]];
- assertCrop(sp[10]);
- dest[3] = cm[sp[11]];
- assertCrop(sp[11]);
- dest[4] = cm[sp[12]];
- assertCrop(sp[12]);
- dest[5] = cm[sp[13]];
- assertCrop(sp[13]);
- dest[6] = cm[sp[14]];
- assertCrop(sp[14]);
- dest[7] = cm[sp[15]];
- assertCrop(sp[15]);
- }
- }
-}
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ReconPMBlock --
- *
- * Reconstructs forward predicted macroblocks.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ReconPMBlock(VidStream *vid_stream, int bnum,
- int recon_right_for, int recon_down_for, int zflag)
-{
- int mb_row, mb_col, row, col, row_size, rr;
- unsigned char *dest, *past;
- static int right_for, down_for, right_half_for, down_half_for;
- unsigned char *rindex1, *rindex2;
- unsigned char *index;
- short int *blockvals;
-
-#ifdef LOOSE_MPEG
- int maxx, maxy;
- int illegalBlock = 0;
- int row_start, row_end, rfirst, rlast, col_start, col_end, cfirst, clast;
-#endif
-
- /* Calculate macroblock row and column from address. */
-
- mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width;
- mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width;
-
- if (bnum < 4) {
-
- /* Calculate right_for, down_for motion vectors. */
-
- right_for = recon_right_for >> 1;
- down_for = recon_down_for >> 1;
- right_half_for = recon_right_for & 0x1;
- down_half_for = recon_down_for & 0x1;
-
- /* Set dest to luminance plane of current pict image. */
-
- dest = vid_stream->current->luminance;
-
- if (vid_stream->picture.code_type == B_TYPE) {
- if (vid_stream->past != NULL)
- past = vid_stream->past->luminance;
- } else {
-
- /* Set predicitive frame to current future frame. */
-
- if (vid_stream->future != NULL)
- past = vid_stream->future->luminance;
- }
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width << 4;
-
- /* Calculate row,col of upper left pixel in block. */
-
- row = mb_row << 4;
- col = mb_col << 4;
- if (bnum > 1)
- row += 8;
- if (bnum % 2)
- col += 8;
-
-#ifdef LOOSE_MPEG
- /* Check for block illegality. */
-
- maxx = lmaxx; maxy = lmaxy;
-
- if (row + down_for + 7 > maxy) illegalBlock |= 0x4;
- else if (row + down_for < 0) illegalBlock |= 0x1;
-
- if (col + right_for + 7 > maxx) illegalBlock |= 0x2;
- else if (col + right_for < 0) illegalBlock |= 0x8;
-
-#endif
- }
- /* Otherwise, block is NOT luminance block, ... */
-
- else {
-
- /* Construct motion vectors. */
-
- recon_right_for /= 2;
- recon_down_for /= 2;
- right_for = recon_right_for >> 1;
- down_for = recon_down_for >> 1;
- right_half_for = recon_right_for & 0x1;
- down_half_for = recon_down_for & 0x1;
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width << 3;
-
- /* Calculate row,col of upper left pixel in block. */
-
- row = mb_row << 3;
- col = mb_col << 3;
-
-#ifdef LOOSE_MPEG
- /* Check for block illegality. */
-
- maxx = cmaxx; maxy = cmaxy;
-
- if (row + down_for + 7 > maxy) illegalBlock |= 0x4;
- else if (row + down_for < 0) illegalBlock |= 0x1;
-
- if (col + right_for + 7 > maxx) illegalBlock |= 0x2;
- else if (col + right_for < 0) illegalBlock |= 0x8;
-
-#endif
-
- /* If block is Cr block... */
-
- if (bnum == 4) {
-
- /* Set dest to Cr plane of current pict image. */
-
- dest = vid_stream->current->Cr;
-
- if (vid_stream->picture.code_type == B_TYPE) {
-
- if (vid_stream->past != NULL)
- past = vid_stream->past->Cr;
- } else {
- if (vid_stream->future != NULL)
- past = vid_stream->future->Cr;
- }
- }
- /* Otherwise, block is Cb block... */
-
- else {
-
- /* Set dest to Cb plane of current pict image. */
-
- dest = vid_stream->current->Cb;
-
- if (vid_stream->picture.code_type == B_TYPE) {
- if (vid_stream->past != NULL)
- past = vid_stream->past->Cb;
- } else {
- if (vid_stream->future != NULL)
- past = vid_stream->future->Cb;
- }
- }
- }
-
- /* For each pixel in block... */
-
-#ifdef LOOSE_MPEG
-
- if (illegalBlock) {
- if (illegalBlock & 0x1) {
- row_start = 0;
- row_end = row+down_for+8;
- rfirst = rlast = 8 - row_end;
- }
- else if (illegalBlock & 0x4) {
- row_start = row + down_for;
- row_end = maxy+1;
- rlast = row_end - row_start - 1;
- rfirst = 0;
- }
- else {
- row_start = row+down_for;
- row_end = row_start+8;
- rfirst = 0;
- }
-
- if (illegalBlock & 0x8) {
- col_start = 0;
- col_end = col + right_for + 8;
- cfirst = clast = 8 - col_end;
- }
- else if (illegalBlock & 0x2) {
- col_start = col + right_for;
- col_end = maxx + 1;
- clast = col_end - col_start - 1;
- cfirst = 0;
- }
- else {
- col_start = col + right_for;
- col_end = col_start + 8;
- cfirst = 0;
- }
-
- for (rr = row_start; rr < row_end; rr++) {
- rindex1 = past + (rr * row_size) + col_start;
- index = dest + ((row + rfirst) * row_size) + col + cfirst;
- for (cc = col_start; cc < col_end; cc++) {
- *index++ = *rindex1++;
- }
- }
-
- if (illegalBlock & 0x1) {
- for (rr = rlast -1; rr >=0; rr--) {
- index = dest + ((row + rr) * row_size) + col;
- rindex1 = dest + ((row + rlast) * row_size) + col;
- for (cc = 0; cc < 8; cc ++) {
- *index++ = *rindex1++;
- }
- }
- }
- else if (illegalBlock & 0x4) {
- for (rr = rlast+1; rr < 8; rr++) {
- index = dest + ((row + rr) * row_size) + col;
- rindex1 = dest + ((row + rlast) * row_size) + col;
- for (cc = 0; cc < 8; cc ++) {
- *index++ = *rindex1++;
- }
- }
- }
-
- if (illegalBlock & 0x2) {
- for (cc = clast+1; cc < 8; cc++) {
- index = dest + (row * row_size) + (col + cc);
- rindex1 = dest + (row * row_size) + (col + clast);
- for (rr = 0; rr < 8; rr++) {
- *index = *rindex1;
- index += row_size;
- rindex1 += row_size;
- }
- }
- }
- else if (illegalBlock & 0x8) {
- for (cc = clast-1; cc >= 0; cc--) {
- index = dest + (row * row_size) + (col + cc);
- rindex1 = dest + (row * row_size) + (col + clast);
- for (rr = 0; rr < 8; rr++) {
- *index = *rindex1;
- index += row_size;
- rindex1 += row_size;
- }
- }
- }
-
- if (!zflag) {
- for (rr = 0; rr < 8; rr++) {
- index = dest + (row*row_size) + col;
- blockvals = &(vid_stream->block.dct_recon[rr][0]);
- index[0] += blockvals[0];
- index[1] += blockvals[1];
- index[2] += blockvals[2];
- index[3] += blockvals[3];
- index[4] += blockvals[4];
- index[5] += blockvals[5];
- index[6] += blockvals[6];
- index[7] += blockvals[7];
- }
- }
- }
- else {
-
-#endif
-
- index = dest + (row * row_size) + col;
- rindex1 = past + (row + down_for) * row_size + col + right_for;
-
- blockvals = &(vid_stream->block.dct_recon[0][0]);
-
- /*
- * Calculate predictive pixel value based on motion vectors and copy to
- * dest plane.
- */
-
- if ((!down_half_for) && (!right_half_for)) {
- unsigned char *cm = cropTbl + MAX_NEG_CROP;
- if (!zflag)
- for (rr = 0; rr < 4; rr++) {
- index[0] = cm[(int) rindex1[0] + (int) blockvals[0]];
- index[1] = cm[(int) rindex1[1] + (int) blockvals[1]];
- index[2] = cm[(int) rindex1[2] + (int) blockvals[2]];
- index[3] = cm[(int) rindex1[3] + (int) blockvals[3]];
- index[4] = cm[(int) rindex1[4] + (int) blockvals[4]];
- index[5] = cm[(int) rindex1[5] + (int) blockvals[5]];
- index[6] = cm[(int) rindex1[6] + (int) blockvals[6]];
- index[7] = cm[(int) rindex1[7] + (int) blockvals[7]];
- index += row_size;
- rindex1 += row_size;
-
- index[0] = cm[(int) rindex1[0] + (int) blockvals[8]];
- index[1] = cm[(int) rindex1[1] + (int) blockvals[9]];
- index[2] = cm[(int) rindex1[2] + (int) blockvals[10]];
- index[3] = cm[(int) rindex1[3] + (int) blockvals[11]];
- index[4] = cm[(int) rindex1[4] + (int) blockvals[12]];
- index[5] = cm[(int) rindex1[5] + (int) blockvals[13]];
- index[6] = cm[(int) rindex1[6] + (int) blockvals[14]];
- index[7] = cm[(int) rindex1[7] + (int) blockvals[15]];
- blockvals += 16;
- index += row_size;
- rindex1 += row_size;
- }
- else {
- if (right_for & 0x1) {
- /* No alignment, use bye copy */
- for (rr = 0; rr < 4; rr++) {
- index[0] = rindex1[0];
- index[1] = rindex1[1];
- index[2] = rindex1[2];
- index[3] = rindex1[3];
- index[4] = rindex1[4];
- index[5] = rindex1[5];
- index[6] = rindex1[6];
- index[7] = rindex1[7];
- index += row_size;
- rindex1 += row_size;
-
- index[0] = rindex1[0];
- index[1] = rindex1[1];
- index[2] = rindex1[2];
- index[3] = rindex1[3];
- index[4] = rindex1[4];
- index[5] = rindex1[5];
- index[6] = rindex1[6];
- index[7] = rindex1[7];
- index += row_size;
- rindex1 += row_size;
- }
- } else if (right_for & 0x2) {
- /* Half-word bit aligned, use 16 bit copy */
- short *src = (short *)rindex1;
- short *dest = (short *)index;
- row_size >>= 1;
- for (rr = 0; rr < 4; rr++) {
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_size;
- src += row_size;
-
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_size;
- src += row_size;
- }
- } else {
- /* Word aligned, use 32 bit copy */
- int *src = (int *)rindex1;
- int *dest = (int *)index;
- row_size >>= 2;
- for (rr = 0; rr < 4; rr++) {
- dest[0] = src[0];
- dest[1] = src[1];
- dest += row_size;
- src += row_size;
-
- dest[0] = src[0];
- dest[1] = src[1];
- dest += row_size;
- src += row_size;
- }
- }
- }
- } else {
- unsigned char *cm = cropTbl + MAX_NEG_CROP;
- rindex2 = rindex1 + right_half_for + (down_half_for * row_size);
- if (!zflag)
- for (rr = 0; rr < 4; rr++) {
- index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[0]];
- index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[1]];
- index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[2]];
- index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[3]];
- index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[4]];
- index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[5]];
- index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[6]];
- index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[7]];
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
-
- index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[8]];
- index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[9]];
- index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[10]];
- index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[11]];
- index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[12]];
- index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[13]];
- index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[14]];
- index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[15]];
- blockvals += 16;
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
- }
- else
- for (rr = 0; rr < 4; rr++) {
- index[0] = (int) (rindex1[0] + rindex2[0]) >> 1;
- index[1] = (int) (rindex1[1] + rindex2[1]) >> 1;
- index[2] = (int) (rindex1[2] + rindex2[2]) >> 1;
- index[3] = (int) (rindex1[3] + rindex2[3]) >> 1;
- index[4] = (int) (rindex1[4] + rindex2[4]) >> 1;
- index[5] = (int) (rindex1[5] + rindex2[5]) >> 1;
- index[6] = (int) (rindex1[6] + rindex2[6]) >> 1;
- index[7] = (int) (rindex1[7] + rindex2[7]) >> 1;
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
-
- index[0] = (int) (rindex1[0] + rindex2[0]) >> 1;
- index[1] = (int) (rindex1[1] + rindex2[1]) >> 1;
- index[2] = (int) (rindex1[2] + rindex2[2]) >> 1;
- index[3] = (int) (rindex1[3] + rindex2[3]) >> 1;
- index[4] = (int) (rindex1[4] + rindex2[4]) >> 1;
- index[5] = (int) (rindex1[5] + rindex2[5]) >> 1;
- index[6] = (int) (rindex1[6] + rindex2[6]) >> 1;
- index[7] = (int) (rindex1[7] + rindex2[7]) >> 1;
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
- }
- }
-
-#ifdef LOOSE_MPEG
- }
-#endif
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * ReconBMBlock --
- *
- * Reconstructs back predicted macroblocks.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ReconBMBlock(VidStream *vid_stream,
- int bnum, int recon_right_back, int recon_down_back, int zflag)
-{
- int mb_row, mb_col, row, col, row_size, rr;
- unsigned char *dest, *future;
- int right_back, down_back, right_half_back, down_half_back;
- unsigned char *rindex1, *rindex2;
- unsigned char *index;
- short int *blockvals;
-
-#ifdef LOOSE_MPEG
- int illegalBlock = 0;
- int maxx, maxy;
- int row_start, row_end, rlast, rfirst, col_start, col_end, clast, cfirst;
-#endif
-
- /* Calculate macroblock row and column from address. */
-
- mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width;
- mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width;
-
- /* If block is luminance block... */
-
- if (bnum < 4) {
-
- /* Calculate right_back, down_bakc motion vectors. */
-
- right_back = recon_right_back >> 1;
- down_back = recon_down_back >> 1;
- right_half_back = recon_right_back & 0x1;
- down_half_back = recon_down_back & 0x1;
-
- /* Set dest to luminance plane of current pict image. */
-
- dest = vid_stream->current->luminance;
-
- /*
- * If future frame exists, set future to luminance plane of future frame.
- */
-
- if (vid_stream->future != NULL)
- future = vid_stream->future->luminance;
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width << 4;
-
- /* Calculate row,col of upper left pixel in block. */
-
- row = mb_row << 4;
- col = mb_col << 4;
- if (bnum > 1)
- row += 8;
- if (bnum % 2)
- col += 8;
-
-#ifdef LOOSE_MPEG
-
- /* Check for block illegality. */
-
- maxx = lmaxx; maxy = lmaxy;
-
- if (row + down_back + 7 > maxy) illegalBlock |= 0x4;
- else if (row + down_back < 0) illegalBlock |= 0x1;
-
- if (col + right_back + 7 > maxx) illegalBlock |= 0x2;
- else if (col + right_back < 0) illegalBlock |= 0x8;
-
-#endif
-
- }
- /* Otherwise, block is NOT luminance block, ... */
-
- else {
-
- /* Construct motion vectors. */
-
- recon_right_back /= 2;
- recon_down_back /= 2;
- right_back = recon_right_back >> 1;
- down_back = recon_down_back >> 1;
- right_half_back = recon_right_back & 0x1;
- down_half_back = recon_down_back & 0x1;
-
- /* Establish row size. */
-
- row_size = vid_stream->mb_width << 3;
-
- /* Calculate row,col of upper left pixel in block. */
-
- row = mb_row << 3;
- col = mb_col << 3;
-
-#ifdef LOOSE_MPEG
-
- /* Check for block illegality. */
-
- maxx = cmaxx; maxy = cmaxy;
-
- if (row + down_back + 7 > maxy) illegalBlock |= 0x4;
- else if (row + down_back < 0) illegalBlock |= 0x1;
-
- if (col + right_back + 7 > maxx) illegalBlock |= 0x2;
- else if (col + right_back < 0) illegalBlock |= 0x8;
-
-#endif
-
- /* If block is Cr block... */
-
- if (bnum == 4) {
-
- /* Set dest to Cr plane of current pict image. */
-
- dest = vid_stream->current->Cr;
-
- /*
- * If future frame exists, set future to Cr plane of future image.
- */
-
- if (vid_stream->future != NULL)
- future = vid_stream->future->Cr;
- }
- /* Otherwise, block is Cb block... */
-
- else {
-
- /* Set dest to Cb plane of current pict image. */
-
- dest = vid_stream->current->Cb;
-
- /*
- * If future frame exists, set future to Cb plane of future frame.
- */
-
- if (vid_stream->future != NULL)
- future = vid_stream->future->Cb;
- }
- }
-
- /* For each pixel in block do... */
-
-#ifdef LOOSE_MPEG
-
- if (illegalBlock) {
- if (illegalBlock & 0x1) {
- row_start = 0;
- row_end = row+down_back+8;
- rfirst = rlast = 8 - row_end;
- }
- else if (illegalBlock & 0x4) {
- row_start = row + down_back;
- row_end = maxy+1;
- rlast = row_end - row_start - 1;
- rfirst = 0;
- }
- else {
- row_start = row+down_back;
- row_end = row_start+8;
- rfirst = 0;
- }
-
- if (illegalBlock & 0x8) {
- col_start = 0;
- col_end = col + right_back + 8;
- cfirst = clast = 8 - col_end;
- }
- else if (illegalBlock & 0x2) {
- col_start = col + right_back;
- col_end = maxx + 1;
- clast = col_end - col_start - 1;
- cfirst = 0;
- }
- else {
- col_start = col + right_back;
- col_end = col_start + 8;
- cfirst = 0;
- }
-
- for (rr = row_start; rr < row_end; rr++) {
- rindex1 = future + (rr * row_size) + col_start;
- index = dest + ((row + rfirst) * row_size) + col + cfirst;
- for (cc = col_start; cc < col_end; cc++) {
- *index++ = *rindex1++;
- }
- }
-
- if (illegalBlock & 0x1) {
- for (rr = rlast -1; rr >=0; rr--) {
- index = dest + ((row + rr) * row_size) + col;
- rindex1 = dest + ((row + rlast) * row_size) + col;
- for (cc = 0; cc < 8; cc ++) {
- *index++ = *rindex1++;
- }
- }
- }
- else if (illegalBlock & 0x4) {
- for (rr = rlast+1; rr < 8; rr++) {
- index = dest + ((row + rr) * row_size) + col;
- rindex1 = dest + ((row + rlast) * row_size) + col;
- for (cc = 0; cc < 8; cc ++) {
- *index++ = *rindex1++;
- }
- }
- }
-
- if (illegalBlock & 0x2) {
- for (cc = clast+1; cc < 8; cc++) {
- index = dest + (row * row_size) + (col + cc);
- rindex1 = dest + (row * row_size) + (col + clast);
- for (rr = 0; rr < 8; rr++) {
- *index = *rindex1;
- index += row_size;
- rindex1 += row_size;
- }
- }
- }
- else if (illegalBlock & 0x8) {
- for (cc = clast-1; cc >= 0; cc--) {
- index = dest + (row * row_size) + (col + cc);
- rindex1 = dest + (row * row_size) + (col + clast);
- for (rr = 0; rr < 8; rr++) {
- *index = *rindex1;
- index += row_size;
- rindex1 += row_size;
- }
- }
- }
-
- if (!zflag) {
- for (rr = 0; rr < 8; rr++) {
- index = dest + (row*row_size) + col;
- blockvals = &(vid_stream->block.dct_recon[rr][0]);
- index[0] += blockvals[0];
- index[1] += blockvals[1];
- index[2] += blockvals[2];
- index[3] += blockvals[3];
- index[4] += blockvals[4];
- index[5] += blockvals[5];
- index[6] += blockvals[6];
- index[7] += blockvals[7];
- }
- }
- }
- else {
-
-#endif
-
- index = dest + (row * row_size) + col;
- rindex1 = future + (row + down_back) * row_size + col + right_back;
-
- blockvals = &(vid_stream->block.dct_recon[0][0]);
-
- if ((!right_half_back) && (!down_half_back)) {
- unsigned char *cm = cropTbl + MAX_NEG_CROP;
- if (!zflag)
- for (rr = 0; rr < 4; rr++) {
- index[0] = cm[(int) rindex1[0] + (int) blockvals[0]];
- index[1] = cm[(int) rindex1[1] + (int) blockvals[1]];
- index[2] = cm[(int) rindex1[2] + (int) blockvals[2]];
- index[3] = cm[(int) rindex1[3] + (int) blockvals[3]];
- index[4] = cm[(int) rindex1[4] + (int) blockvals[4]];
- index[5] = cm[(int) rindex1[5] + (int) blockvals[5]];
- index[6] = cm[(int) rindex1[6] + (int) blockvals[6]];
- index[7] = cm[(int) rindex1[7] + (int) blockvals[7]];
- index += row_size;
- rindex1 += row_size;
-
- index[0] = cm[(int) rindex1[0] + (int) blockvals[8]];
- index[1] = cm[(int) rindex1[1] + (int) blockvals[9]];
- index[2] = cm[(int) rindex1[2] + (int) blockvals[10]];
- index[3] = cm[(int) rindex1[3] + (int) blockvals[11]];
- index[4] = cm[(int) rindex1[4] + (int) blockvals[12]];
- index[5] = cm[(int) rindex1[5] + (int) blockvals[13]];
- index[6] = cm[(int) rindex1[6] + (int) blockvals[14]];
- index[7] = cm[(int) rindex1[7] + (int) blockvals[15]];
- blockvals += 16;
- index += row_size;
- rindex1 += row_size;
- }
- else {
- if (right_back & 0x1) {
- /* No alignment, use bye copy */
- for (rr = 0; rr < 4; rr++) {
- index[0] = rindex1[0];
- index[1] = rindex1[1];
- index[2] = rindex1[2];
- index[3] = rindex1[3];
- index[4] = rindex1[4];
- index[5] = rindex1[5];
- index[6] = rindex1[6];
- index[7] = rindex1[7];
- index += row_size;
- rindex1 += row_size;
-
- index[0] = rindex1[0];
- index[1] = rindex1[1];
- index[2] = rindex1[2];
- index[3] = rindex1[3];
- index[4] = rindex1[4];
- index[5] = rindex1[5];
- index[6] = rindex1[6];
- index[7] = rindex1[7];
- index += row_size;
- rindex1 += row_size;
- }
- } else if (right_back & 0x2) {
- /* Half-word bit aligned, use 16 bit copy */
- short *src = (short *)rindex1;
- short *dest = (short *)index;
- row_size >>= 1;
- for (rr = 0; rr < 4; rr++) {
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_size;
- src += row_size;
-
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_size;
- src += row_size;
- }
- } else {
- /* Word aligned, use 32 bit copy */
- int *src = (int *)rindex1;
- int *dest = (int *)index;
- row_size >>= 2;
- for (rr = 0; rr < 4; rr++) {
- dest[0] = src[0];
- dest[1] = src[1];
- dest += row_size;
- src += row_size;
-
- dest[0] = src[0];
- dest[1] = src[1];
- dest += row_size;
- src += row_size;
- }
- }
- }
- } else {
- unsigned char *cm = cropTbl + MAX_NEG_CROP;
- rindex2 = rindex1 + right_half_back + (down_half_back * row_size);
- if (!zflag)
- for (rr = 0; rr < 4; rr++) {
- index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[0]];
- index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[1]];
- index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[2]];
- index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[3]];
- index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[4]];
- index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[5]];
- index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[6]];
- index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[7]];
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
-
- index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[8]];
- index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[9]];
- index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[10]];
- index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[11]];
- index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[12]];
- index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[13]];
- index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[14]];
- index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[15]];
- blockvals += 16;
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
- }
- else
- for (rr = 0; rr < 4; rr++) {
- index[0] = (int) (rindex1[0] + rindex2[0]) >> 1;
- index[1] = (int) (rindex1[1] + rindex2[1]) >> 1;
- index[2] = (int) (rindex1[2] + rindex2[2]) >> 1;
- index[3] = (int) (rindex1[3] + rindex2[3]) >> 1;
- index[4] = (int) (rindex1[4] + rindex2[4]) >> 1;
- index[5] = (int) (rindex1[5] + rindex2[5]) >> 1;
- index[6] = (int) (rindex1[6] + rindex2[6]) >> 1;
- index[7] = (int) (rindex1[7] + rindex2[7]) >> 1;
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
-
- index[0] = (int) (rindex1[0] + rindex2[0]) >> 1;
- index[1] = (int) (rindex1[1] + rindex2[1]) >> 1;
- index[2] = (int) (rindex1[2] + rindex2[2]) >> 1;
- index[3] = (int) (rindex1[3] + rindex2[3]) >> 1;
- index[4] = (int) (rindex1[4] + rindex2[4]) >> 1;
- index[5] = (int) (rindex1[5] + rindex2[5]) >> 1;
- index[6] = (int) (rindex1[6] + rindex2[6]) >> 1;
- index[7] = (int) (rindex1[7] + rindex2[7]) >> 1;
- index += row_size;
- rindex1 += row_size;
- rindex2 += row_size;
- }
- }
-
-#ifdef LOOSE_MPEG
- }
-#endif
-
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * ReconBiMBlock --
- *
- * Reconstructs bidirectionally predicted macroblocks.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ReconBiMBlock(VidStream *vid_stream, int bnum, int recon_right_for,
- int recon_down_for, int recon_right_back,
- int recon_down_back, int zflag)
-{
- int mb_row, mb_col, row, col, row_size, rr;
- unsigned char *dest, *past, *future;
- int right_for, down_for, right_half_for, down_half_for;
- int right_back, down_back, right_half_back, down_half_back;
- unsigned char *index, *rindex1, *bindex1;
- short int *blockvals;
- int forw_row_start, back_row_start, forw_col_start, back_col_start;
-
-#ifdef LOOSE_MPEG
- int illegal_forw = 0;
- int illegal_back = 0;
-#endif
-
- /* Calculate macroblock row and column from address. */
-
- mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width;
- mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width;
-
- /* If block is luminance block... */
-
- if (bnum < 4) {
-
- /*
- * Calculate right_for, down_for, right_half_for, down_half_for,
- * right_back, down_bakc, right_half_back, and down_half_back, motion
- * vectors.
- */
-
- right_for = recon_right_for >> 1;
- down_for = recon_down_for >> 1;
- right_half_for = recon_right_for & 0x1;
- down_half_for = recon_down_for & 0x1;
-
- right_back = recon_right_back >> 1;
- down_back = recon_down_back >> 1;
- right_half_back = recon_right_back & 0x1;
- down_half_back = recon_down_back & 0x1;
-
- /* Set dest to luminance plane of current pict image. */
-
- dest = vid_stream->current->luminance;
-
- /* If past frame exists, set past to luminance plane of past frame. */
-
- if (vid_stream->past != NULL)
- past = vid_stream->past->luminance;
-
- /*
- * If future frame exists, set future to luminance plane of future frame.
- */
-
- if (vid_stream->future != NULL)
- future = vid_stream->future->luminance;
-
- /* Establish row size. */
-
- row_size = (vid_stream->mb_width << 4);
-
- /* Calculate row,col of upper left pixel in block. */
-
- row = (mb_row << 4);
- col = (mb_col << 4);
- if (bnum > 1)
- row += 8;
- if (bnum & 0x01)
- col += 8;
-
- forw_col_start = col + right_for;
- forw_row_start = row + down_for;
-
- back_col_start = col + right_back;
- back_row_start = row + down_back;
-
-#ifdef LOOSE_MPEG
-
- /* Check for illegal pred. blocks. */
-
-
- if (forw_col_start+8 > lmaxx) illegal_forw = 1;
- else if (forw_col_start < 0) illegal_forw = 1;
-
- if (forw_row_start+8 > lmaxy) illegal_forw = 1;
- else if (forw_row_start < 0) illegal_forw = 1;
-
- if (back_col_start+8 > lmaxx) illegal_back = 1;
- else if (back_col_start < 0) illegal_back = 1;
-
- if (back_row_start+8 > lmaxy) illegal_back = 1;
- else if (back_row_start < 0) illegal_back = 1;
-
-#endif
-
- }
- /* Otherwise, block is NOT luminance block, ... */
-
- else {
-
- /* Construct motion vectors. */
-
- recon_right_for /= 2;
- recon_down_for /= 2;
- right_for = recon_right_for >> 1;
- down_for = recon_down_for >> 1;
- right_half_for = recon_right_for & 0x1;
- down_half_for = recon_down_for & 0x1;
-
- recon_right_back /= 2;
- recon_down_back /= 2;
- right_back = recon_right_back >> 1;
- down_back = recon_down_back >> 1;
- right_half_back = recon_right_back & 0x1;
- down_half_back = recon_down_back & 0x1;
-
- /* Establish row size. */
-
- row_size = (vid_stream->mb_width << 3);
-
- /* Calculate row,col of upper left pixel in block. */
-
- row = (mb_row << 3);
- col = (mb_col << 3);
-
- forw_col_start = col + right_for;
- forw_row_start = row + down_for;
-
- back_col_start = col + right_back;
- back_row_start = row + down_back;
-
-#ifdef LOOSE_MPEG
-
- /* Check for illegal pred. blocks. */
-
- if (forw_col_start+8 > cmaxx) illegal_forw = 1;
- else if (forw_col_start < 0) illegal_forw = 1;
-
- if (forw_row_start+8 > cmaxy) illegal_forw = 1;
- else if (forw_row_start < 0) illegal_forw = 1;
-
- if (back_col_start+8 > cmaxx) illegal_back = 1;
- else if (back_col_start < 0) illegal_back = 1;
-
- if (back_row_start+8 > cmaxy) illegal_back = 1;
- else if (back_row_start < 0) illegal_back = 1;
-
-#endif
-
- /* If block is Cr block... */
-
- if (bnum == 4) {
-
- /* Set dest to Cr plane of current pict image. */
-
- dest = vid_stream->current->Cr;
-
- /* If past frame exists, set past to Cr plane of past image. */
-
- if (vid_stream->past != NULL)
- past = vid_stream->past->Cr;
-
- /*
- * If future frame exists, set future to Cr plane of future image.
- */
-
- if (vid_stream->future != NULL)
- future = vid_stream->future->Cr;
- }
- /* Otherwise, block is Cb block... */
-
- else {
-
- /* Set dest to Cb plane of current pict image. */
-
- dest = vid_stream->current->Cb;
-
- /* If past frame exists, set past to Cb plane of past frame. */
-
- if (vid_stream->past != NULL)
- past = vid_stream->past->Cb;
-
- /*
- * If future frame exists, set future to Cb plane of future frame.
- */
-
- if (vid_stream->future != NULL)
- future = vid_stream->future->Cb;
- }
- }
-
- /* For each pixel in block... */
-
- index = dest + (row * row_size) + col;
-
-#ifdef LOOSE_MPEG
- if (illegal_forw)
- rindex1 = future + back_row_start * row_size + back_col_start;
- else
-#endif
- rindex1 = past + forw_row_start * row_size + forw_col_start;
-
-#ifdef LOOSE_MPEG
- if (illegal_back)
- bindex1 = past + forw_row_start * row_size + forw_col_start;
- else
-#endif
- bindex1 = future + back_row_start * row_size + back_col_start;
-
- blockvals = (short int *) &(vid_stream->block.dct_recon[0][0]);
-
- {
- unsigned char *cm = cropTbl + MAX_NEG_CROP;
- if (!zflag)
- for (rr = 0; rr < 4; rr++) {
- index[0] = cm[((int) (rindex1[0] + bindex1[0]) >> 1) + blockvals[0]];
- index[1] = cm[((int) (rindex1[1] + bindex1[1]) >> 1) + blockvals[1]];
- index[2] = cm[((int) (rindex1[2] + bindex1[2]) >> 1) + blockvals[2]];
- index[3] = cm[((int) (rindex1[3] + bindex1[3]) >> 1) + blockvals[3]];
- index[4] = cm[((int) (rindex1[4] + bindex1[4]) >> 1) + blockvals[4]];
- index[5] = cm[((int) (rindex1[5] + bindex1[5]) >> 1) + blockvals[5]];
- index[6] = cm[((int) (rindex1[6] + bindex1[6]) >> 1) + blockvals[6]];
- index[7] = cm[((int) (rindex1[7] + bindex1[7]) >> 1) + blockvals[7]];
- index += row_size;
- rindex1 += row_size;
- bindex1 += row_size;
-
- index[0] = cm[((int) (rindex1[0] + bindex1[0]) >> 1) + blockvals[8]];
- index[1] = cm[((int) (rindex1[1] + bindex1[1]) >> 1) + blockvals[9]];
- index[2] = cm[((int) (rindex1[2] + bindex1[2]) >> 1) + blockvals[10]];
- index[3] = cm[((int) (rindex1[3] + bindex1[3]) >> 1) + blockvals[11]];
- index[4] = cm[((int) (rindex1[4] + bindex1[4]) >> 1) + blockvals[12]];
- index[5] = cm[((int) (rindex1[5] + bindex1[5]) >> 1) + blockvals[13]];
- index[6] = cm[((int) (rindex1[6] + bindex1[6]) >> 1) + blockvals[14]];
- index[7] = cm[((int) (rindex1[7] + bindex1[7]) >> 1) + blockvals[15]];
- blockvals += 16;
- index += row_size;
- rindex1 += row_size;
- bindex1 += row_size;
- }
-
- else
- for (rr = 0; rr < 4; rr++) {
- index[0] = (int) (rindex1[0] + bindex1[0]) >> 1;
- index[1] = (int) (rindex1[1] + bindex1[1]) >> 1;
- index[2] = (int) (rindex1[2] + bindex1[2]) >> 1;
- index[3] = (int) (rindex1[3] + bindex1[3]) >> 1;
- index[4] = (int) (rindex1[4] + bindex1[4]) >> 1;
- index[5] = (int) (rindex1[5] + bindex1[5]) >> 1;
- index[6] = (int) (rindex1[6] + bindex1[6]) >> 1;
- index[7] = (int) (rindex1[7] + bindex1[7]) >> 1;
- index += row_size;
- rindex1 += row_size;
- bindex1 += row_size;
-
- index[0] = (int) (rindex1[0] + bindex1[0]) >> 1;
- index[1] = (int) (rindex1[1] + bindex1[1]) >> 1;
- index[2] = (int) (rindex1[2] + bindex1[2]) >> 1;
- index[3] = (int) (rindex1[3] + bindex1[3]) >> 1;
- index[4] = (int) (rindex1[4] + bindex1[4]) >> 1;
- index[5] = (int) (rindex1[5] + bindex1[5]) >> 1;
- index[6] = (int) (rindex1[6] + bindex1[6]) >> 1;
- index[7] = (int) (rindex1[7] + bindex1[7]) >> 1;
- index += row_size;
- rindex1 += row_size;
- bindex1 += row_size;
- }
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ProcessSkippedPFrameMBlocks --
- *
- * Processes skipped macroblocks in P frames.
- *
- * Results:
- * Calculates pixel values for luminance, Cr, and Cb planes
- * in current pict image for skipped macroblocks.
- *
- * Side effects:
- * Pixel values in pict image changed.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ProcessSkippedPFrameMBlocks(VidStream *vid_stream)
-{
- int row_size, half_row, mb_row, mb_col, row, col, rr;
- int addr, row_incr, half_row_incr, crow, ccol;
- int *dest, *src, *dest1, *src1;
-
- /* Calculate row sizes for luminance and Cr/Cb macroblock areas. */
-
- row_size = vid_stream->mb_width << 4;
- half_row = (row_size >> 1);
- row_incr = row_size >> 2;
- half_row_incr = half_row >> 2;
-
- /* For each skipped macroblock, do... */
-
- for (addr = vid_stream->mblock.past_mb_addr + 1;
- addr < vid_stream->mblock.mb_address; addr++) {
-
- /* Calculate macroblock row and col. */
-
- mb_row = addr / vid_stream->mb_width;
- mb_col = addr % vid_stream->mb_width;
-
- /* Calculate upper left pixel row,col for luminance plane. */
-
- row = mb_row << 4;
- col = mb_col << 4;
-
-
- /* For each row in macroblock luminance plane... */
-
- dest = (int *)(vid_stream->current->luminance + (row * row_size) + col);
- src = (int *)(vid_stream->future->luminance + (row * row_size) + col);
-
- for (rr = 0; rr < 8; rr++) {
-
- /* Copy pixel values from last I or P picture. */
-
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_incr;
- src += row_incr;
-
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_incr;
- src += row_incr;
- }
-
- /*
- * Divide row,col to get upper left pixel of macroblock in Cr and Cb
- * planes.
- */
-
- crow = row >> 1;
- ccol = col >> 1;
-
- /* For each row in Cr, and Cb planes... */
-
- dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol);
- src = (int *)(vid_stream->future->Cr + (crow * half_row) + ccol);
- dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol);
- src1 = (int *)(vid_stream->future->Cb + (crow * half_row) + ccol);
-
- for (rr = 0; rr < 4; rr++) {
-
- /* Copy pixel values from last I or P picture. */
-
- dest[0] = src[0];
- dest[1] = src[1];
-
- dest1[0] = src1[0];
- dest1[1] = src1[1];
-
- dest += half_row_incr;
- src += half_row_incr;
- dest1 += half_row_incr;
- src1 += half_row_incr;
-
- dest[0] = src[0];
- dest[1] = src[1];
-
- dest1[0] = src1[0];
- dest1[1] = src1[1];
-
- dest += half_row_incr;
- src += half_row_incr;
- dest1 += half_row_incr;
- src1 += half_row_incr;
- }
-
- if (ditherType == MBORDERED_DITHER) {
- /*
- MBOrderedDitherDisplayCopy(vid_stream, addr,
- 1, 0, 0, 0, 0, 0,
- vid_stream->future->display,
- (unsigned char *) NULL);
- ditherFlags[addr] = 0;
- */
- }
- }
-
- vid_stream->mblock.recon_right_for_prev = 0;
- vid_stream->mblock.recon_down_for_prev = 0;
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ProcessSkippedBFrameMBlocks --
- *
- * Processes skipped macroblocks in B frames.
- *
- * Results:
- * Calculates pixel values for luminance, Cr, and Cb planes
- * in current pict image for skipped macroblocks.
- *
- * Side effects:
- * Pixel values in pict image changed.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ProcessSkippedBFrameMBlocks(VidStream *vid_stream)
-{
- int row_size, half_row, mb_row, mb_col, row, col, rr;
- int right_half_for, down_half_for, c_right_half_for, c_down_half_for;
- int right_half_back, down_half_back, c_right_half_back, c_down_half_back;
- int addr, right_for, down_for;
- int recon_right_for, recon_down_for;
- int recon_right_back, recon_down_back;
- int right_back, down_back;
- int c_right_for, c_down_for;
- int c_right_back, c_down_back;
- unsigned char forw_lum[256];
- unsigned char forw_cr[64], forw_cb[64];
- unsigned char back_lum[256], back_cr[64], back_cb[64];
- int row_incr, half_row_incr;
- int ccol, crow;
-
- /* Calculate row sizes for luminance and Cr/Cb macroblock areas. */
-
- row_size = vid_stream->mb_width << 4;
- half_row = (row_size >> 1);
- row_incr = row_size >> 2;
- half_row_incr = half_row >> 2;
-
- /* Establish motion vector codes based on full pixel flag. */
-
- if (vid_stream->picture.full_pel_forw_vector) {
- recon_right_for = vid_stream->mblock.recon_right_for_prev << 1;
- recon_down_for = vid_stream->mblock.recon_down_for_prev << 1;
- } else {
- recon_right_for = vid_stream->mblock.recon_right_for_prev;
- recon_down_for = vid_stream->mblock.recon_down_for_prev;
- }
-
- if (vid_stream->picture.full_pel_back_vector) {
- recon_right_back = vid_stream->mblock.recon_right_back_prev << 1;
- recon_down_back = vid_stream->mblock.recon_down_back_prev << 1;
- } else {
- recon_right_back = vid_stream->mblock.recon_right_back_prev;
- recon_down_back = vid_stream->mblock.recon_down_back_prev;
- }
-
-
- /* If only one motion vector, do display copy, else do full
- calculation.
- */
-
- if (ditherType == MBORDERED_DITHER) {
- if (vid_stream->mblock.bpict_past_forw &&
- !vid_stream->mblock.bpict_past_back) {
- for (addr = vid_stream->mblock.past_mb_addr+1;
- addr < vid_stream->mblock.mb_address; addr++) {
- /*
- MBOrderedDitherDisplayCopy(vid_stream, addr,
- 1, recon_right_for, recon_down_for,
- 0, 0, 0, vid_stream->past->display,
- vid_stream->future->display);
- ditherFlags[addr] = 0;
- */
- }
- return;
- }
- if (vid_stream->mblock.bpict_past_back &&
- !vid_stream->mblock.bpict_past_forw) {
- for (addr = vid_stream->mblock.past_mb_addr+1;
- addr < vid_stream->mblock.mb_address; addr++) {
- /*
- MBOrderedDitherDisplayCopy(vid_stream, addr,
- 0, 0, 0,
- 1, recon_right_back, recon_down_back,
- vid_stream->past->display, vid_stream->future->display);
- ditherFlags[addr] = 0;
- */
- }
- return;
- }
- }
-
- /* Calculate motion vectors. */
-
- if (vid_stream->mblock.bpict_past_forw) {
- right_for = recon_right_for >> 1;
- down_for = recon_down_for >> 1;
- right_half_for = recon_right_for & 0x1;
- down_half_for = recon_down_for & 0x1;
-
- recon_right_for /= 2;
- recon_down_for /= 2;
- c_right_for = recon_right_for >> 1;
- c_down_for = recon_down_for >> 1;
- c_right_half_for = recon_right_for & 0x1;
- c_down_half_for = recon_down_for & 0x1;
-
- }
- if (vid_stream->mblock.bpict_past_back) {
- right_back = recon_right_back >> 1;
- down_back = recon_down_back >> 1;
- right_half_back = recon_right_back & 0x1;
- down_half_back = recon_down_back & 0x1;
-
- recon_right_back /= 2;
- recon_down_back /= 2;
- c_right_back = recon_right_back >> 1;
- c_down_back = recon_down_back >> 1;
- c_right_half_back = recon_right_back & 0x1;
- c_down_half_back = recon_down_back & 0x1;
-
- }
- /* For each skipped macroblock, do... */
-
- for (addr = vid_stream->mblock.past_mb_addr + 1;
- addr < vid_stream->mblock.mb_address; addr++) {
-
- /* Calculate macroblock row and col. */
-
- mb_row = addr / vid_stream->mb_width;
- mb_col = addr % vid_stream->mb_width;
-
- /* Calculate upper left pixel row,col for luminance plane. */
-
- row = mb_row << 4;
- col = mb_col << 4;
- crow = row / 2;
- ccol = col / 2;
-
- /* If forward predicted, calculate prediction values. */
-
- if (vid_stream->mblock.bpict_past_forw) {
-
- ReconSkippedBlock(vid_stream->past->luminance, forw_lum,
- row, col, row_size, right_for, down_for,
- right_half_for, down_half_for, 16);
- ReconSkippedBlock(vid_stream->past->Cr, forw_cr, crow,
- ccol, half_row,
- c_right_for, c_down_for, c_right_half_for, c_down_half_for, 8);
- ReconSkippedBlock(vid_stream->past->Cb, forw_cb, crow,
- ccol, half_row,
- c_right_for, c_down_for, c_right_half_for, c_down_half_for, 8);
- }
- /* If back predicted, calculate prediction values. */
-
- if (vid_stream->mblock.bpict_past_back) {
- ReconSkippedBlock(vid_stream->future->luminance, back_lum,
- row, col, row_size, right_back, down_back,
- right_half_back, down_half_back, 16);
- ReconSkippedBlock(vid_stream->future->Cr, back_cr, crow,
- ccol, half_row,
- c_right_back, c_down_back,
- c_right_half_back, c_down_half_back, 8);
- ReconSkippedBlock(vid_stream->future->Cb, back_cb, crow,
- ccol, half_row,
- c_right_back, c_down_back,
- c_right_half_back, c_down_half_back, 8);
- }
- if (vid_stream->mblock.bpict_past_forw &&
- !vid_stream->mblock.bpict_past_back) {
-
- int *dest, *dest1;
- int *src, *src1;
- dest = (int *)(vid_stream->current->luminance + (row * row_size) + col);
- src = (int *)forw_lum;
-
- for (rr = 0; rr < 16; rr++) {
-
- /* ACE_OS::memcpy (dest, forw_lum+(rr<<4), 16); */
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_incr;
- src += 4;
- }
-
- dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol);
- dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol);
- src = (int *)forw_cr;
- src1 = (int *)forw_cb;
-
- for (rr = 0; rr < 8; rr++) {
- /*
- * ACE_OS::memcpy (dest, forw_cr+(rr<<3), 8); ACE_OS::memcpy (dest1, forw_cb+(rr<<3),
- * 8);
- */
-
- dest[0] = src[0];
- dest[1] = src[1];
-
- dest1[0] = src1[0];
- dest1[1] = src1[1];
-
- dest += half_row_incr;
- dest1 += half_row_incr;
- src += 2;
- src1 += 2;
- }
- } else if (vid_stream->mblock.bpict_past_back &&
- !vid_stream->mblock.bpict_past_forw) {
-
- int *src, *src1;
- int *dest, *dest1;
- dest = (int *)(vid_stream->current->luminance + (row * row_size) + col);
- src = (int *)back_lum;
-
- for (rr = 0; rr < 16; rr++) {
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest[3] = src[3];
- dest += row_incr;
- src += 4;
- }
-
-
- dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol);
- dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol);
- src = (int *)back_cr;
- src1 = (int *)back_cb;
-
- for (rr = 0; rr < 8; rr++) {
- /*
- * ACE_OS::memcpy (dest, back_cr+(rr<<3), 8); ACE_OS::memcpy (dest1, back_cb+(rr<<3),
- * 8);
- */
-
- dest[0] = src[0];
- dest[1] = src[1];
-
- dest1[0] = src1[0];
- dest1[1] = src1[1];
-
- dest += half_row_incr;
- dest1 += half_row_incr;
- src += 2;
- src1 += 2;
- }
- } else {
-
- unsigned char *src1, *src2, *src1a, *src2a;
- unsigned char *dest, *dest1;
- dest = vid_stream->current->luminance + (row * row_size) + col;
- src1 = forw_lum;
- src2 = back_lum;
-
- for (rr = 0; rr < 16; rr++) {
- dest[0] = (int) (src1[0] + src2[0]) >> 1;
- dest[1] = (int) (src1[1] + src2[1]) >> 1;
- dest[2] = (int) (src1[2] + src2[2]) >> 1;
- dest[3] = (int) (src1[3] + src2[3]) >> 1;
- dest[4] = (int) (src1[4] + src2[4]) >> 1;
- dest[5] = (int) (src1[5] + src2[5]) >> 1;
- dest[6] = (int) (src1[6] + src2[6]) >> 1;
- dest[7] = (int) (src1[7] + src2[7]) >> 1;
- dest[8] = (int) (src1[8] + src2[8]) >> 1;
- dest[9] = (int) (src1[9] + src2[9]) >> 1;
- dest[10] = (int) (src1[10] + src2[10]) >> 1;
- dest[11] = (int) (src1[11] + src2[11]) >> 1;
- dest[12] = (int) (src1[12] + src2[12]) >> 1;
- dest[13] = (int) (src1[13] + src2[13]) >> 1;
- dest[14] = (int) (src1[14] + src2[14]) >> 1;
- dest[15] = (int) (src1[15] + src2[15]) >> 1;
- dest += row_size;
- src1 += 16;
- src2 += 16;
- }
-
-
- dest = vid_stream->current->Cr + (crow * half_row) + ccol;
- dest1 = vid_stream->current->Cb + (crow * half_row) + ccol;
- src1 = forw_cr;
- src2 = back_cr;
- src1a = forw_cb;
- src2a = back_cb;
-
- for (rr = 0; rr < 8; rr++) {
- dest[0] = (int) (src1[0] + src2[0]) >> 1;
- dest[1] = (int) (src1[1] + src2[1]) >> 1;
- dest[2] = (int) (src1[2] + src2[2]) >> 1;
- dest[3] = (int) (src1[3] + src2[3]) >> 1;
- dest[4] = (int) (src1[4] + src2[4]) >> 1;
- dest[5] = (int) (src1[5] + src2[5]) >> 1;
- dest[6] = (int) (src1[6] + src2[6]) >> 1;
- dest[7] = (int) (src1[7] + src2[7]) >> 1;
- dest += half_row;
- src1 += 8;
- src2 += 8;
-
- dest1[0] = (int) (src1a[0] + src2a[0]) >> 1;
- dest1[1] = (int) (src1a[1] + src2a[1]) >> 1;
- dest1[2] = (int) (src1a[2] + src2a[2]) >> 1;
- dest1[3] = (int) (src1a[3] + src2a[3]) >> 1;
- dest1[4] = (int) (src1a[4] + src2a[4]) >> 1;
- dest1[5] = (int) (src1a[5] + src2a[5]) >> 1;
- dest1[6] = (int) (src1a[6] + src2a[6]) >> 1;
- dest1[7] = (int) (src1a[7] + src2a[7]) >> 1;
- dest1 += half_row;
- src1a += 8;
- src2a += 8;
- }
- }
-
- if (ditherType == MBORDERED_DITHER) {
- ditherFlags[addr] = 1;
- }
- }
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * ReconSkippedBlock --
- *
- * Reconstructs predictive block for skipped macroblocks
- * in B Frames.
- *
- * Results:
- * No return values.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ReconSkippedBlock(unsigned char *source, unsigned char *dest,
- int row, int col, int row_size, int right, int down,
- int right_half, int down_half, int width)
-{
- int rr;
- unsigned char *source2;
-
- source += ((row + down) * row_size) + col + right;
-
- if (width == 16) {
- if ((!right_half) && (!down_half)) {
- if (right & 0x1) {
- /* No alignment, use bye copy */
- for (rr = 0; rr < 16; rr++) {
- dest[0] = source[0];
- dest[1] = source[1];
- dest[2] = source[2];
- dest[3] = source[3];
- dest[4] = source[4];
- dest[5] = source[5];
- dest[6] = source[6];
- dest[7] = source[7];
- dest[8] = source[8];
- dest[9] = source[9];
- dest[10] = source[10];
- dest[11] = source[11];
- dest[12] = source[12];
- dest[13] = source[13];
- dest[14] = source[14];
- dest[15] = source[15];
- dest += 16;
- source += row_size;
- }
- } else if (right & 0x2) {
- /* Half-word bit aligned, use 16 bit copy */
- short *src = (short *)source;
- short *d = (short *)dest;
- row_size >>= 1;
- for (rr = 0; rr < 16; rr++) {
- d[0] = src[0];
- d[1] = src[1];
- d[2] = src[2];
- d[3] = src[3];
- d[4] = src[4];
- d[5] = src[5];
- d[6] = src[6];
- d[7] = src[7];
- d += 8;
- src += row_size;
- }
- } else {
- /* Word aligned, use 32 bit copy */
- int *src = (int *)source;
- int *d = (int *)dest;
- row_size >>= 2;
- for (rr = 0; rr < 16; rr++) {
- d[0] = src[0];
- d[1] = src[1];
- d[2] = src[2];
- d[3] = src[3];
- d += 4;
- src += row_size;
- }
- }
- } else {
- source2 = source + right_half + (row_size * down_half);
- for (rr = 0; rr < width; rr++) {
- dest[0] = (int) (source[0] + source2[0]) >> 1;
- dest[1] = (int) (source[1] + source2[1]) >> 1;
- dest[2] = (int) (source[2] + source2[2]) >> 1;
- dest[3] = (int) (source[3] + source2[3]) >> 1;
- dest[4] = (int) (source[4] + source2[4]) >> 1;
- dest[5] = (int) (source[5] + source2[5]) >> 1;
- dest[6] = (int) (source[6] + source2[6]) >> 1;
- dest[7] = (int) (source[7] + source2[7]) >> 1;
- dest[8] = (int) (source[8] + source2[8]) >> 1;
- dest[9] = (int) (source[9] + source2[9]) >> 1;
- dest[10] = (int) (source[10] + source2[10]) >> 1;
- dest[11] = (int) (source[11] + source2[11]) >> 1;
- dest[12] = (int) (source[12] + source2[12]) >> 1;
- dest[13] = (int) (source[13] + source2[13]) >> 1;
- dest[14] = (int) (source[14] + source2[14]) >> 1;
- dest[15] = (int) (source[15] + source2[15]) >> 1;
- dest += width;
- source += row_size;
- source2 += row_size;
- }
- }
- } else { /* (width == 8) */
- assert(width == 8);
- if ((!right_half) && (!down_half)) {
- if (right & 0x1) {
- for (rr = 0; rr < width; rr++) {
- dest[0] = source[0];
- dest[1] = source[1];
- dest[2] = source[2];
- dest[3] = source[3];
- dest[4] = source[4];
- dest[5] = source[5];
- dest[6] = source[6];
- dest[7] = source[7];
- dest += 8;
- source += row_size;
- }
- } else if (right & 0x02) {
- short *d = (short *)dest;
- short *src = (short *)source;
- row_size >>= 1;
- for (rr = 0; rr < width; rr++) {
- d[0] = src[0];
- d[1] = src[1];
- d[2] = src[2];
- d[3] = src[3];
- d += 4;
- src += row_size;
- }
- } else {
- int *d = (int *)dest;
- int *src = (int *)source;
- row_size >>= 2;
- for (rr = 0; rr < width; rr++) {
- d[0] = src[0];
- d[1] = src[1];
- d += 2;
- src += row_size;
- }
- }
- } else {
- source2 = source + right_half + (row_size * down_half);
- for (rr = 0; rr < width; rr++) {
- dest[0] = (int) (source[0] + source2[0]) >> 1;
- dest[1] = (int) (source[1] + source2[1]) >> 1;
- dest[2] = (int) (source[2] + source2[2]) >> 1;
- dest[3] = (int) (source[3] + source2[3]) >> 1;
- dest[4] = (int) (source[4] + source2[4]) >> 1;
- dest[5] = (int) (source[5] + source2[5]) >> 1;
- dest[6] = (int) (source[6] + source2[6]) >> 1;
- dest[7] = (int) (source[7] + source2[7]) >> 1;
- dest += width;
- source += row_size;
- source2 += row_size;
- }
- }
- }
-}
-
-/*
- *--------------------------------------------------------------
- *
- * ToggleBFlag --
- *
- * Called to set no b frame processing flag.
- *
- * Results:
- * No_B_Flag flag is toggled from present value to opposite value.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-ToggleBFlag()
-{
- if (No_B_Flag) {
- No_B_Flag = 0;
- } else
- No_B_Flag = 1;
-}
-
-
-
-
-/*
- *--------------------------------------------------------------
- *
- * TogglePFlag --
- *
- * Called to set no p frame processing flag.
- *
- * Results:
- * No_P_Flag flag is toggled from present value to opposite value.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-TogglePFlag()
-{
- if (No_P_Flag) {
- No_P_Flag = 0;
- } else
- No_P_Flag = 1;
-}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h
deleted file mode 100644
index 9e2a9336f14..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-#include <stdio.h>
-#include <setjmp.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef SH_MEM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#endif
-
-/* X11/xmd.h correctly defines INT32, etc */
-#ifndef XMD_H
-typedef int INT32;
-typedef short INT16;
-typedef char INT8;
-#endif
-typedef unsigned int UINT32;
-typedef unsigned short UINT16;
-typedef unsigned char UINT8;
-
-/* Define Parsing error codes. */
-
-#define SKIP_PICTURE -10
-#define SKIP_TO_START_CODE -1
-#define PARSE_OK 1
-
-/* Define BOOLEAN, TRUE, and FALSE. */
-
-#define BOOLEAN int
-#define TRUE 1
-
-#define FALSE 0
-
-/* Set ring buffer size. */
-
-#define RING_BUF_SIZE 5
-
-/* Macros for picture code type. */
-
-#define I_TYPE 1
-#define P_TYPE 2
-#define B_TYPE 3
-
-/* Start codes. */
-
-#define SEQ_END_CODE 0x000001b7
-#define SEQ_START_CODE 0x000001b3
-#define GOP_START_CODE 0x000001b8
-#define PICTURE_START_CODE 0x00000100
-#define SLICE_MIN_START_CODE 0x00000101
-#define SLICE_MAX_START_CODE 0x000001af
-#define EXT_START_CODE 0x000001b5
-#define USER_START_CODE 0x000001b2
-
-/* Number of macroblocks to process in one call to mpegVidRsrc. */
-
-#define MB_QUANTUM 100
-
-/* Macros used with macroblock address decoding. */
-
-#define MB_STUFFING 34
-#define MB_ESCAPE 35
-
-/* Lock flags for pict images. */
-
-#define DISPLAY_LOCK 0x01
-#define PAST_LOCK 0x02
-#define FUTURE_LOCK 0x04
-
-#define HYBRID_DITHER 0
-#define HYBRID2_DITHER 1
-#define FS4_DITHER 2
-#define FS2_DITHER 3
-#define FS2FAST_DITHER 4
-#define Twox2_DITHER 5
-#define GRAY_DITHER 6
-#define FULL_COLOR_DITHER 7
-#define NO_DITHER 8
-#define ORDERED_DITHER 9
-#define MONO_DITHER 10
-#define MONO_THRESHOLD 11
-#define ORDERED2_DITHER 12
-#define MBORDERED_DITHER 13
-
-/* External declaration of row,col to zig zag conversion matrix. */
-
-extern int scan[][8];
-
-/* Temporary definition of time stamp structure. */
-
-typedef int TimeStamp;
-
-/* Structure with reconstructed pixel values. */
-
-typedef struct pict_image {
- int sh, gop, frame, display, future, past;
- int locked; /* lock flag. */
- unsigned char *luminance; /* Luminance plane. */
- unsigned char *Cr; /* Cr plane. */
- unsigned char *Cb; /* Cb plane. */
-} PictImage;
-
-/* Group of pictures structure. */
-
-typedef struct GoP {
- BOOLEAN drop_flag; /* Flag indicating dropped frame. */
- unsigned int tc_hours; /* Hour component of time code. */
- unsigned int tc_minutes; /* Minute component of time code. */
- unsigned int tc_seconds; /* Second component of time code. */
- unsigned int tc_pictures; /* Picture counter of time code. */
- BOOLEAN closed_gop; /* Indicates no pred. vectors to
- previous group of pictures. */
- BOOLEAN broken_link; /* B frame unable to be decoded. */
- char *ext_data; /* Extension data. */
- char *user_data; /* User data. */
-} GoP;
-
-/* Picture structure. */
-
-typedef struct pict {
- unsigned int temp_ref; /* Temporal reference. */
- unsigned int code_type; /* Frame type: P, B, I */
- unsigned int vbv_delay; /* Buffer delay. */
- BOOLEAN full_pel_forw_vector; /* Forw. vectors specified in full
- pixel values flag. */
- unsigned int forw_r_size; /* Used for vector decoding. */
- unsigned int forw_f; /* Used for vector decoding. */
- BOOLEAN full_pel_back_vector; /* Back vectors specified in full
- pixel values flag. */
- unsigned int back_r_size; /* Used in decoding. */
- unsigned int back_f; /* Used in decoding. */
- char *extra_info; /* Extra bit picture info. */
- char *ext_data; /* Extension data. */
- char *user_data; /* User data. */
-} Pict;
-
-/* Slice structure. */
-
-typedef struct slice {
- unsigned int vert_pos; /* Vertical position of slice. */
- unsigned int quant_scale; /* Quantization scale. */
- char *extra_info; /* Extra bit slice info. */
-} Slice;
-
-/* Macroblock structure. */
-
-typedef struct macroblock {
- int mb_address; /* Macroblock address. */
- int past_mb_addr; /* Previous mblock address. */
- int motion_h_forw_code; /* Forw. horiz. motion vector code. */
- unsigned int motion_h_forw_r; /* Used in decoding vectors. */
- int motion_v_forw_code; /* Forw. vert. motion vector code. */
- unsigned int motion_v_forw_r; /* Used in decdoinge vectors. */
- int motion_h_back_code; /* Back horiz. motion vector code. */
- unsigned int motion_h_back_r; /* Used in decoding vectors. */
- int motion_v_back_code; /* Back vert. motion vector code. */
- unsigned int motion_v_back_r; /* Used in decoding vectors. */
- unsigned int cbp; /* Coded block pattern. */
- BOOLEAN mb_intra; /* Intracoded mblock flag. */
- BOOLEAN bpict_past_forw; /* Past B frame forw. vector flag. */
- BOOLEAN bpict_past_back; /* Past B frame back vector flag. */
- int past_intra_addr; /* Addr of last intracoded mblock. */
- int recon_right_for_prev; /* Past right forw. vector. */
- int recon_down_for_prev; /* Past down forw. vector. */
- int recon_right_back_prev; /* Past right back vector. */
- int recon_down_back_prev; /* Past down back vector. */
-} Macroblock;
-
-/* Block structure. */
-
-typedef struct {
- short int dct_recon[8][8]; /* Reconstructed dct coeff matrix. */
- short int dct_dc_y_past; /* Past lum. dc dct coefficient. */
- short int dct_dc_cr_past; /* Past cr dc dct coefficient. */
- short int dct_dc_cb_past; /* Past cb dc dct coefficient. */
-} Block;
-
-/* Video stream structure. */
-
-typedef struct vid_stream {
- int shid; /* id of latest sequence header */
- unsigned int h_size; /* Horiz. size in pixels. */
- unsigned int v_size; /* Vert. size in pixels. */
- unsigned int mb_height; /* Vert. size in mblocks. */
- unsigned int mb_width; /* Horiz. size in mblocks. */
- unsigned char aspect_ratio; /* Code for aspect ratio. */
- unsigned char picture_rate; /* Code for picture rate. */
- unsigned int bit_rate; /* Bit rate. */
- unsigned int vbv_buffer_size; /* Minimum buffer size. */
- BOOLEAN const_param_flag; /* Contrained parameter flag. */
- unsigned char intra_quant_matrix[8][8]; /* Quantization matrix for
- intracoded frames. */
- unsigned char non_intra_quant_matrix[8][8]; /* Quanitization matrix for
- non intracoded frames. */
- char *ext_data; /* Extension data. */
- char *user_data; /* User data. */
- int gopid; /* id of latest group id */
- GoP group; /* Current group of pict. */
- Pict picture; /* Current picture. */
- Slice slice; /* Current slice. */
- Macroblock mblock; /* Current macroblock. */
- Block block; /* Current block. */
- int state; /* State of decoding. */
- int bit_offset; /* Bit offset in stream. */
- unsigned int *buffer; /* Pointer to next byte in
- buffer. */
- int buf_length; /* Length of remaining buffer.*/
- unsigned int *buf_start; /* Pointer to buffer start. */
- int max_buf_length; /* Max lenght of buffer. */
- PictImage *past; /* Past predictive frame. */
- PictImage *future; /* Future predictive frame. */
- PictImage *current; /* Current frame. */
- PictImage *ring[RING_BUF_SIZE]; /* Ring buffer of frames. */
-} VidStream;
-
-/* Declaration of global pointer to current video stream. */
-
-extern VidStream *curVidStream;
-
-/* Declarataion of global display pointer. */
-extern Display *display;
-
-/* Shared memory flag. */
-extern int shmemFlag;
-
-/* Quiet mode flag. */
-extern int quietFlag;
-
-/* Dither flags external declaration. */
-extern char *ditherFlags;
-
-/* Definition of Contant integer scale factor. */
-
-#define CONST_BITS 13
-
-/* Misc DCT definitions */
-#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */
-#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
-
-#define GLOBAL /* a function referenced thru EXTERNs */
-
-typedef short DCTELEM;
-typedef DCTELEM DCTBLOCK[DCTSIZE2];
-
-
-#ifdef SH_MEM
-extern int gXErrorFlag;
-#endif
-
-extern double realTimeStart;
-extern int totNumFrames;
-extern int loopFlag;
-extern int noDisplayFlag;
-extern jmp_buf env;
-
-#ifdef ANALYSIS
-extern unsigned int bitCount;
-extern int showEachFlag;
-extern unsigned int cacheHit[8][8];
-extern unsigned int cacheMiss[8][8];
-#endif
-
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp
deleted file mode 100644
index e7e75e08e06..00000000000
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp
+++ /dev/null
@@ -1,921 +0,0 @@
-/* $Id$ */
-
-/*
- * Copyright (c) 1992 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology
- * P.O.Box 91000-1000, Portland, OR 97291, USA;
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of O.G.I. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. O.G.I. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Shanwei Cen
- * Department of Computer Science and Engineering
- * email: scen@cse.ogi.edu
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-/*
-#include <sys/types.h>
-#include <sys/socket.h>
-*/
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-
-#ifdef SH_MEM /* this is already defined in video.h */
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#endif
-
-#include "include/common.h"
-#include "newproto.h"
-#include "global.h"
-#include "dither.h"
-#include "video.h"
-
-#include <math.h>
-#include "proto.h"
-#include "ui.h"
-
-ACE_RCSID(mpeg_client, vp, "$Id$")
-
-/* Declaration of global variable to hold dither info. */
-
-extern int ditherType;
-
-/* Structures used by the X server. */
-
-extern Display *display;
-extern Colormap cmap;
-
-static int cmdSocket = -1;
-static int win_width, win_height;
-static Window window;
-static GC gc;
-
-static int usingShm = 0;
-#ifdef SH_MEM
-static XShmSegmentInfo shminfo; /* Segment info. */
-#endif
-static XImage *ximage = NULL;
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitColor --
- *
- * Initialized lum, cr, and cb quantized range value arrays.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void
-InitColor()
-{
- int i;
-
- for (i=0; i<LUM_RANGE; i++) {
- lum_values[i] = ((i * 256) / (LUM_RANGE)) + (256/(LUM_RANGE*2));
- }
-
- for (i=0; i<CR_RANGE; i++) {
- cr_values[i] = ((i * 256) / (CR_RANGE)) + (256/(CR_RANGE*2));
- }
-
- for (i=0; i<CB_RANGE; i++) {
- cb_values[i] = ((i * 256) / (CB_RANGE)) + (256/(CB_RANGE*2));
- }
-
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * ConvertColor --
- *
- * Given a l, cr, cb tuple, converts it to r,g,b.
- *
- * Results:
- * r,g,b values returned in pointers passed as parameters.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-static void
-ConvertColor(unsigned char l, unsigned char cr, unsigned char cb,
- unsigned char *r, unsigned char *g, unsigned char *b)
-{
- double fl, fcr, fcb, fr, fg, fb;
-
- fl = (double) l;
- fcr = ((double) cr) - 128.0;
- fcb = ((double) cb) - 128.0;
-
-
- fr = fl + (1.40200 * fcb);
- fg = fl - (0.71414 * fcb) - (0.34414 * fcr);
- fb = fl + (1.77200 * fcr);
-
- if (fr < 0.0) fr = 0.0;
- else if (fr > 255.0) fr = 255.0;
-
- if (fg < 0.0) fg = 0.0;
- else if (fg > 255.0) fg = 255.0;
-
- if (fb < 0.0) fb = 0.0;
- else if (fb > 255.0) fb = 255.0;
-
- *r = (unsigned char) fr;
- *g = (unsigned char) fg;
- *b = (unsigned char) fb;
-
-}
-
-#ifdef SH_MEM
-
-int gXErrorFlag = 0;
-
-int HandleXError(Display * dpy, XErrorEvent * event)
-{
- gXErrorFlag = 1;
- return 0;
-}
-
-void InstallXErrorHandler()
-{
- int HandleXError(Display *,XErrorEvent *);
-
- XSetErrorHandler(HandleXError);
- XFlush(display);
-}
-
-void DeInstallXErrorHandler()
-{
- XSetErrorHandler(NULL);
- XFlush(display);
-}
-#endif
-
-/*
- *--------------------------------------------------------------
- *
- * MakeWindow --
- *
- * Create X Window for image display
- *
- * Results:
- * Read the code.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-#ifdef SH_MEM
-int CompletionType = -1;
-#endif
-
-// int XShmGetEventBase (Display*);
-
-static void
-MakeWindow(void)
-{
-
- XSizeHints hint;
- unsigned int fg, bg;
- char *hello = "MPEG Play";
- int screen;
-
- if (ditherType == NO_DITHER) return;
-/*
- UICreate();
-*/
-
-#ifdef SH_MEM
- if (shmemFlag && display != NULL)
- {
- if (!XShmQueryExtension(display))
- {
- shmemFlag = 0;
- fprintf(stderr, "VP: Shared memory not supported, Reverting to normal Xlib.\n");
- }
- else
- {
- shmemFlag = 1;
- /*
- fprintf(stderr, "VP: try using shared mem, but STOPPED temporarily.\n");
- shmemFlag = 0;
- */
- }
- }
- else if (shmemFlag)
- {
- fprintf(stderr, "VP unexpected: display is NULL.\n");
- ACE_OS::exit (1);
- }
- if(shmemFlag)
- CompletionType = /*XShmGetEventBase(display) +*/ ShmCompletion;
-#endif
-
- screen = DefaultScreen (display);
-
- /* Fill in hint structure */
-
- hint.x = 0;
- hint.y = 0;
- hint.width = 150;
- hint.height = 150;
- hint.flags = PPosition | PSize;
-
- /* Get some colors */
-
- bg = WhitePixel (display, screen);
- fg = BlackPixel (display, screen);
-
- /* Make the window */
-
- if (ditherType == FULL_COLOR_DITHER) {
- window = CreateFullColorWindow (display, hint.x, hint.y, hint.width, hint.height);
- if (window == 0) {
- fprintf (stderr, "-color option only valid on full color display\n");
- exit (-1);
- }
- } else if (ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD) {
- window = XCreateSimpleWindow (display,
- MonitorWindow(),
- hint.x, hint.y,
- hint.width, hint.height,
- 4, fg, bg);
- UISetwin(window);
- } else {
- XVisualInfo vinfo;
-
- if (!XMatchVisualInfo (display, screen, 8, PseudoColor,
- &vinfo)) {
-
- if (!XMatchVisualInfo(display, screen, 8, GrayScale,
- &vinfo)) {
- fprintf(stderr, "It seems you have a true-color/mono monitor,\n");
- fprintf(stderr, "please try 'vcr -dither color' or 'vcr -dither mono'\n");
- exit(-1);
- }
- }
-
- window = XCreateSimpleWindow (display,
- MonitorWindow(),
- hint.x, hint.y,
- hint.width, hint.height,
- 4, fg, bg);
- UISetwin(window);
- }
-
- XSelectInput(display, window, StructureNotifyMask);
-
- /* Tell other applications about this window */
-
- XSetStandardProperties (display, window, hello, hello, None, NULL, 0, &hint);
-
- /* Map window. */
-
- XMapWindow(display, window);
-
- /* Wait for map. */
- while(1) {
- XEvent xev;
-
- XNextEvent(display, &xev);
- if(xev.type == MapNotify && xev.xmap.event == window)
- break;
- }
- XSelectInput(display, window, NoEventMask);
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitDisplay --
- *
- * Initialized display, sets up colormap, etc.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-
-static char window_name[64];
-#include <string.h>
-
-void InitDisplay(char *name)
-{
-
- int ncolors = LUM_RANGE*CB_RANGE*CR_RANGE;
- XColor xcolor;
- int i, lum_num, cr_num, cb_num;
- unsigned char r, g, b;
- Colormap dcmap;
-
- if (ditherType == NO_DITHER) return;
-
- strcpy(window_name, name);
-
- MakeWindow();
-
- gc = XCreateGC(display, window, 0, 0);
-
- dcmap = cmap = XDefaultColormap(display, DefaultScreen(display));
-
- xcolor.flags = DoRed | DoGreen | DoBlue;
-
- retry_alloc_colors:
- for (i=0; i<ncolors; i++) {
-
- lum_num = (i / (CR_RANGE*CB_RANGE))%LUM_RANGE;
- cr_num = (i / CB_RANGE)%CR_RANGE;
- cb_num = i % CB_RANGE;
-
- ConvertColor(lum_values[lum_num], cr_values[cr_num], cb_values[cb_num], &r, &g, &b);
-
- xcolor.red = r * 256;
- xcolor.green = g * 256;
- xcolor.blue = b * 256;
-
- if(XAllocColor(display, cmap, &xcolor) == 0 && cmap == dcmap) {
- int j;
- unsigned long tmp_pixel;
- XWindowAttributes xwa;
-
- Fprintf(stderr, "Using private colormap.\n");
-
- /* Free colors. */
- for(j = 0; j < i; j ++) {
- tmp_pixel = pixel[j];
- XFreeColors(display, cmap, &tmp_pixel, 1, 0);
- }
-
- XGetWindowAttributes(display, window, &xwa);
- cmap = XCreateColormap(display, window, xwa.visual, AllocNone);
- XSetWindowColormap(display, window, cmap);
- UISetColormap();
-
- goto retry_alloc_colors;
- }
- pixel[i] = xcolor.pixel;
- }
-
- /*
- Fprintf(stderr, "Pixel values allocated for colormap:");
- for (i = 0; i < ncolors; i++) {
- if (!(i % 20)) Fprintf(stderr, "\n");
- Fprintf(stderr, "%3d ", pixel[i]);
- }
- */
-
- ximage = NULL;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitGrayDisplay --
- *
- * Initialized display for gray scale dither.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-#define NUM_COLORS 128
-
-void InitGrayDisplay(char *name)
-{
- int ncolors = NUM_COLORS;
- XColor xcolor;
- int i;
- Colormap dcmap;
-
- MakeWindow();
-
- gc = XCreateGC(display, window, 0, 0);
-
- dcmap = cmap = XDefaultColormap(display, DefaultScreen(display));
-
- xcolor.flags = DoRed | DoGreen | DoBlue;
-
- retry_alloc_grays:
- for (i=0; i<ncolors; i++) {
-
- xcolor.red = (i*2) * 256;
- xcolor.green = (i*2) * 256;
- xcolor.blue = (i*2) * 256;
-
- if(XAllocColor(display, cmap, &xcolor) == 0 && cmap == dcmap) {
- int j;
- unsigned long tmp_pixel;
- XWindowAttributes xwa;
-
- Fprintf(stderr, "Using private colormap.\n");
-
- /* Free colors. */
- for(j = 0; j < i; j ++) {
- tmp_pixel = pixel[j*2];
- XFreeColors(display, cmap, &tmp_pixel, 1, 0);
- }
-
- XGetWindowAttributes(display, window, &xwa);
- cmap = XCreateColormap(display, window, xwa.visual, AllocNone);
- XSetWindowColormap(display, window, cmap);
- UISetColormap();
-
- goto retry_alloc_grays;
- }
- pixel[(i*2)] = xcolor.pixel;
- pixel[(i*2)+1] = xcolor.pixel;
- }
-
- ximage = NULL;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitMonoDisplay --
- *
- * Initialized display for monochrome dither.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void InitMonoDisplay(char *name)
-{
- XGCValues xgcv;
-
- MakeWindow();
-
- xgcv.background = BlackPixel(display, DefaultScreen(display));
- xgcv.foreground = WhitePixel(display, DefaultScreen(display));
-
- gc = XCreateGC(display, window, GCForeground | GCBackground, &xgcv);
-
- ximage = NULL;
-}
-
-
-/*
- *--------------------------------------------------------------
- *
- * InitColorDisplay --
- *
- * Initialized display for full color output.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------
- */
-
-void InitColorDisplay(char *name)
-{
-
- MakeWindow();
-
- gc = XCreateGC(display, window, 0, 0);
- ximage = NULL;
-}
-
-
-static void ClearWindow(void)
-{
- int size;
- char * data;
- if ((ditherType == Twox2_DITHER) || (ditherType == FULL_COLOR_DITHER))
- size = win_width * win_height * 4;
- else
- size = win_width * win_height;
- data = (char *)ACE_OS::malloc(size);
- if (data != NULL) {
- memset(data, 0, size);
- ximage->data = data;
- XPutImage(display, window, gc, ximage, 0, 0, 0, 0,
- ximage->width, ximage->height);
- XFlush(display);
- ximage->data = NULL;
- ACE_OS::free (data);
- }
-}
-
-
-void VPresizeWindow(int h, int w)
-{
- int i;
- char dummy;
- Visual *fc_visual;
- int depth;
- static int ph = 0;
- static int pw = 0;
-
- if (ph == h && pw == w) {
- ClearWindow();
- return;
- }
- ph = h;
- pw = w;
-
- /* Excerpt from man page of XDestroyImage(3X11):
- Note that when the image is created using XCreateImage(),
- XGetImage(), or XSubImage(), the destroy procedure that the
- XDestroyImage function call frees both the image structure
- and the data pointed to by the image structure. */
- if (ximage != NULL) ximage->data = NULL;
-
- if (ditherType == NO_DITHER) return;
-
- win_width = ((w + 15)>>4)<<4;
- win_height = ((h + 15)>>4)<<4;
-
- i = (ditherType == Twox2_DITHER) ? 2 : 1;
- XResizeWindow(display, window, w*i, h*i);
- UIMinsize(w*i, h*i);
-
- /* ximage allocate/resize */
-
-#ifdef SH_MEM
- if (shmemFlag && display != NULL)
- {
- InstallXErrorHandler();
- }
-#endif
-
- if (ximage != NULL)
- {
-#ifdef SH_MEM
- if (shmemFlag && usingShm == 1)
- {
- XDestroyImage(ximage);
- ximage = NULL;
- }
- else
-#endif
- {
- XDestroyImage(ximage);
- ximage = NULL;
- }
- }
-#ifdef SH_MEM
- if (shmemFlag)
- {
- /*
- Visual *fc_visual;
- int depth;
- Visual *FindFullColorVisual();
- */
- usingShm = 1;
-
- if (ditherType == Twox2_DITHER)
- {
- ximage = XShmCreateImage(display, None, 8, ZPixmap, NULL,
- &(shminfo), win_width * 2, win_height * 2);
- }
- else if (ditherType == FULL_COLOR_DITHER)
- {
- fc_visual = FindFullColorVisual(display, &depth);
- ximage = XShmCreateImage(display, fc_visual, depth, ZPixmap,
- NULL, &(shminfo), win_width, win_height);
- }
- else if (ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD)
- {
- ximage = XShmCreateImage(display, None, 1, XYBitmap,
- NULL, &(shminfo), win_width, win_height);
- }
- else
- {
- ximage = XShmCreateImage(display, None, 8, ZPixmap, NULL,
- &(shminfo), win_width, win_height);
- }
- if (ximage == NULL)
- {
- fprintf(stderr, "Shared memory error, disabling.\n");
- goto shmemerror;
- }
-
- if (gXErrorFlag)
- {
- XDestroyImage(ximage);
- ximage = NULL;
- fprintf(stderr, "Shared memory error, disabling.\n");
- gXErrorFlag = 0;
- goto shmemerror;
- }
- }
- else
-#endif
- {
-shmemerror:
-
- usingShm = 0;
-
- if (ditherType == Twox2_DITHER)
- {
- ximage = XCreateImage(display, None, 8, ZPixmap, 0, &dummy,
- win_width * 2,
- win_height * 2, 8, 0);
- }
- else if (ditherType == FULL_COLOR_DITHER)
- {
- fc_visual = FindFullColorVisual(display, &depth);
- ximage = XCreateImage (display, fc_visual, depth, ZPixmap,
- 0, &dummy, win_width,
- win_height, 32, 0);
- }
- else if (ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD)
- {
- ximage = XCreateImage (display, None, 1, XYBitmap, 0, &dummy,
- win_width,
- win_height, 8, 0);
- ximage->byte_order = MSBFirst;
- ximage->bitmap_bit_order = MSBFirst;
- }
- else
- {
- ximage = XCreateImage(display, None, 8, ZPixmap, 0, &dummy,
- win_width,
- win_height, 8, 0);
- }
- if (ximage == NULL)
- {
- ACE_OS::perror ("VP error: fails to XCreateImage ximage");
- ACE_OS::exit (1);
- }
- }
-#ifdef SH_MEM
- if (shmemFlag && display != NULL)
- {
- DeInstallXErrorHandler();
- }
-#endif
- ximage->data = NULL;
- /*
- fprintf(stderr, "win_width %d, win_height %d, times %d\n",
- win_width, win_height, win_width * win_height);
- */
- ClearWindow();
- /*
- fprintf(stderr, "VP window resized as width-%d, height-%d.\n", w, h);
- */
-}
-
-/* parameter 'position' is for VPcontinuous command only */
-void VPcommand(int cmd, char * ptr)
-{
- FrameBlock *buf = (FrameBlock *)ptr;
- /*
- fprintf(stderr, "VP get cmd %d.\n", cmd);
- */
- switch (cmd)
- {
- case CmdVPdisplayFrame:
- if (shared->cmd != CmdSTOP) {
- shared->currentGroup = buf->gop;
- shared->currentFrame = buf->frame;
- shared->currentDisplay = buf->display;
- ximage->data = (char *)buf->data;
- VPexpose();
- }
- VDreclaimMsg(buf);
- return;
-
- case CmdVPinitScreen:
-
- VPresizeWindow(shared->verticalSize, shared->horizontalSize);
- return;
-
- case CmdVPclearScreen:
-
- ClearWindow();
- /*
- fprintf(stderr, "VP screen cleaned for audio-only case.\n");
- */
- break;
-
- default: /* all unknown cmds shall be processed by UI */
-
- break;
- }
-}
-
-void VPexpose(void)
-{
- if (ximage == NULL) {
- return;
- }
- else if (ximage->data == NULL) {
- return;
- }
-#ifdef SH_MEM
- if (shmemFlag && usingShm)
- {
- XShmPutImage(display, window, gc, ximage, 0, 0, 0, 0,
- ximage->width, ximage->height, True);
- XFlush(display);
- while(1)
- {
- XEvent xev;
-
- XNextEvent(display, &xev);
- if(xev.type == CompletionType)
- break;
- }
- }
- else
-#endif
- {
- XPutImage(display, window, gc, ximage, 0, 0, 0, 0,
- ximage->width, ximage->height);
- XFlush(display);
- }
-}
-
-static void DisplayInitialization(void)
-{
-/*
- printf("to initialize display.\n");
-*/
- switch (ditherType) {
-
- case HYBRID_DITHER:
-
- InitColor();
- InitDisplay(displayName);
- break;
-
- case HYBRID2_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case FS4_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case FS2_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case FS2FAST_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case Twox2_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case GRAY_DITHER:
- InitGrayDisplay(displayName);
- break;
-
- case FULL_COLOR_DITHER:
- InitColorDisplay(displayName);
- break;
-
- case NO_DITHER:
- shmemFlag = 0;
- break;
-
- case ORDERED_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case MONO_DITHER:
- case MONO_THRESHOLD:
- InitMonoDisplay(displayName);
- break;
-
- case ORDERED2_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- case MBORDERED_DITHER:
- InitColor();
- InitDisplay(displayName);
- break;
-
- }
-/*
- printf("finished init display.\n");
-*/
-}
-
-void VPinitWindow(Widget shell, Window monitorWindow, int cmdSock)
-{
- cmdSocket = cmdSock;
- lum_values = (int *) ACE_OS::malloc(LUM_RANGE*sizeof(int));
- cr_values = (int *) ACE_OS::malloc(CR_RANGE*sizeof(int));
- cb_values = (int *) ACE_OS::malloc(CB_RANGE*sizeof(int));
-
- DisplayInitialization();
- ACE_OS::memcpy (shared->pixel, pixel, 256);
- shared->pixelValid = 1;
-
- ACE_OS::free (lum_values);
- ACE_OS::free (cr_values);
- ACE_OS::free (cb_values);
-#ifdef SH_MEM
- if (shmemFlag && display != NULL)
- {
- InstallXErrorHandler();
-
- shminfo.shmid = shared->VDbufId;
- shminfo.shmaddr = shared->VDbufAddr;
- shminfo.readOnly = False;
- XShmAttach(display, &(shminfo));
- XSync(display, False);
-
- if (gXErrorFlag)
- {
- Fprintf(stderr, "Shared memory error, disabling.\n");
- gXErrorFlag = 0;
- shmemFlag = 0;
- }
- DeInstallXErrorHandler();
- }
-#endif
-
- remove_shmem_id(shared->VDbufId);
- VPresizeWindow(150, 200);
-}