22 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
* |
* |
25 |
* $Id: xvid_encraw.c,v 1.39 2010-03-09 10:00:22 Isibaar Exp $ |
* $Id: xvid_encraw.c,v 1.42 2010-04-01 12:16:48 Isibaar Exp $ |
26 |
* |
* |
27 |
****************************************************************************/ |
****************************************************************************/ |
28 |
|
|
345 |
int use_assembler = 1; |
int use_assembler = 1; |
346 |
int i; |
int i; |
347 |
|
|
|
#if defined(XVID_AVI_INPUT) |
|
|
PAVIFILE avi_in = NULL; |
|
|
PAVISTREAM avi_in_stream = NULL; |
|
|
PGETFRAME get_frame = NULL; |
|
|
#else |
|
|
#define get_frame NULL |
|
|
#endif |
|
|
#if defined(XVID_AVI_OUTPUT) |
|
|
PAVIFILE myAVIFile = NULL; |
|
|
PAVISTREAM myAVIStream = NULL; |
|
|
BITMAPINFOHEADER myBitmapInfoHeader; |
|
|
#endif |
|
|
#if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT) |
|
|
AVIFileInit(); |
|
|
#endif |
|
|
#ifdef XVID_MKV_OUTPUT |
|
|
PMKVFILE myMKVFile=NULL; |
|
|
PMKVSTREAM myMKVStream=NULL; |
|
|
MKVSTREAMINFO myMKVStreamInfo; |
|
|
#endif |
|
|
|
|
348 |
printf("xvid_encraw - raw mpeg4 bitstream encoder "); |
printf("xvid_encraw - raw mpeg4 bitstream encoder "); |
349 |
printf("written by Christoph Lampert\n\n"); |
printf("written by Christoph Lampert\n\n"); |
350 |
|
|
813 |
} |
} |
814 |
|
|
815 |
if (ARG_INPUTFILE != NULL) { |
if (ARG_INPUTFILE != NULL) { |
816 |
#ifdef XVID_AVI_INPUT |
#if defined(XVID_AVI_INPUT) |
817 |
if (strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avs")==0 || |
if (strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avs")==0 || |
818 |
strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avi")==0 || |
strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avi")==0 || |
819 |
ARG_INPUTTYPE==2) |
ARG_INPUTTYPE==2) |
820 |
{ |
{ |
821 |
|
PAVIFILE avi_in = NULL; |
822 |
|
PAVISTREAM avi_in_stream = NULL; |
823 |
|
PGETFRAME get_frame = NULL; |
824 |
|
BITMAPINFOHEADER myBitmapInfoHeader; |
825 |
AVISTREAMINFO avi_info; |
AVISTREAMINFO avi_info; |
|
|
|
826 |
FILE *avi_fp = fopen(ARG_INPUTFILE, "rb"); |
FILE *avi_fp = fopen(ARG_INPUTFILE, "rb"); |
827 |
|
|
828 |
|
AVIFileInit(); |
829 |
|
|
830 |
if (avi_fp == NULL) { |
if (avi_fp == NULL) { |
831 |
fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE); |
fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE); |
832 |
return (-1); |
return (-1); |
919 |
|
|
920 |
if (get_frame) AVIStreamGetFrameClose(get_frame); |
if (get_frame) AVIStreamGetFrameClose(get_frame); |
921 |
if (avi_in_stream) AVIStreamRelease(avi_in_stream); |
if (avi_in_stream) AVIStreamRelease(avi_in_stream); |
922 |
|
AVIFileExit(); |
923 |
} |
} |
924 |
else |
else |
925 |
#endif |
#endif |
1023 |
sprintf(statsfilename[k], "%s.%03d", ARG_PASS1, k); |
sprintf(statsfilename[k], "%s.%03d", ARG_PASS1, k); |
1024 |
enc_data[k].statsfilename1 = statsfilename[k]; |
enc_data[k].statsfilename1 = statsfilename[k]; |
1025 |
} |
} |
1026 |
enc_data[k].start_num = (ARG_MAXFRAMENR-ARG_STARTFRAMENR)/ARG_NUM_APP_THREADS; |
enc_data[k].start_num = (k*(ARG_MAXFRAMENR-ARG_STARTFRAMENR))/ARG_NUM_APP_THREADS; |
1027 |
enc_data[k].stop_num = ((k+1)*(ARG_MAXFRAMENR-ARG_STARTFRAMENR))/ARG_NUM_APP_THREADS; |
enc_data[k].stop_num = ((k+1)*(ARG_MAXFRAMENR-ARG_STARTFRAMENR))/ARG_NUM_APP_THREADS; |
1028 |
} |
} |
1029 |
|
|
1148 |
|
|
1149 |
release_all: |
release_all: |
1150 |
|
|
|
#if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT) |
|
|
AVIFileExit(); |
|
|
#endif |
|
|
|
|
1151 |
return (0); |
return (0); |
|
|
|
1152 |
} |
} |
1153 |
|
|
1154 |
/***************************************************************************** |
/***************************************************************************** |
1191 |
|
|
1192 |
char filename[256]; |
char filename[256]; |
1193 |
|
|
1194 |
|
#ifdef XVID_MKV_OUTPUT |
1195 |
|
PMKVFILE myMKVFile = NULL; |
1196 |
|
PMKVSTREAM myMKVStream = NULL; |
1197 |
|
MKVSTREAMINFO myMKVStreamInfo; |
1198 |
|
#endif |
1199 |
#if defined(XVID_AVI_INPUT) |
#if defined(XVID_AVI_INPUT) |
1200 |
PAVIFILE avi_in = NULL; |
PAVIFILE avi_in = NULL; |
1201 |
PAVISTREAM avi_in_stream = NULL; |
PAVISTREAM avi_in_stream = NULL; |
1202 |
PGETFRAME get_frame = NULL; |
PGETFRAME get_frame = NULL; |
1203 |
|
BITMAPINFOHEADER myBitmapInfoHeader; |
1204 |
#else |
#else |
1205 |
#define get_frame NULL |
#define get_frame NULL |
1206 |
#endif |
#endif |
1209 |
PAVIFILE myAVIFile=NULL; |
PAVIFILE myAVIFile=NULL; |
1210 |
PAVISTREAM myAVIStream=NULL; |
PAVISTREAM myAVIStream=NULL; |
1211 |
AVISTREAMINFO myAVIStreamInfo; |
AVISTREAMINFO myAVIStreamInfo; |
1212 |
BITMAPINFOHEADER myBitmapInfoHeader; |
#endif |
1213 |
|
#if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT) |
1214 |
|
if (ARG_NUM_APP_THREADS > 1) |
1215 |
|
CoInitializeEx(0, COINIT_MULTITHREADED); |
1216 |
|
AVIFileInit(); |
1217 |
#endif |
#endif |
1218 |
|
|
1219 |
if (ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) { |
if (ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) { |
1227 |
AVISTREAMINFO avi_info; |
AVISTREAMINFO avi_info; |
1228 |
FILE *avi_fp = fopen(ARG_INPUTFILE, "rb"); |
FILE *avi_fp = fopen(ARG_INPUTFILE, "rb"); |
1229 |
|
|
|
if (ARG_NUM_APP_THREADS > 1) |
|
|
CoInitializeEx(0, COINIT_MULTITHREADED); |
|
|
|
|
1230 |
if (avi_fp == NULL) { |
if (avi_fp == NULL) { |
1231 |
fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE); |
fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE); |
1232 |
return; |
return; |
1710 |
if (myMKVStream) MKVStreamRelease(myMKVStream); |
if (myMKVStream) MKVStreamRelease(myMKVStream); |
1711 |
if (myMKVFile) MKVFileRelease(myMKVFile); |
if (myMKVFile) MKVFileRelease(myMKVFile); |
1712 |
#endif |
#endif |
1713 |
|
#if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT) |
1714 |
|
AVIFileExit(); |
1715 |
|
#endif |
1716 |
|
|
1717 |
free_all_memory: |
free_all_memory: |
1718 |
free(out_buffer); |
free(out_buffer); |
1854 |
fprintf(stderr, "-odegrade integer : max overflow degradation (5)\n"); |
fprintf(stderr, "-odegrade integer : max overflow degradation (5)\n"); |
1855 |
fprintf(stderr, "-chigh integer : high bitrate scenes degradation (0)\n"); |
fprintf(stderr, "-chigh integer : high bitrate scenes degradation (0)\n"); |
1856 |
fprintf(stderr, "-clow integer : low bitrate scenes improvement (0)\n"); |
fprintf(stderr, "-clow integer : low bitrate scenes improvement (0)\n"); |
1857 |
fprintf(stderr, "-overhead integer : container frame overhead (24)\n"); |
fprintf(stderr, "-overhead integer : container frame overhead (0)\n"); |
1858 |
fprintf(stderr, "-vbvsize integer : use vbv buffer size\n"); |
fprintf(stderr, "-vbvsize integer : use vbv buffer size\n"); |
1859 |
fprintf(stderr, "-vbvmax integer : vbv max bitrate\n"); |
fprintf(stderr, "-vbvmax integer : vbv max bitrate\n"); |
1860 |
fprintf(stderr, "-vbvpeak integer : vbv peak bitrate over 1 second\n"); |
fprintf(stderr, "-vbvpeak integer : vbv peak bitrate over 1 second\n"); |