1 /*****************************************************************************/
2 // Copyright 2011 Adobe Systems Incorporated
3 // All Rights Reserved.
4 //
5 // NOTICE:  Adobe permits you to use, modify, and distribute this file in
6 // accordance with the terms of the Adobe license agreement accompanying it.
7 /*****************************************************************************/
8 
9 /* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_jpeg_image.h#1 $ */
10 /* $DateTime: 2012/05/30 13:28:51 $ */
11 /* $Change: 832332 $ */
12 /* $Author: tknoll $ */
13 
14 /*****************************************************************************/
15 
16 #ifndef __dng_jpeg_image__
17 #define __dng_jpeg_image__
18 
19 /*****************************************************************************/
20 
21 #include "dng_auto_ptr.h"
22 #include "dng_memory.h"
23 #include "dng_point.h"
24 
25 /*****************************************************************************/
26 
27 typedef AutoPtr<dng_memory_block> dng_jpeg_image_tile_ptr;
28 
29 /*****************************************************************************/
30 
31 class dng_jpeg_image
32 	{
33 
34 	public:
35 
36 		dng_point fImageSize;
37 
38 		dng_point fTileSize;
39 
40 		bool fUsesStrips;
41 
42 		AutoPtr<dng_memory_block> fJPEGTables;
43 
44 		AutoArray<dng_jpeg_image_tile_ptr> fJPEGData;
45 
46 	public:
47 
48 		dng_jpeg_image ();
49 
TilesAcross()50 		uint32 TilesAcross () const
51 			{
52 			if (fTileSize.h)
53 				{
54 				return (fImageSize.h + fTileSize.h - 1) / fTileSize.h;
55 				}
56 			else
57 				{
58 				return 0;
59 				}
60 			}
61 
TilesDown()62 		uint32 TilesDown () const
63 			{
64 			if (fTileSize.v)
65 				{
66 				return (fImageSize.v + fTileSize.v - 1) / fTileSize.v;
67 				}
68 			else
69 				{
70 				return 0;
71 				}
72 			}
73 
TileCount()74 		uint32 TileCount () const
75 			{
76 			return TilesAcross () * TilesDown ();
77 			}
78 
79 		void Encode (dng_host &host,
80 					 const dng_negative &negative,
81 					 dng_image_writer &writer,
82 					 const dng_image &image);
83 
84 		dng_fingerprint FindDigest (dng_host &host) const;
85 
86 	};
87 
88 /*****************************************************************************/
89 
90 #endif
91 
92 /*****************************************************************************/
93