Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-05 22:02:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-05 22:02:21 +0400
commitf4e4e2594ce945b8ff900d4713cf7adcfa2d41d2 (patch)
tree29d008df5dce24ec56f3ff681b942b105b4f5d6d
parentd01fbce3bbe03814211c4f283ab08bffa05ae20d (diff)
AVI JPEG: remove the restriction to write only sizes that are multiples of 16.
Other encoders do not seem to have this restriction, and multiple video players can play the files fine. This also removes the same restriction for reading files, which actually caused errors on some files with odd width/height.
-rw-r--r--source/blender/avi/intern/avi_mjpeg.c47
1 files changed, 2 insertions, 45 deletions
diff --git a/source/blender/avi/intern/avi_mjpeg.c b/source/blender/avi/intern/avi_mjpeg.c
index 91b8fa5a060..797bca0bd0b 100644
--- a/source/blender/avi/intern/avi_mjpeg.c
+++ b/source/blender/avi/intern/avi_mjpeg.c
@@ -294,56 +294,13 @@ static void deinterlace(int odd, unsigned char *to, unsigned char *from, int wid
static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize)
{
- /* JPEG's are always multiples of 16, extra is cropped out AVI's */
- if ((width & 0xF) || (height & 0xF)) {
- int i, rrowstride, jrowstride;
- int jwidth = PADUP(width, 16);
- int jheight = PADUP(height, 16);
- unsigned char *tmpbuf = MEM_mallocN(jwidth * jheight * 3, "avi.check_and_decode_jpeg");
- int ret = Decode_JPEG(inbuf, tmpbuf, jwidth, jheight, bufsize);
-
- /* crop the tmpbuf into the real buffer */
- rrowstride = width * 3;
- jrowstride = jwidth * 3;
- for (i = 0; i < height; i++)
- memcpy(&outbuf[i * rrowstride], &tmpbuf[i * jrowstride], rrowstride);
- MEM_freeN(tmpbuf);
-
- return ret;
- }
- else {
- return Decode_JPEG(inbuf, outbuf, width, height, bufsize);
- }
+ return Decode_JPEG(inbuf, outbuf, width, height, bufsize);
}
static void check_and_compress_jpeg(int quality, unsigned char *outbuf, const unsigned char *inbuf,
int width, int height, int bufsize)
{
- /* JPEG's are always multiples of 16, extra is ignored in AVI's */
- if ((width & 0xF) || (height & 0xF)) {
- int i, rrowstride, jrowstride;
- int jwidth = PADUP(width, 16);
- int jheight = PADUP(height, 16);
- unsigned char *tmpbuf = MEM_mallocN(jwidth * jheight * 3, "avi.check_and_compress_jpeg");
-
- /* resize the realbuf into the tmpbuf */
- rrowstride = width * 3;
- jrowstride = jwidth * 3;
- for (i = 0; i < jheight; i++) {
- if (i < height)
- memcpy(&tmpbuf[i * jrowstride], &inbuf[i * rrowstride], rrowstride);
- else
- memset(&tmpbuf[i * jrowstride], 0, rrowstride);
- memset(&tmpbuf[i * jrowstride + rrowstride], 0, jrowstride - rrowstride);
- }
-
- Compress_JPEG(quality, outbuf, tmpbuf, jwidth, jheight, bufsize);
-
- MEM_freeN(tmpbuf);
- }
- else {
- Compress_JPEG(quality, outbuf, inbuf, width, height, bufsize);
- }
+ Compress_JPEG(quality, outbuf, inbuf, width, height, bufsize);
}
void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, int *size)