Main Page | Namespace List | Compound List | File List | Compound Members | File Members

sos.cc

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #include "sos.h"
00012 #include <stdio.h>
00013 
00014 SOS::SOS(
00015   const Id&     n, 
00016   In<Bits>&   ScanHeaderBitsIn,
00017   Out<VYAimageDepth>& scanDepthOut,
00018   Out<VYAimageComponent>& scanComponentIdOut,
00019   Out<VYAid>&   HTableIdOut)
00020 :
00021   Process(n),
00022   ScanHeaderBitsInP(  id("ScanHeaderBitsInP"),  ScanHeaderBitsIn),
00023   scanDepthOutP(    id("scanDepthOutP"),    scanDepthOut),
00024   scanComponentIdOutP(  id("scanComponentIdOutP"),  scanComponentIdOut),
00025   HTableIdOutP(   id("HTableIdOutP"),     HTableIdOut)
00026 {
00027 }
00028 
00029 void SOS::main()
00030 {
00031   Bits      aux;
00032   VYAimageDepth   numberOfComponents;
00033   VYAimageComponent scanComponentId;
00034   VYAid     HTableId;
00035   
00036   while (true)
00037   {
00038     read(ScanHeaderBitsInP, aux);     // section length (1st byte)
00039     read(ScanHeaderBitsInP, aux);     // section length (2nd byte)
00040     read(ScanHeaderBitsInP, numberOfComponents);  // number of scan components
00041     write(scanDepthOutP, numberOfComponents);
00042         for (unsigned int i=0; i<numberOfComponents; i++) 
00043     {
00044       read(ScanHeaderBitsInP, aux);   // component ID
00045       scanComponentId = aux-1;    // map ID domain from {1,2,3} to {0,1,2}
00046       write(scanComponentIdOutP, scanComponentId);
00047             read(ScanHeaderBitsInP, HTableId);  // Huffman Table ID used for component
00048       write(HTableIdOutP, HTableId);
00049         }
00050     read(ScanHeaderBitsInP, aux);     // start of spectral selection
00051     read(ScanHeaderBitsInP, aux);     // end of spectral selection
00052     read(ScanHeaderBitsInP, aux);     // spectral selection high and low bits
00053   }
00054 } 

Generated on Wed Feb 15 14:52:45 2006 for jpegdec by doxygen 1.3.2