D
Davide
Dear comp.lang.c,
I want to allocate a buffer to store 8bit or 16bit integers,
depending on the color bitdepth of the images I want to capture.
I allocate this buffer in a thread, so I have something like:
#define UTYPE __int8
..
..
UTYPE *internal_buffer;
..
..
unsigned long __stdcall ThreadFunc(void *pContext)
{
if (!(internal_buffer = malloc(number_of_frames *
frame_size_in_bytes))) {
fprintf(stderr, "Failed to allocate internal memory buffer!\n");
exit(EXIT_FAILURE);
}
return 0;
}
Now if I want to switch to a buffer of __int16, is there a way to get it
using the same function? Is there a way to change the type of the pointer
internal_buffer to __int16* at runtime? I would need that so i have a:
__int8 *internal_buffer;
when i need 8bit color frames, and a:
__int16 *internal_buffer;
for 14bit (i.e. 16bit) frames, but I want to use the same variable
internal_buffer to manipulate my frames. Sorry if I use __int8, __int16,
__stdcall, but I'm writing this program under win32 and these are microsoft
reserved keywords.
thank you
Davide
I want to allocate a buffer to store 8bit or 16bit integers,
depending on the color bitdepth of the images I want to capture.
I allocate this buffer in a thread, so I have something like:
#define UTYPE __int8
..
..
UTYPE *internal_buffer;
..
..
unsigned long __stdcall ThreadFunc(void *pContext)
{
if (!(internal_buffer = malloc(number_of_frames *
frame_size_in_bytes))) {
fprintf(stderr, "Failed to allocate internal memory buffer!\n");
exit(EXIT_FAILURE);
}
return 0;
}
Now if I want to switch to a buffer of __int16, is there a way to get it
using the same function? Is there a way to change the type of the pointer
internal_buffer to __int16* at runtime? I would need that so i have a:
__int8 *internal_buffer;
when i need 8bit color frames, and a:
__int16 *internal_buffer;
for 14bit (i.e. 16bit) frames, but I want to use the same variable
internal_buffer to manipulate my frames. Sorry if I use __int8, __int16,
__stdcall, but I'm writing this program under win32 and these are microsoft
reserved keywords.
thank you
Davide