summaryrefslogtreecommitdiff
path: root/src/libxinevdec/bitplane.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libxinevdec/bitplane.c')
-rw-r--r--src/libxinevdec/bitplane.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/libxinevdec/bitplane.c b/src/libxinevdec/bitplane.c
index bf868ad2a..76b7c8a89 100644
--- a/src/libxinevdec/bitplane.c
+++ b/src/libxinevdec/bitplane.c
@@ -29,6 +29,10 @@
* - untested (found no testfiles) IFF-ANIM OPT 3, 4 and 6
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -252,7 +256,7 @@ static uint8_t *bitplane_decode_byterun1 (uint8_t *compressed,
int i = 0;
int j = 0;
- uint8_t *uncompressed = xine_xmalloc( size_uncompressed );
+ uint8_t *uncompressed = calloc(1, size_uncompressed );
while ( i < size_compressed &&
pixel_ptr < size_uncompressed ) {
@@ -1158,8 +1162,8 @@ static void bitplane_decode_data (video_decoder_t *this_gen,
this->bytes_per_pixel = 1;
/* New Buffer for indexes (palette based formats) */
- this->index_buf = xine_xmalloc( this->num_pixel * this->bytes_per_pixel );
- this->index_buf_hist = xine_xmalloc( this->num_pixel * this->bytes_per_pixel );
+ this->index_buf = calloc( this->num_pixel, this->bytes_per_pixel );
+ this->index_buf_hist = calloc( this->num_pixel, this->bytes_per_pixel );
this->num_bitplanes = bih->biPlanes;
this->camg_mode = bih->biCompression;
@@ -1189,7 +1193,7 @@ static void bitplane_decode_data (video_decoder_t *this_gen,
if (this->buf)
free (this->buf);
this->bufsize = VIDEOBUFSIZE;
- this->buf = xine_xmalloc(this->bufsize);
+ this->buf = calloc(1, this->bufsize);
this->size = 0;
this->framenumber = 0;
@@ -1255,7 +1259,7 @@ static void bitplane_decode_data (video_decoder_t *this_gen,
case BUF_VIDEO_BITPLANE:
/* uncompressed Buffer, set decoded_buf pointer direct to input stream */
if( this->buf_uk == NULL )
- this->buf_uk = xine_xmalloc( (this->size) );
+ this->buf_uk = malloc(this->size);
xine_fast_memcpy (this->buf_uk, this->buf, this->size);
break;
case BUF_VIDEO_BITPLANE_BR1:
@@ -1294,7 +1298,7 @@ static void bitplane_decode_data (video_decoder_t *this_gen,
}
}
if( this->buf_uk_hist == NULL ) {
- this->buf_uk_hist = xine_xmalloc( (this->size_uk) );
+ this->buf_uk_hist = malloc(this->size_uk);
xine_fast_memcpy (this->buf_uk_hist, this->buf_uk, this->size_uk);
xine_fast_memcpy (this->index_buf_hist, this->index_buf,
(this->num_pixel * this->bytes_per_pixel));
@@ -1306,20 +1310,12 @@ static void bitplane_decode_data (video_decoder_t *this_gen,
/* when no start-picture is given, create a empty one */
if( this->buf_uk_hist == NULL ) {
this->size_uk = (((this->num_pixel) / 8) * this->num_bitplanes);
- this->buf_uk = xine_xmalloc( (this->size_uk) );
- this->buf_uk_hist = xine_xmalloc( (this->size_uk) );
- for (i = 0; i < this->size_uk; i++) {
- this->buf_uk[i] = 0;
- this->buf_uk_hist[i] = 0;
- }
+ this->buf_uk = calloc(this->num_bitplanes, ((this->num_pixel) / 8));
+ this->buf_uk_hist = calloc(this->num_bitplanes, ((this->num_pixel) / 8));
}
if( this->index_buf == NULL ) {
- this->index_buf = xine_xmalloc( (this->num_pixel * this->bytes_per_pixel) );
- this->index_buf_hist = xine_xmalloc( (this->num_pixel * this->bytes_per_pixel) );
- for (i = 0; i < (this->num_pixel * this->bytes_per_pixel); i++) {
- this->index_buf[i] = 0;
- this->index_buf_hist[i] = 0;
- }
+ this->index_buf = calloc( this->num_pixel, this->bytes_per_pixel );
+ this->index_buf_hist = calloc( this->num_pixel, this->bytes_per_pixel );
}
switch( anhd->operation ) {
@@ -1523,7 +1519,7 @@ static void bitplane_dispose (video_decoder_t *this_gen) {
static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) {
- bitplane_decoder_t *this = (bitplane_decoder_t *) xine_xmalloc (sizeof (bitplane_decoder_t));
+ bitplane_decoder_t *this = (bitplane_decoder_t *) calloc(1, sizeof(bitplane_decoder_t));
this->video_decoder.decode_data = bitplane_decode_data;
this->video_decoder.flush = bitplane_flush;
@@ -1558,7 +1554,7 @@ static void dispose_class (video_decoder_class_t *this) {
static void *init_plugin (xine_t *xine, void *data) {
- bitplane_class_t *this = (bitplane_class_t *) xine_xmalloc (sizeof (bitplane_class_t));
+ bitplane_class_t *this = (bitplane_class_t *) calloc(1, sizeof(bitplane_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;