diff options
Diffstat (limited to 'source/blender/avi/intern')
-rw-r--r-- | source/blender/avi/intern/avi.c | 62 | ||||
-rw-r--r-- | source/blender/avi/intern/avi_mjpeg.c | 46 | ||||
-rw-r--r-- | source/blender/avi/intern/avi_options.c | 2 | ||||
-rw-r--r-- | source/blender/avi/intern/avi_rgb.c | 8 | ||||
-rw-r--r-- | source/blender/avi/intern/avi_rgb32.c | 2 |
5 files changed, 60 insertions, 60 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 6695998fd35..2d8a0b0038f 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -210,7 +210,7 @@ bool AVI_is_avi(char *name) { FILE *fp; int ret; - + fp = BLI_fopen(name, "rb"); if (fp == NULL) return 0; @@ -237,7 +237,7 @@ bool AVI_is_avi(const char *name) AviMainHeader header; AviBitmapInfoHeader bheader; int movie_tracks = 0; - + DEBUG_PRINT("opening movie\n"); movie.type = AVI_MOVIE_READ; @@ -267,7 +267,7 @@ bool AVI_is_avi(const char *name) fclose(movie.fp); return 0; } - + movie.header->MicroSecPerFrame = GET_FCC(movie.fp); movie.header->MaxBytesPerSec = GET_FCC(movie.fp); movie.header->PaddingGranularity = GET_FCC(movie.fp); @@ -292,7 +292,7 @@ bool AVI_is_avi(const char *name) fclose(movie.fp); return 0; } - + movie.streams = (AviStreamRec *) MEM_calloc_arrayN(movie.header->Streams, sizeof(AviStreamRec), "moviestreams"); for (temp = 0; temp < movie.header->Streams; temp++) { @@ -304,7 +304,7 @@ bool AVI_is_avi(const char *name) !(movie.streams[temp].sh.size = GET_FCC(movie.fp))) { DEBUG_PRINT("bad stream header information\n"); - + MEM_freeN(movie.streams); fclose(movie.fp); return 0; @@ -314,7 +314,7 @@ bool AVI_is_avi(const char *name) movie.streams[temp].sh.Handler = GET_FCC(movie.fp); fcca = movie.streams[temp].sh.Handler; - + if (movie.streams[temp].sh.Type == FCC("vids")) { if (fcca == FCC("DIB ") || fcca == FCC("RGB ") || @@ -334,7 +334,7 @@ bool AVI_is_avi(const char *name) } movie_tracks++; } - + movie.streams[temp].sh.Flags = GET_FCC(movie.fp); movie.streams[temp].sh.Priority = GET_TCC(movie.fp); movie.streams[temp].sh.Language = GET_TCC(movie.fp); @@ -365,10 +365,10 @@ bool AVI_is_avi(const char *name) j = movie.streams[temp].sf_size - (sizeof(AviBitmapInfoHeader) - 8); if (j >= 0) { AviBitmapInfoHeader *bi; - + movie.streams[temp].sf = &bheader; bi = (AviBitmapInfoHeader *) movie.streams[temp].sf; - + bi->fcc = FCC("strf"); bi->size = movie.streams[temp].sf_size; bi->Size = GET_FCC(movie.fp); @@ -382,7 +382,7 @@ bool AVI_is_avi(const char *name) bi->YPelsPerMeter = GET_FCC(movie.fp); bi->ClrUsed = GET_FCC(movie.fp); bi->ClrImportant = GET_FCC(movie.fp); - + fcca = bi->Compression; if (movie.streams[temp].format == AVI_FORMAT_AVI_RGB) { @@ -418,7 +418,7 @@ bool AVI_is_avi(const char *name) temp = GET_FCC(movie.fp); if (temp < 0 || ftell(movie.fp) > movie.size) { DEBUG_PRINT("incorrect size in header or error in AVI\n"); - + MEM_freeN(movie.streams); fclose(movie.fp); return 0; @@ -428,19 +428,19 @@ bool AVI_is_avi(const char *name) fseek(movie.fp, -4L, SEEK_CUR); } - + MEM_freeN(movie.streams); fclose(movie.fp); /* at least one video track is needed */ - return (movie_tracks != 0); + return (movie_tracks != 0); } AviError AVI_open_movie(const char *name, AviMovie *movie) { int temp, fcca, size, j; - + DEBUG_PRINT("opening movie\n"); memset(movie, 0, sizeof(AviMovie)); @@ -470,7 +470,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) DEBUG_PRINT("bad initial header info\n"); return AVI_ERROR_FORMAT; } - + movie->header->MicroSecPerFrame = GET_FCC(movie->fp); movie->header->MaxBytesPerSec = GET_FCC(movie->fp); movie->header->PaddingGranularity = GET_FCC(movie->fp); @@ -494,7 +494,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) DEBUG_PRINT("Number of streams should be in range 1-65536\n"); return AVI_ERROR_FORMAT; } - + movie->streams = (AviStreamRec *) MEM_calloc_arrayN(movie->header->Streams, sizeof(AviStreamRec), "moviestreams"); for (temp = 0; temp < movie->header->Streams; temp++) { @@ -513,7 +513,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) movie->streams[temp].sh.Handler = GET_FCC(movie->fp); fcca = movie->streams[temp].sh.Handler; - + if (movie->streams[temp].sh.Type == FCC("vids")) { if (fcca == FCC("DIB ") || fcca == FCC("RGB ") || @@ -530,7 +530,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) return AVI_ERROR_COMPRESSION; } } - + movie->streams[temp].sh.Flags = GET_FCC(movie->fp); movie->streams[temp].sh.Priority = GET_TCC(movie->fp); movie->streams[temp].sh.Language = GET_TCC(movie->fp); @@ -559,11 +559,11 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) j = movie->streams[temp].sf_size - (sizeof(AviBitmapInfoHeader) - 8); if (j >= 0) { AviBitmapInfoHeader *bi; - + movie->streams[temp].sf = MEM_mallocN(sizeof(AviBitmapInfoHeader), "streamformat"); - + bi = (AviBitmapInfoHeader *) movie->streams[temp].sf; - + bi->fcc = FCC("strf"); bi->size = movie->streams[temp].sf_size; bi->Size = GET_FCC(movie->fp); @@ -577,7 +577,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) bi->YPelsPerMeter = GET_FCC(movie->fp); bi->ClrUsed = GET_FCC(movie->fp); bi->ClrImportant = GET_FCC(movie->fp); - + fcca = bi->Compression; if (movie->streams[temp].format == @@ -617,7 +617,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) } fseek(movie->fp, temp, SEEK_CUR); } - + fseek(movie->fp, -4L, SEEK_CUR); } @@ -645,7 +645,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) movie->movi_offset = ftell(movie->fp); movie->read_offset = movie->movi_offset; - + /* Read in the index if the file has one, otherwise create one */ if (movie->header->Flags & AVIF_HASINDEX) { fseek(movie->fp, size - 4, SEEK_CUR); @@ -668,7 +668,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) movie->entries[temp].Flags = GET_FCC(movie->fp); movie->entries[temp].Offset = GET_FCC(movie->fp); movie->entries[temp].Size = GET_FCC(movie->fp); - + if (AVI_DEBUG) { printf("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n", temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags, @@ -696,7 +696,7 @@ void *AVI_read_frame(AviMovie *movie, AviFormat format, int frame, int stream) int cur_frame = -1, i = 0, rewind = 1; void *buffer; - /* Retrieve the record number of the desired frame in the index + /* Retrieve the record number of the desired frame in the index * If a chunk has Size 0 we need to rewind to previous frame */ while (rewind && frame > -1) { i = 0; @@ -732,7 +732,7 @@ void *AVI_read_frame(AviMovie *movie, AviFormat format, int frame, int stream) return NULL; } - + buffer = avi_format_convert(movie, stream, buffer, movie->streams[stream].format, format, &size); return buffer; @@ -780,7 +780,7 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...) return AVI_ERROR_OPEN; movie->offset_table = (int64_t *) MEM_mallocN((1 + streams * 2) * sizeof(int64_t), "offsettable"); - + for (i = 0; i < 1 + streams * 2; i++) movie->offset_table[i] = -1L; @@ -1009,7 +1009,7 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) for (stream = 0; stream < movie->header->Streams; stream++) { unsigned int tbuf = 0; - + format = va_arg(ap, AviFormat); buffer = va_arg(ap, void *); size_t size = va_arg(ap, int); @@ -1023,9 +1023,9 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) chunk.fcc = avi_get_data_id(format, stream); chunk.size = size; - + if (size % 4) chunk.size += 4 - size % 4; - + awrite(movie, &chunk, 1, sizeof(AviChunk), movie->fp, AVI_CHUNK); /* Write the index entry for this data chunk */ diff --git a/source/blender/avi/intern/avi_mjpeg.c b/source/blender/avi/intern/avi_mjpeg.c index 258426809fb..3146aebb0d0 100644 --- a/source/blender/avi/intern/avi_mjpeg.c +++ b/source/blender/avi/intern/avi_mjpeg.c @@ -157,7 +157,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign { struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jerr; - + (void)width; /* unused */ numbytes = 0; @@ -182,7 +182,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign jpeg_finish_decompress(&dinfo); if (dinfo.output_height >= height) return 0; - + inBuffer += numbytes; jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize - numbytes); @@ -200,7 +200,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign } jpeg_finish_decompress(&dinfo); jpeg_destroy_decompress(&dinfo); - + return 1; } @@ -221,7 +221,7 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, const unsigned jpeg_set_defaults(&cinfo); jpeg_set_colorspace(&cinfo, JCS_YCbCr); - + jpeg_set_quality(&cinfo, quality, true); cinfo.dc_huff_tbl_ptrs[0]->sent_table = true; @@ -267,11 +267,11 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, const unsigned static void interlace(unsigned char *to, unsigned char *from, int width, int height) { size_t i, rowstride = width * 3; - + for (i = 0; i < height; i++) { if (i & 1) memcpy(&to[i * rowstride], &from[(i / 2 + height / 2) * rowstride], rowstride); - else + else memcpy(&to[i * rowstride], &from[(i / 2) * rowstride], rowstride); } } @@ -279,11 +279,11 @@ static void interlace(unsigned char *to, unsigned char *from, int width, int hei static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) { size_t i, rowstride = width * 3; - + for (i = 0; i < height; i++) { if ((i & 1) == odd) memcpy(&to[(i / 2 + height / 2) * rowstride], &from[i * rowstride], rowstride); - else + else memcpy(&to[(i / 2) * rowstride], &from[i * rowstride], rowstride); } } @@ -301,19 +301,19 @@ void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffe } deint = Decode_JPEG(buffer, buf, movie->header->Width, movie->header->Height, *size); - + MEM_freeN(buffer); - + if (deint) { buffer = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "avi.avi_converter_from_mjpeg 2"); if (buffer) { interlace(buffer, buf, movie->header->Width, movie->header->Height); } MEM_freeN(buf); - + buf = buffer; } - + return buf; } @@ -321,7 +321,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, { unsigned char *buf; size_t bufsize = *size; - + numbytes = 0; *size = 0; @@ -341,7 +341,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, else { deinterlace(movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height); MEM_freeN(buffer); - + buffer = buf; buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "avi.avi_converter_to_mjpeg 1"); @@ -390,14 +390,14 @@ static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, size_t bufsize) { cinfo->dest = MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build"); - + cinfo->dest->init_destination = jpegmemdestmgr_init_destination; cinfo->dest->empty_output_buffer = jpegmemdestmgr_empty_output_buffer; cinfo->dest->term_destination = jpegmemdestmgr_term_destination; cinfo->dest->next_output_byte = buffer; cinfo->dest->free_in_buffer = bufsize; - + numbytes = bufsize; } @@ -411,16 +411,16 @@ static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { unsigned char *buf = (unsigned char *) dinfo->src->next_input_byte - 2; - + /* if we get called, must have run out of data */ WARNMS(dinfo, JWRN_JPEG_EOF); - + buf[0] = (JOCTET) 0xFF; buf[1] = (JOCTET) JPEG_EOI; - + dinfo->src->next_input_byte = buf; dinfo->src->bytes_in_buffer = 2; - + return true; } @@ -436,20 +436,20 @@ static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) { numbytes -= dinfo->src->bytes_in_buffer; - + MEM_freeN(dinfo->src); } static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, size_t bufsize) { dinfo->src = MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build"); - + dinfo->src->init_source = jpegmemsrcmgr_init_source; dinfo->src->fill_input_buffer = jpegmemsrcmgr_fill_input_buffer; dinfo->src->skip_input_data = jpegmemsrcmgr_skip_input_data; dinfo->src->resync_to_restart = jpeg_resync_to_restart; dinfo->src->term_source = jpegmemsrcmgr_term_source; - + dinfo->src->bytes_in_buffer = bufsize; dinfo->src->next_input_byte = buffer; diff --git a/source/blender/avi/intern/avi_options.c b/source/blender/avi/intern/avi_options.c index 47c18831cbd..f6da824a9f7 100644 --- a/source/blender/avi/intern/avi_options.c +++ b/source/blender/avi/intern/avi_options.c @@ -49,7 +49,7 @@ AviError AVI_set_compress_option(AviMovie *movie, int option_type, int stream, A int useconds; (void)stream; /* unused */ - + if (movie->header->TotalFrames != 0) /* Can't change params after we have already started writing frames */ return AVI_ERROR_OPTION; diff --git a/source/blender/avi/intern/avi_rgb.c b/source/blender/avi/intern/avi_rgb.c index f0baf7c6c14..6997a0d8be4 100644 --- a/source/blender/avi/intern/avi_rgb.c +++ b/source/blender/avi/intern/avi_rgb.c @@ -49,7 +49,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf unsigned char *buf; AviBitmapInfoHeader *bi; short bits = 32; - + (void)size; /* unused */ bi = (AviBitmapInfoHeader *) movie->streams[stream].sf; @@ -70,7 +70,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf while (y--) { pxl = (unsigned short *) (buffer + y * movie->header->Width * 2); - + #ifdef __BIG_ENDIAN__ pxla = (unsigned char *)pxl; #endif @@ -94,12 +94,12 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf } MEM_freeN(buffer); - + return buf; } else { buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); - + if (buf) { size_t rowstride = movie->header->Width * 3; if ((bits != 16) && (movie->header->Width % 2)) rowstride++; diff --git a/source/blender/avi/intern/avi_rgb32.c b/source/blender/avi/intern/avi_rgb32.c index 051fdba1cd2..f5f48b9eeb4 100644 --- a/source/blender/avi/intern/avi_rgb32.c +++ b/source/blender/avi/intern/avi_rgb32.c @@ -87,7 +87,7 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, to = buf; from = buffer; size_t i = (size_t)movie->header->Height * (size_t)movie->header->Width; - + while (i--) { memcpy(to, from, 3); to += 4; from += 3; |