Subversion Repositories ipe_artfile_utils

Rev

Rev 5 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 7
Line 1... Line 1...
1
/**
1
/**
2
 * IPMA video frame extractor by Daniel Marschall, ViaThinkSoft (C) 2022
2
 * IPMA video frame extractor by Daniel Marschall, ViaThinkSoft (C) 2022
3
 * Supports codecs IPMA and IP20
3
 * Supports codecs IPMA and IP20
4
 * Revision: 2022-01-15
4
 * Revision: 2022-01-16
5
 * License: Apache 2.0
5
 * License: Apache 2.0
6
 **/
6
 **/
7
 
7
 
8
#define VERSION "2022-01-15"
8
#define VERSION "2022-01-16"
9
 
9
 
10
#define _CRT_SECURE_NO_WARNINGS
10
#define _CRT_SECURE_NO_WARNINGS
11
// #define VISUAL_STUDIO_TEST
11
// #define VISUAL_STUDIO_TEST
12
 
12
 
13
#include <windows.h>
13
#include <windows.h>
Line 376... Line 376...
376
                        AVIStreamRelease(pStream1);
376
                        AVIStreamRelease(pStream1);
377
                        AVIFileRelease(pFile);
377
                        AVIFileRelease(pFile);
378
                        return false;
378
                        return false;
379
                }
379
                }
380
 
380
 
-
 
381
                // Note that for 2 files, bi.biSizeImage is wrong (much too small!)
-
 
382
                // LB05M08.AVI: biSizeImage (10598) != rectWidth * rectHeight (27492)
-
 
383
                // TY06M12.AVI: biSizeImage  (1274) != rectWidth * rectHeight  (8058)
381
                int bufsiz_uncompressed = pstrf->bi.biSizeImage;
384
                //int bufsiz_uncompressed = pstrf->bi.biSizeImage;
382
                int bufsiz_compressed = pstrf->bi.biSizeImage * 1000; // for some reason, compressed can sometimes be larger than uncompressed, so we multiply by 1000
-
 
383
                if (bufsiz_uncompressed != (asi1.rcFrame.right - asi1.rcFrame.left) * (asi1.rcFrame.bottom - asi1.rcFrame.top)) {
385
                int bufsiz_uncompressed = (asi1.rcFrame.right - asi1.rcFrame.left) * (asi1.rcFrame.bottom - asi1.rcFrame.top);
-
 
386
               
-
 
387
                // theoretically, compressed can sometimes be larger than uncompressed, so we multiply by 10
384
                        printf("WARNING: biSizeImage != rectWidth * rectHeight\n");
388
                int bufsiz_compressed = bufsiz_uncompressed * 10;
385
                }
389
 
386
                unsigned char* buffer_uncompressed = (unsigned char*)malloc(bufsiz_uncompressed);
390
                unsigned char* buffer_uncompressed = (unsigned char*)malloc(bufsiz_uncompressed);
387
                if (buffer_uncompressed == NULL) return false;
391
                if (buffer_uncompressed == NULL) return false;
388
                unsigned char* buffer_compressed = (unsigned char*)malloc(bufsiz_compressed);
392
                unsigned char* buffer_compressed = (unsigned char*)malloc(bufsiz_compressed);
389
                if (buffer_compressed == NULL) return false;
393
                if (buffer_compressed == NULL) return false;
390
 
394