Mercurial > mplayer.hg
changeset 22778:674012456a76
Remove files maintained by Reimar that he no longer sees a use for.
author | diego |
---|---|
date | Sat, 24 Mar 2007 13:17:39 +0000 |
parents | d1670ab86597 |
children | 7dd092f681a5 |
files | TOOLS/302m_convert.c TOOLS/360m_convert.c TOOLS/Makefile TOOLS/README TOOLS/gltest.c |
diffstat | 5 files changed, 1 insertions(+), 385 deletions(-) [+] |
line wrap: on
line diff
--- a/TOOLS/302m_convert.c Sat Mar 24 13:12:55 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/** - * convert D-Cinema Audio (probably SMPTE 302M) to a - * wav file that MPlayer can play. - * Usage: 302m_convert <infile> <outfile> - */ -#include <stdlib.h> -#include <stdio.h> -#include <inttypes.h> -#include <byteswap.h> -#define le2me_32(x) (x) -#define le2me_16(x) (x) -#define be2me_16(x) bswap_16(x) - -// From MPlayer libao/ao_pcm.c -#define WAV_ID_RIFF 0x46464952 /* "RIFF" */ -#define WAV_ID_WAVE 0x45564157 /* "WAVE" */ -#define WAV_ID_FMT 0x20746d66 /* "fmt " */ -#define WAV_ID_DATA 0x61746164 /* "data" */ -#define WAV_ID_PCM 0x0001 - -struct WaveHeader { - uint32_t riff; - uint32_t file_length; - uint32_t wave; - uint32_t fmt; - uint32_t fmt_length; - uint16_t fmt_tag; - uint16_t channels; - uint32_t sample_rate; - uint32_t bytes_per_second; - uint16_t block_align; - uint16_t bits; - uint32_t data; - uint32_t data_length; -}; - -static struct WaveHeader wavhdr = { - le2me_32(WAV_ID_RIFF), - le2me_32(0x7fffffff), - le2me_32(WAV_ID_WAVE), - le2me_32(WAV_ID_FMT), - le2me_32(16), - le2me_16(WAV_ID_PCM), - le2me_16(6), - le2me_32(96000), - le2me_32(1728000), - le2me_16(18), - le2me_16(24), - le2me_32(WAV_ID_DATA), - le2me_32(0x7fffffff), -}; - -// this format is completely braindead, and this bitorder -// is the result of pure guesswork (counting how often -// the bits flip), so it might be wrong. -void fixup(unsigned char *in_, unsigned char *out) { - int i; - unsigned char in[3] = {in_[0], in_[1], in_[2]}; - unsigned char sync = in[2] & 0x0f; // sync flags - in[2] >>= 4; - out[2] = 0; - for (i = 0; i < 4; i++) { - out[2] <<= 1; - out[2] |= in[2] & 1; - in[2] >>= 1; - } - for (i = 0; i < 4; i++) { - out[2] <<= 1; - out[2] |= in[1] & 1; - in[1] >>= 1; - } - out[1] = 0; - for (i = 0; i < 4; i++) { - out[1] <<= 1; - out[1] |= in[1] & 1; - in[1] >>= 1; - } - for (i = 0; i < 4; i++) { - out[1] <<= 1; - out[1] |= in[0] & 1; - in[0] >>= 1; - } - out[0] = 0; - for (i = 0; i < 4; i++) { - out[0] <<= 1; - out[0] |= in[0] & 1; - in[0] >>= 1; - } - out[0] <<= 4; - out[0] |= sync; // sync flags go into lowest bits - // it seems those might also contain audio data, - // don't know if this is the right order then - // these might be also useful to detect the number - // of channels in case there are files with != 6 channels -} - -int main(int argc, char *argv[]) { - FILE *in = fopen(argv[1], "r"); - FILE *out = fopen(argv[2], "w"); - int i; - uint16_t blocklen, unknown; - unsigned char *block; - if (!in) { - printf("Could not open %s for reading\n", argv[1]); - return EXIT_FAILURE; - } - if (!out) { - printf("Could not open %s for writing\n", argv[2]); - return EXIT_FAILURE; - } - fwrite(&wavhdr, 1, sizeof(wavhdr), out); - do { - fread(&blocklen, 2, 1, in); - blocklen = be2me_16(blocklen); - fread(&unknown, 2, 1, in); - block = malloc(blocklen); - blocklen = fread(block, 1, blocklen, in); - for (i = 0; i < blocklen; i += 3) - fixup(&block[i], &block[i]); - fwrite(block, 1, blocklen, out); - free(block); - } while (!feof(in)); - return EXIT_SUCCESS; -} -
--- a/TOOLS/360m_convert.c Sat Mar 24 13:12:55 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/** - * convert D-Cinema Video (MPEG2 in GXF, SMPTE 360M) to a - * MPEG-ES file that MPlayer can play (use -demuxer mpeges). - * Usage: 360m_convert <infile> <outfile> - */ -#include <stdlib.h> -#include <stdio.h> - -int main(int argc, char *argv[]) { - FILE *in = fopen(argv[1], "r"); - FILE *out = fopen(argv[2], "w"); - int discard = 0; - unsigned char buf[4]; - if (!in) { - printf("Could not open %s for reading\n", argv[1]); - return EXIT_FAILURE; - } - if (!out) { - printf("Could not open %s for writing\n", argv[2]); - return EXIT_FAILURE; - } - fread(buf, 4, 1, in); - do { - if (buf[0] == 0 && buf[1] == 0 && buf[2] == 1) { - // encountered a header - // skip data between a 0xbf or 0xbc header and the next 0x00 header - if (buf[3] == 0xbc || buf[3] == 0xbf) - discard = 1; - else if (buf[3] == 0) - discard = 0; - } - if (!discard) - fwrite(&buf[0], 1, 1, out); - buf[0] = buf[1]; - buf[1] = buf[2]; - buf[2] = buf[3]; - fread(&buf[3], 1, 1, in); - } while (!feof(in)); - return EXIT_SUCCESS; -} -
--- a/TOOLS/Makefile Sat Mar 24 13:12:55 2007 +0000 +++ b/TOOLS/Makefile Sat Mar 24 13:17:39 2007 +0000 @@ -13,8 +13,6 @@ png2raw$(EXESUF) \ subrip$(EXESUF) \ # vivodump$(EXESUF) \ - 302m_convert$(EXESUF) \ - 360m_convert$(EXESUF) \ ifeq ($(TARGET_ARCH_X86),yes) OBJS += cpuinfo$(EXESUF) fastmemcpybench @@ -48,13 +46,10 @@ bmovl-test$(EXESUF): bmovl-test.c $(CC) -O3 $(EXTRA_INC) -o $@ $< -lSDL_image -gltest: gltest.c ../osdep/timer-lx.o - $(CC) -O4 -g -o $@ $^ -lglut - vfw2menc$(EXESUF): vfw2menc.c $(CC) $< -o $@ -lwinmm -lole32 clean distclean: rm -f $(OBJS) - rm -f fastmem-* fastmem2-* fastmemcpybench gltest + rm -f fastmem-* fastmem2-* fastmemcpybench rm -f cpuinfo$(EXESUF) bmovl-test$(EXESUF) vfw2menc$(EXESUF)
--- a/TOOLS/README Sat Mar 24 13:12:55 2007 +0000 +++ b/TOOLS/README Sat Mar 24 13:17:39 2007 +0000 @@ -605,26 +605,3 @@ -v|--view - displays the config dialog and do nothing Notes: Works on x86 only. - - - -Format conversion scripts in the TOOLS dir ------------------------------------------- - -302m_convert.c - -Author: Reimar Döffinger - -Description: Converts D-Cinema Audio (SMPTE 302M?) to WAV. - -Usage: 302m_convert <in.302> <out.wav> - - -360m_convert.c - -Author: Reimar Döffinger - -Description: Converts D-Cinema Video (MPEG-2 in GXF, SMPTE 360M) to MPEG-ES. - Use -demuxer mpeges to play the converted file. - -Usage: 360m_convert <in.gxf> <out.m2v>
--- a/TOOLS/gltest.c Sat Mar 24 13:12:55 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -// OpenGL glTexSubImage() test/benchmark prg (C) 2001. by A'rpi/ESP-team - -#include <GL/glut.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <inttypes.h> -#include <string.h> - -// pixel size: 3 or 4 -#define BYTES_PP 3 - -// blit by lines (defined) or frames (not defined) -#define FAST_BLIT - -static uint32_t image_width=720; // DVD size -static uint32_t image_height=576; - -static uint32_t image_format; -static uint32_t image_bpp; -static uint32_t image_bytes; - -static uint32_t texture_width=512; -static uint32_t texture_height=512; - -static unsigned char *ImageData=NULL; - -static GLvoid resize(int x,int y){ - printf("Resize: %dx%d\n",x,y); - glViewport( 0, 0, x, y ); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, image_width, image_height, 0, -1,1); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -float akarmi=0; - -int counter=0; -float gen_time=0; -float up_time=0; -float render_time=0; - -unsigned char sintable[4096]; - -extern float GetRelativeTime(); - -static void redraw(void) -{ -// glClear(GL_COLOR_BUFFER_BIT); - int x,y,i; - unsigned char *d=ImageData; - int dstride=BYTES_PP*image_width; - - GetRelativeTime(); - - // generate some image: - for(y=0;y<image_height;y++){ - int y1=2048*sin(akarmi*0.36725+y*0.0165); - int y2=2048*sin(akarmi*0.45621+y*0.02753); - int y3=2048*sin(akarmi*0.15643+y*0.03732); - for(x=0;x<image_width;x++){ - d[0]=sintable[(y1+x*135)&4095]; - d[1]=sintable[(y2+x*62)&4095]; - d[2]=sintable[(y3+x*23)&4095]; - d+=BYTES_PP; - } - } - - gen_time+=GetRelativeTime(); - -#ifdef FAST_BLIT - // upload texture: - for(i=0;i<image_height;i++){ - glTexSubImage2D( GL_TEXTURE_2D, // target - 0, // level - 0, // x offset - i, // y offset - image_width, // width - 1, // height - (BYTES_PP==4)?GL_RGBA:GL_RGB, // format - GL_UNSIGNED_BYTE, // type - ImageData+i*dstride ); // *pixels - } -#else - glTexSubImage2D( GL_TEXTURE_2D, // target - 0, // level - 0, // x offset - 0, // y offset - image_width, // width - image_height, // height - (BYTES_PP==4)?GL_RGBA:GL_RGB, // format - GL_UNSIGNED_BYTE, // type - ImageData ); // *pixels -#endif - - up_time+=GetRelativeTime(); - - glColor3f(1,1,1); - glBegin(GL_QUADS); - glTexCoord2f(0,0);glVertex2i(0,0); - glTexCoord2f(0,1);glVertex2i(0,texture_height); - glTexCoord2f(1,1);glVertex2i(texture_width,texture_height); - glTexCoord2f(1,0);glVertex2i(texture_width,0); - glEnd(); - - glFinish(); - glutSwapBuffers(); - - render_time+=GetRelativeTime(); - - ++counter; - { float total=gen_time+up_time+render_time; - if(total>2.0){ - printf("%8.3f fps (gen: %2d%% upload: %2d%% render: %2d%%)\n", - (float)counter/total, - (int)(100.0*gen_time/total), - (int)(100.0*up_time/total), - (int)(100.0*render_time/total) - ); - gen_time=up_time=render_time=0; - counter=0; - } } - -} - -static GLvoid IdleFunc(){ - akarmi+=0.1; - glutPostRedisplay(); -} - -int -main(int argc, char **argv) -{ - int i; - - glutInit(&argc, argv); - glutInitWindowSize(640, 480); - glutInitDisplayMode(GLUT_DOUBLE); - (void) glutCreateWindow("csg"); - - glutDisplayFunc(redraw); - glutReshapeFunc(resize); - glutIdleFunc(IdleFunc); - - texture_width=32; - while(texture_width<image_width) texture_width*=2; - while(texture_width<image_height) texture_width*=2; - texture_height=texture_width; - - image_bpp=8*BYTES_PP; - image_bytes=BYTES_PP; - - ImageData=malloc(texture_width*texture_height*image_bytes); - memset(ImageData,128,texture_width*texture_height*image_bytes); - - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - glDepthMask(GL_FALSE); - glDisable(GL_CULL_FACE); - - glEnable(GL_TEXTURE_2D); - - printf("Creating %dx%d texture...\n",texture_width,texture_height); - -#if 1 -// glBindTexture(GL_TEXTURE_2D, texture_id); - glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); -#ifdef TEXTUREFORMAT_32BPP - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture_width, texture_height, 0, -#else - glTexImage2D(GL_TEXTURE_2D, 0, BYTES_PP, texture_width, texture_height, 0, -#endif - (image_bytes==4)?GL_RGBA:GL_BGR, GL_UNSIGNED_BYTE, ImageData); -#endif - - resize(640,480); - - glClearColor( 1.0f,0.0f,1.0f,0.0f ); - glClear( GL_COLOR_BUFFER_BIT ); - - for(i=0;i<4096;i++) sintable[i]=128+127*sin(2.0*3.14159265*i/4096.0); - - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -}