All pastes #283160 Raw Edit

Untitled

public text v1 · immutable
#283160 ·published 2006-12-18 03:39 UTC
rendered paste body
void encode_i_frame (IFrame *i_frame)
{
	double coeff[FRAME_HEIGHT * FRAME_WIDTH];
	int    i, j;
	int    index;
	
	/* zig-zag coding */
	for (index = 0; index < 64; index++)
	{
		for (i = 0; i < DCT_BLOCKS_Y; i++)
		{
			for (j = 0; j < DCT_BLOCKS_X; j++)	
				coeff[index * DCT_BLOCKS_Y * DCT_BLOCKS_X + i * DCT_BLOCKS_X + j] = 
				  *i_frame->y_component->blocks[i][j].zig_zag[index];
		}
	}
	
	int run = 0;
	int code_buffer[25344];
	index = 0;
	
		/* run, level coding */
	for (i = 0; i < FRAME_HEIGHT * FRAME_WIDTH; i++)
	{
		if (coeff[i] == 0)
		{
			run++;
			continue;
		}
		printf ("%i ", i);
		code_buffer[index]     = run;         /* (run,   */
		code_buffer[index + 1] = coeff[i];    /*  level) */
		
		index += 2;
		run    = 0;
	}
	
/*
	for (i = 0; i < 100; i++)
		printf ("%f ", coeff[i]);
*/
}