Mercurial > mplayer.hg
changeset 12829:dcdee268bc3b
Cinepak, CVID and RoqA/V are now in ffmpeg
author | rtognimp |
---|---|
date | Thu, 15 Jul 2004 20:45:44 +0000 |
parents | f9f8e49ff3d5 |
children | b177cc8afdc0 |
files | libmpcodecs/ad_roqaudio.c libmpcodecs/vd_cinepak.c libmpcodecs/vd_cyuv.c libmpcodecs/vd_roqvideo.c |
diffstat | 4 files changed, 0 insertions(+), 318 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_roqaudio.c Thu Jul 15 20:44:39 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "config.h" -#include "ad_internal.h" - -static ad_info_t info = -{ - "Id RoQ File Audio Decoder", - "roqaudio", - "Nick Kurshev", - "Mike Melanson", - "" //"RoQA is an internal MPlayer FOURCC" -}; - -LIBAD_EXTERN(roqaudio) - -// in native/roqav.c: -void *roq_decode_audio_init(void); -int roq_decode_audio(unsigned short *output, unsigned char *input, - int encoded_size, int channels, void *context); - -static int preinit(sh_audio_t *sh_audio) -{ - // minsize was stored in wf->nBlockAlign by the RoQ demuxer - sh_audio->audio_out_minsize=sh_audio->wf->nBlockAlign; - sh_audio->audio_in_minsize=sh_audio->audio_out_minsize / 2; // FIXME? - sh_audio->context = roq_decode_audio_init(); - return 1; -} - -static int init(sh_audio_t *sh_audio) -{ - sh_audio->channels=sh_audio->wf->nChannels; - sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; - sh_audio->i_bps = 44100; - return 1; -} - -static void uninit(sh_audio_t *sh_audio) -{ -} - -static int control(sh_audio_t *sh,int cmd,void* arg, ...) -{ - // TODO!!! - return CONTROL_UNKNOWN; -} - -static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) -{ - unsigned char header_data[6]; - int read_len; - - /* figure out how much data to read */ - if (demux_read_data(sh_audio->ds, header_data, 6) != 6) return -1; /* EOF */ - read_len = (header_data[5] << 24) | (header_data[4] << 16) | - (header_data[3] << 8) | header_data[2]; - read_len += 2; /* 16-bit arguments */ - if (demux_read_data(sh_audio->ds, sh_audio->a_in_buffer, read_len) != - read_len) return -1; - return 2 * roq_decode_audio((unsigned short *)buf, sh_audio->a_in_buffer, - read_len, sh_audio->channels, sh_audio->context); -}
--- a/libmpcodecs/vd_cinepak.c Thu Jul 15 20:44:39 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#include "config.h" -#include "mp_msg.h" - -#include "vd_internal.h" - -static vd_info_t info = { - "Cinepak Video decoder", - "cinepak", - "A'rpi", - "Dr. Tim Ferguson, http://www.csse.monash.edu.au/~timf/videocodec.html", - "native codec" -}; - -LIBVD_EXTERN(cinepak) - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - return CONTROL_UNKNOWN; -} - -void *decode_cinepak_init(void); - -// init driver -static int init(sh_video_t *sh){ - sh->context = decode_cinepak_init(); - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2); -} - -// uninit driver -static void uninit(sh_video_t *sh){ -} - -//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); - -//void decode_cinepak(void *context, unsigned char *buf, int size, unsigned char *frame, int width, int height, int bit_per_pixel, int stride_); -void decode_cinepak(void *context, unsigned char *buf, int size, mp_image_t* mpi); - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - mp_image_t* mpi; - if(len<=0) return NULL; // skipped frame - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_STRIDE, - (sh->disp_w+3)&(~3), - (sh->disp_h+3)&(~3)); - - if(!mpi){ // temporary! - printf("couldn't allocate image for cinepak codec\n"); - return NULL; - } - -#if 0 - printf("mpi: %p/%d %p/%d %p/%d (%d) (%d) \n", - mpi->planes[0], mpi->stride[0], - mpi->planes[1], mpi->stride[1], - mpi->planes[2], mpi->stride[2], - mpi->planes[1]-mpi->planes[0], - mpi->planes[2]-mpi->planes[1]); -#endif - -// decode_cinepak(sh->context, data, len, mpi->planes[0], sh->disp_w, sh->disp_h, -// (mpi->flags&MP_IMGFLAG_YUV)?16:(mpi->imgfmt&255), mpi->stride[0]); - - decode_cinepak(sh->context, data, len, mpi); - - return mpi; -} -
--- a/libmpcodecs/vd_cyuv.c Thu Jul 15 20:44:39 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* ------------------------------------------------------------------------ - * Creative YUV Video Decoder - * - * Dr. Tim Ferguson, 2001. - * For more details on the algorithm: - * http://www.csse.monash.edu.au/~timf/videocodec.html - * - * Code restructured, and adopted to MPlayer's mpi by A'rpi, 2002. - * - * This is a very simple predictive coder. A video frame is coded in YUV411 - * format. The first pixel of each scanline is coded using the upper four - * bits of its absolute value. Subsequent pixels for the scanline are coded - * using the difference between the last pixel and the current pixel (DPCM). - * The DPCM values are coded using a 16 entry table found at the start of the - * frame. Thus four bits per component are used and are as follows: - * UY VY YY UY VY YY UY VY... - * ------------------------------------------------------------------------ */ - -#include <stdio.h> -#include <stdlib.h> - -#include "config.h" -#include "mp_msg.h" - -#include "vd_internal.h" - -static vd_info_t info = { - "Creative YUV decoder", - "cyuv", - "A'rpi", - "Dr. Tim Ferguson", - "native codec" -}; - -LIBVD_EXTERN(cyuv) - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - return CONTROL_UNKNOWN; -} - -// init driver -static int init(sh_video_t *sh){ - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_411P); -} - -// uninit driver -static void uninit(sh_video_t *sh){ -} - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - mp_image_t* mpi; - unsigned int xpos, ypos; - unsigned char *delta_y_tbl = ((unsigned char*)data)+16; - unsigned char *delta_c_tbl = ((unsigned char*)data)+32; - unsigned char *ptr = ((unsigned char*)data)+48; - - if(len<=48) return NULL; // skipped/broken frame - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - sh->disp_w, sh->disp_h); - if(!mpi) return NULL; - - for(ypos = 0; ypos < mpi->h; ypos++){ - unsigned int i; - unsigned char cur_Y1,cur_Y2,cur_U,cur_V; - unsigned char *frame=mpi->planes[0]+mpi->stride[0]*ypos; - unsigned char *uframe=mpi->planes[1]+mpi->stride[1]*ypos; - unsigned char *vframe=mpi->planes[2]+mpi->stride[2]*ypos; - - for(xpos = 0; xpos < mpi->w; xpos += 2){ - - if(xpos&2){ - i = *(ptr++); - cur_Y1 = (cur_Y2 + delta_y_tbl[i & 0x0f])/* & 0xff*/; - cur_Y2 = (cur_Y1 + delta_y_tbl[i >> 4])/* & 0xff*/; - } else { - if(xpos == 0) { /* first pixels in scanline */ - cur_U = *(ptr++); - cur_Y1= (cur_U & 0x0f) << 4; - cur_U = cur_U & 0xf0; - cur_V = *(ptr++); - cur_Y2= (cur_Y1 + delta_y_tbl[cur_V & 0x0f])/* & 0xff*/; - cur_V = cur_V & 0xf0; - } else { /* subsequent pixels in scanline */ - i = *(ptr++); - cur_U = (cur_U + delta_c_tbl[i >> 4])/* & 0xff*/; - cur_Y1= (cur_Y2 + delta_y_tbl[i & 0x0f])/* & 0xff*/; - i = *(ptr++); - cur_V = (cur_V + delta_c_tbl[i >> 4])/* & 0xff*/; - cur_Y2= (cur_Y1 + delta_y_tbl[i & 0x0f])/* & 0xff*/; - } - } - - // ok, store the pixels: - switch(mpi->imgfmt){ - case IMGFMT_YUY2: - *frame++ = cur_Y1; - *frame++ = cur_U; - *frame++ = cur_Y2; - *frame++ = cur_V; - break; - case IMGFMT_UYVY: - *frame++ = cur_U; - *frame++ = cur_Y1; - *frame++ = cur_V; - *frame++ = cur_Y2; - break; - case IMGFMT_422P: - *uframe++ = cur_U; - *vframe++ = cur_V; - *frame++ = cur_Y1; - *frame++ = cur_Y2; - break; - case IMGFMT_411P: - if(!(xpos&2)){ - *uframe++ = cur_U; - *vframe++ = cur_V; - } - *frame++ = cur_Y1; - *frame++ = cur_Y2; - break; - } - } // xpos - } // ypos - - return mpi; -}
--- a/libmpcodecs/vd_roqvideo.c Thu Jul 15 20:44:39 2004 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#include "config.h" -#include "mp_msg.h" - -#include "vd_internal.h" - -static vd_info_t info = { - "Id RoQ File Video decoder", - "roqvideo", - "A'rpi", - "Mike Melanson", - "native codec" -}; - -LIBVD_EXTERN(roqvideo) - -// in native/roqav.c: -void *roq_decode_video_init(void); -void roq_decode_video(void *context, unsigned char *encoded, - int encoded_size, mp_image_t *mpi); - -// to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,void* arg,...){ - return CONTROL_UNKNOWN; -} - -// init driver -static int init(sh_video_t *sh){ - sh->context = roq_decode_video_init(); - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); -} - -// uninit driver -static void uninit(sh_video_t *sh){ -} - -//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - mp_image_t* mpi; - if(len<=0) return NULL; // skipped frame - - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_IP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, - sh->disp_w, sh->disp_h); - if(!mpi) return NULL; - - roq_decode_video(sh->context, data, len, mpi); - - return mpi; -}