packing

Piece together several images into one big image

I'm trying to put several images together into one big image, and am looking for an algorithm which determines the placing most optimally. The images can't be rotated or resized, but the position in the resulting image is not important. edit: added no resize constraint ...

Why does a bit field of type "unsigned short" pack into a struct differently to an "unsigned int:16"

I have a C++ program representing a TCP header as a struct: #include "stdafx.h" /* TCP HEADER 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port ...

Packing rectangles for compact representation.

I am looking for pointers to the solution of the following problem: I have a set of rectangles, whose height is known and x-positions also and I want to pack them in the more compact form. With a little drawing (where all rectangles are of the same width, but the width may vary in real life), i would like, instead of. -r1- -r2-- ...

Packing rectangular image data into a square texture.

I have N items of 2D image data that will be rectangular and I want to pack them into a single power of 2 texture as efficiently as possible. A simple non-efficient and naive implementation of an algorithm to pack these rects would be easy to whip up, but I'm sure people have come up with algorithms to do this as space efficiently as po...

What harm can come from defining BOOST_DISABLE_ABI_HEADERS when compiling boost?

What harm can come from defining BOOST_DISABLE_ABI_HEADERS when compiling boost? From the boost file: boost_1_37_0\boost\config\user.hpp // BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any // prefix/suffix headers that normally control things like struct // packing and alignment. //#define BOOST_DISABLE_ABI_HEADERS...

Suggestions on creating & deploying minimized JavaScript with NAnt?

Do you have any suggestions or examples on how to deploy minimized (min) versions of JavaScript files using NAnt? Are there any good command line applications, or scripts to assist with minimizing or packing JavaScript on Windows? ...

Can someone explain Gtk2 packing?

I need to use Gtk2 for a project. I will be using python/ruby for it. The problem is that packing seems kind of mystical to me. I tried using a VBox so that I could have the following widgets in my window ( in the following order ): menubar toolbar text view/editor control I've managed to "guess" my way with pack_start and get the la...

Bit packing in C

I'm trying to convert an RGB image to an ARGB image, basically just adding 255 in for the alpha channel. I was wondering if there is any pack method to do this without iteration? So to iterate over my RGB data and append the 255 to each pixel. ...

How is the organization of the 12 Bit RGB color format?

Hello, I know that the 12 bit RGB color pallette format , has 4 bit for each color R,G,B. But how is the structure of the raw data i.e. 1.) Does each color have a byte corresponding to it which in turn has 4 padding bits , and 4 data bits for color data or 2.) Its a packed format , i.e. Byte-1= (padding bits + 4-Rbits) Byte-2 = ...

Packing enums using the MSVC++ compiler

With GCC, I could do packing of enums using attribute((packed)), but it seems the closest thing in MSVC, #pragma pack, does not work on enums. Does anyone know of a way to pack enums into 1 byte instead of the usual integer size? ...

Text packing algorithm

I bet somebody has solved this before, but my searches have come up empty. I want to pack a list of words into a buffer, keeping track of the starting position and length of each word. The trick is that I'd like to pack the buffer efficiently by eliminating the redundancy. Example: doll dollhouse house These can be packed into the bu...

Union and struct packing problem

Hi, I'm writing some software where each bit must be exact(it's for the CPU) so __packed is very important. typedef union{ uint32_t raw; struct{ unsigned int present:1; unsigned int rw:1; unsigned int user:1; unsigned int dirty:1; unsigned int free:7; unsigned int frame:20; } __packed; }__packed page_union_t; that is my structu...

circle packing - java

I have a task to draw a circle and then fill in with the most amount of circles without touching the sides. I can draw the circle, and I can make loops to pack the circle in a hexagonal/honeycomb format, but can't control whether they are inside or outside the circle. I have used this: g.drawOval(50, 50, 300, 300); to specify my circle....

Any tools available for packing 32bit/64bit executables together?

I really like the way the SysInternals utilities (e.g. Process Explorer) handle 64bit compatibility. It looks like the 32bit executable has the 64bit version embedded in it, and extracts it if necessary. I'd like a tool which automates this - i.e. takes 32bit and 64bit executables, packs them together somehow, and inserts stub code to l...

Does the concept of coupling two different items of data by storing them in a single variable have a name?

For example, if I have a 64-bit variable and store two 32-bit items of data in it, perhaps for the purposes of SIMD processing, is there a name to describe the logical coupling of those two items of data? A colleague of mine suggests "Hybrid Coupling", is this a widely used term? To clarify: we're after a higher level concept than spe...

Algorithm needed for packing rectangles in a fairly optimal way

Ive got a bunch of rectangular objects which I need to pack into the smallest space possible (the dimensions of this space should be powers of two). I'm aware of various packing algorithms that will pack the items as well as possible into a given space, however in this case I need the algorithm to work out how large that space should be...

How to generate simple Packing List with MySQL ?

Hi, I need help on how to create a packing list of a shipment with MySQL. Let's say i have 32 boxes of keyboard ready to ship, the master carton can contain 12 boxes. I only have value 32 boxes and volume of 12. The other value in result below is generated by sql command. Not coming from record. So this easily calculate that the numb...

C++ Data Member Alignment and Array Packing

During a code review I've come across some code that defines a simple structure as follows: class foo { unsigned char a; unsigned char b; unsigned char c; } Elsewhere, an array of these objects is defined: foo listOfFoos[SOME_NUM]; Later, the structures are raw-copied into a buffer: memcpy(pBuff,listOfFoos,3*SOME_NUM); ...

The ol' fitting squares into a rectangle trick

Yes I did see the questions similar to this already posted here (notably this one). But. Am i crazy, or can the size of the square also be a non-integer? For example, in a 2x3 rectangle, one solution is squares that are .2x.2 How can i create a function to find the number of possible square sizes? ...

How to structure database for multilevel packing items

I want to make an inventory system where items have multilevel packings e.g A carton has medium boxes , medium boxes has small boxes and small boxes has 2 items. Please tell how to handle it by using sql server 2005 so that it can easily handle sale and purchase and it display exact inventory status of how much carton , medium, small box...