[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[542] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-11 16:18:36
|
Revision: 542 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=542&view=rev Author: nickols_k Date: 2012-12-11 16:18:22 +0000 (Tue, 11 Dec 2012) Log Message: ----------- rename libvo -> libvo2 (TRANSACTION BEGIN) Added Paths: ----------- mplayerxp/libvo2/ mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vo_fbdev.cpp Removed Paths: ------------- mplayerxp/libvo/Makefile mplayerxp/libvo/aspect.cpp mplayerxp/libvo/aspect.h mplayerxp/libvo/dri_vo.h mplayerxp/libvo/font_load.cpp mplayerxp/libvo/font_load.h mplayerxp/libvo/img_format.cpp mplayerxp/libvo/img_format.h mplayerxp/libvo/jpeg_enc.cpp mplayerxp/libvo/jpeg_enc.h mplayerxp/libvo/osd_render.cpp mplayerxp/libvo/osd_render.h mplayerxp/libvo/osd_render_template.h mplayerxp/libvo/screenshot.cpp mplayerxp/libvo/screenshot.h mplayerxp/libvo/sub.cpp mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/videodev_mjpeg.h mplayerxp/libvo/vidix_system.cpp mplayerxp/libvo/vidix_system.h mplayerxp/libvo/vo_fbdev.cpp mplayerxp/libvo/vo_msg.h mplayerxp/libvo/vo_null.cpp mplayerxp/libvo/vo_opengl.cpp mplayerxp/libvo/vo_sdl.cpp mplayerxp/libvo/vo_vesa.cpp mplayerxp/libvo/vo_x11.cpp mplayerxp/libvo/vo_xv.cpp mplayerxp/libvo/wskeys.h mplayerxp/libvo/x11_system.cpp mplayerxp/libvo/x11_system.h mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vo_fbdev.cpp Deleted: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/Makefile 2012-12-11 16:18:22 UTC (rev 542) @@ -1,70 +0,0 @@ -include ../mp_config.mak - -LIBNAME = libvo.a - -CXXSRCS=video_out.cpp font_load.cpp img_format.cpp screenshot.cpp sub.cpp -CXXSRCS+=osd_render.cpp aspect.cpp vo_null.cpp -ifeq ($(HAVE_SDL),yes) -CXXSRCS+=vo_sdl.cpp -endif -ifeq ($(HAVE_OPENGL),yes) -CXXSRCS+=vo_opengl.cpp -endif -ifeq ($(HAVE_X11),yes) -CXXSRCS+=vo_x11.cpp x11_system.cpp -endif -ifeq ($(HAVE_XV),yes) -CXXSRCS+=vo_xv.cpp -endif -ifeq ($(HAVE_FBDEV),yes) -CXXSRCS+=vo_fbdev.cpp -endif -ifeq ($(HAVE_VESA),yes) -CXXSRCS += vo_vesa.cpp -endif -ifeq ($(CONFIG_VIDIX),yes) -CXXSRCS += vidix_system.cpp -endif - -CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY -Wall -W -CXXFLAGS = $(OPTXXFLAGS) -I. -I.. -DMPG12PLAY -Wall -W - -ifeq ($(CONFIG_VIDIX),yes) -CFLAGS += -DVIDIX_PATH='"$(LIBDIR)/vidix/"' -CXXFLAGS += -DVIDIX_PATH='"$(LIBDIR)/vidix/"' -endif - -OBJS=$(SRCS:.c=.o) -CXXOBJS=$(CXXSRCS:.cpp=.o) - -.SUFFIXES: .c .o - -# .PHONY: all clean - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $< -.cpp.o: - $(CXX) -c $(CXXFLAGS) -o $@ $< - -$(LIBNAME): $(OBJS) $(CXXOBJS) - $(AR) r $(LIBNAME) $(OBJS) $(CXXOBJS) - -all: dep $(LIBNAME) - -clean: - rm -f *.o *.a *~ - -distclean: - rm -f Makefile.bak *.o *.a *~ .depend - -dep: .depend - -.depend: $(SRCS) $(CXXSRCS) - $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend - -# -# include dependency files if they exist -# -ifneq ($(wildcard .depend),) -include .depend -endif Deleted: mplayerxp/libvo/aspect.cpp =================================================================== --- mplayerxp/libvo/aspect.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/aspect.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,93 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* Stuff for correct aspect scaling. */ -#include "aspect.h" - -//#define ASPECT_DEBUG - -#ifdef ASPECT_DEBUG -#include <stdio.h> -#endif -#include "vo_msg.h" - -namespace mpxp { - -Aspect::Aspect(float mon_pix_aspect) { monitor_pixel_aspect = mon_pix_aspect; } -Aspect::~Aspect() { } - -void Aspect::save(uint32_t _orgw, uint32_t _orgh, - uint32_t _prew, uint32_t _preh, - uint32_t _scrw, uint32_t _scrh) { - orgw = _orgw; - orgh = _orgh; - prew = _prew; - preh = _preh; - screenw = _scrw; - screenh = _scrh; - monitor_aspect = monitor_pixel_aspect * screenw / screenh; -} - -void Aspect::save_image(uint32_t _orgw, uint32_t _orgh, - uint32_t _prew, uint32_t _preh) { - orgw = _orgw; - orgh = _orgh; - prew = _prew; - preh = _preh; -} - -void Aspect::save_screen(uint32_t _scrw, uint32_t _scrh) { - screenw = _scrw; - screenh = _scrh; - monitor_aspect = monitor_pixel_aspect * screenw / screenh; -} - -/* aspect is called with the source resolution and the - * resolution, that the scaled image should fit into - */ -void Aspect::calc(uint32_t& srcw, uint32_t& srch, zoom_e zoom) { - uint32_t tmpw; - -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(0) fitin: %dx%d zoom: %d \n",screenw,screenh,zoom); - MSG_DBG2("aspect(1) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); -#endif - if(zoom){ - if(prew >= preh) { - /* Landscape mode */ - srcw = screenw; - srch = (uint32_t)(((float)screenw / (float)prew * (float)preh) * - ((float)screenh / ((float)screenw / monitor_aspect))); - } else { - /* Portrait mode */ - srch = screenh; - srcw = (uint32_t)(((float)screenh / (float)preh * (float)prew) * - ((float)screenw / ((float)screenh * monitor_aspect))); - } - } else { - srcw = prew; - srch = (uint32_t)((float)preh * - ((float)screenh / ((float)screenw / monitor_aspect))); - } - srch+= srch%2; // round -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(2) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); -#endif - if(srch>screenh || srch<orgh){ - if(zoom) - tmpw = (uint32_t)(((float)screenh / (float)preh * (float)prew) * - ((float)screenw / ((float)screenh / (1.0/monitor_aspect)))); - else - tmpw = (uint32_t)((float)prew * - ((float)screenw / ((float)screenh / (1.0/monitor_aspect)))); - if(tmpw<=screenw && tmpw>=orgw) { - srch = zoom?screenh:preh; - srcw = tmpw; - srcw+= srcw%2; // round - } - } -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(3) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); -#endif -} -} // namesapce mpxp Deleted: mplayerxp/libvo/aspect.h =================================================================== --- mplayerxp/libvo/aspect.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/aspect.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,37 +0,0 @@ -#ifndef __ASPECT_H -#define __ASPECT_H -/* Stuff for correct aspect scaling. */ -#include <stdint.h> -#include "mp_config.h" - -namespace mpxp { - class Aspect : public Opaque { - public: - Aspect(float moitor_pixel_aspect); - virtual ~Aspect(); - - void __FASTCALL__ save(uint32_t orgw, uint32_t orgh, - uint32_t prew, uint32_t preh, - uint32_t scrw, uint32_t scrh); - void __FASTCALL__ save_image(uint32_t orgw, uint32_t orgh, - uint32_t prew, uint32_t preh); - void __FASTCALL__ save_screen(uint32_t scrw, uint32_t scrh); - enum zoom_e { - NOZOOM=0, - ZOOM - }; - void __FASTCALL__ calc(uint32_t& srcw, uint32_t& srch, zoom_e zoom); - private: - uint32_t orgw; // real width - uint32_t orgh; // real height - uint32_t prew; // prescaled width - uint32_t preh; // prescaled height - uint32_t screenw; // horizontal resolution - uint32_t screenh; // vertical resolution - float monitor_aspect; - float monitor_pixel_aspect; - }; -} // namespace mpxp - -#endif - Deleted: mplayerxp/libvo/dri_vo.h =================================================================== --- mplayerxp/libvo/dri_vo.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/dri_vo.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,43 +0,0 @@ -/* - This interface provides new DRI (Direct rendering interface) - for video output library. - This interface still stays in initial state. - Will be expanded in the future -*/ -#ifndef __DRI_VO_INCLUDED -#define __DRI_VO_INCLUDED 1 - -/*---------- LIB_DRI ----------------*/ -/* - Note: Each dri voctl call has following format: - voctl(call_num,any_t*); -*/ -enum { - DRI_CAP_TEMP_VIDEO =0x00000000UL,/**< Means: video buffer was allocated in RAM */ - DRI_CAP_VIDEO_MMAPED=0x00000001UL,/**< Means: surface provides DGA */ - DRI_CAP_UPSCALER =0x00000010UL,/**< Driver supports upscaling */ - DRI_CAP_DOWNSCALER =0x00000020UL,/**< Driver supports downscaling */ - DRI_CAP_HORZSCALER =0x00000040UL,/**< Driver supports horizontal scaling */ - DRI_CAP_VERTSCALER =0x00000080UL,/**< Driver supports vertical scaling */ - DRI_CAP_HWOSD =0x00000100UL,/**< Driver supports OSD painting */ - DRI_CAP_BUSMASTERING=0x80000000UL /**< Means: final video buffer but allocated in RAM */ -}; -typedef struct dri_surface_cap_s -{ - unsigned caps; /**< Capabilities of surface (see DRI_CAP_* for detail) */ - unsigned fourcc; /**< real fourcc of vo2 surface */ - unsigned width,height; /**< specify total dimension of surface */ - unsigned x,y,w,h; /**< specify movie position within surface */ - unsigned strides[4]; /**< drv->app:specify strides of each plane */ -}dri_surface_cap_t; - -enum { - MAX_DRI_BUFFERS=1024 /**< Maximal number of surfaces */ -}; -/** Contains surface address */ -typedef struct dri_surface_s -{ - unsigned idx; /**< app->drv:specify number of surface (0 default for single buffering) */ - uint8_t* planes[4]; /**< drv->app:specify planes (include alpha channel) */ -}dri_surface_t; -#endif Deleted: mplayerxp/libvo/font_load.cpp =================================================================== --- mplayerxp/libvo/font_load.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/font_load.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,291 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include "font_load.h" -#include "sub.h" -#include "osdep/get_path.h" -#include "vo_msg.h" - -raw_file* load_raw(const char *name,int verbose){ - int bpp; - raw_file* raw=new raw_file; - unsigned char head[32]; - FILE *f=fopen(name,"rb"); - if(!f) { delete raw; return NULL; } // can't open - if(fread(head,32,1,f)<1) { delete raw; fclose(f); return NULL; } // too small - if(memcmp(head,"mhwanh",6)) { delete raw; fclose(f); return NULL; } // not raw file - raw->w=head[8]*256+head[9]; - raw->h=head[10]*256+head[11]; - raw->c=head[12]*256+head[13]; - if(raw->w == 0) /* 2 bytes were not enough for the width... read 4 bytes from the end of the header */ - raw->w = ((head[28]*0x100 + head[29])*0x100 + head[30])*0x100 + head[31]; - if(raw->c>256) { delete raw; fclose(f); return NULL; } // too many colors!? - MSG_V("RAW: %s %d x %d, %d colors\n",name,raw->w,raw->h,raw->c); - if(raw->c){ - raw->pal=new unsigned char [raw->c*3]; - fread(raw->pal,3,raw->c,f); - bpp=1; - } else { - raw->pal=NULL; - bpp=3; - } - raw->bmp=new unsigned char [raw->h*raw->w*bpp]; - fread(raw->bmp,raw->h*raw->w*bpp,1,f); - fclose(f); - return raw; -} - -font_desc_t* read_font_desc(const char* fname,float factor,int verbose){ - char sor[1024]; - unsigned char sor2[1024]; - font_desc_t *desc; - FILE *f; - char *dn; - char section[64]; - int i,j; - int chardb=0; - int fontdb=-1; - int version=0; - - desc=new(zeromem) font_desc_t; - if(!desc) return NULL; - - f=fopen(fname,"rt"); - if(!f) { - MSG_ERR("font: can't open file: %s\n",fname); - delete desc; - return NULL; - } - - i = strlen (fname) - 9; - if ((dn = new char [i+1])){ - strncpy (dn, fname, i); - dn[i]='\0'; - } - - desc->fpath = dn; // search in the same dir as fonts.desc - - // desc->fpath=get_path("font/"); - // if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font"; - // set up some defaults, and erase table - desc->charspace=2; - desc->spacewidth=12; - desc->height=0; - for(i=0;i<512;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1; - - section[0]=0; - - while(fgets(sor,1020,f)){ - char* p[8]; - int pdb=0; - unsigned char *s=(unsigned char *)sor; - unsigned char *d=sor2; - int ec=' '; - int id=0; - sor[1020]=0; - p[0]=(char *)d;++pdb; - while(1){ - int c=*s++; - if(c==0 || c==13 || c==10) break; - if(!id){ - if(c==39 || c==34){ id=c;continue;} // idezojel - if(c==';' || c=='#') break; - if(c==9) c=' '; - if(c==' '){ - if(ec==' ') continue; - *d=0; ++d; - p[pdb]=(char *)d;++pdb; - if(pdb>=8) break; - continue; - } - } else { - if(id==c){ id=0; continue; } // idezojel - } - *d=c;d++; - ec=c; - } - if(d==sor2) continue; // skip empty lines - *d=0; - - if(pdb==1 && p[0][0]=='['){ - int len=strlen(p[0]); - if(len && len<63 && p[0][len-1]==']'){ - strcpy(section,p[0]); - MSG_V("font: Reading section: %s\n",section); - if(strcmp(section,"[files]")==0){ - ++fontdb; - if(fontdb>=16) { - MSG_ERR("font: Too many bitmaps defined!\n"); - delete desc; - return NULL; - } - } - continue; - } - } - - if(strcmp(section,"[fpath]")==0){ - if(pdb==1){ - if (desc->fpath) - delete desc->fpath; // release previously allocated memory - desc->fpath=mp_strdup(p[0]); - continue; - } - } else if(strcmp(section,"[files]")==0){ - char *default_dir=DATADIR"/font"; - if(pdb==2 && strcmp(p[0],"alpha")==0){ - char *cp; - if (!(cp=new char [strlen(desc->fpath)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s", - desc->fpath,p[1]); - if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ - delete cp; - if (!(cp=new char [strlen(default_dir)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s", - default_dir,p[1]); - if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ - MSG_ERR("Can't load font bitmap: %s\n",p[1]); - delete cp; - delete desc; - return NULL; - } - } - delete cp; - continue; - } - if(pdb==2 && strcmp(p[0],"bitmap")==0){ - char *cp; - if (!(cp=new char [strlen(desc->fpath)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s", - desc->fpath,p[1]); - if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ - delete cp; - if (!(cp=new char [strlen(default_dir)+strlen(p[1])+2])) { - delete desc; - return NULL; - } - snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s", - default_dir,p[1]); - if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ - MSG_ERR("Can't load font bitmap: %s\n",p[1]); - delete cp; - delete desc; - return NULL; - } - } - delete cp; - continue; - } - } else if(strcmp(section,"[info]")==0){ - if(pdb==2 && strcmp(p[0],"name")==0){ - desc->name=mp_strdup(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"descversion")==0){ - version=atoi(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"spacewidth")==0){ - desc->spacewidth=atoi(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"charspace")==0){ - desc->charspace=atoi(p[1]); - continue; - } - if(pdb==2 && strcmp(p[0],"height")==0){ - desc->height=atoi(p[1]); - continue; - } - } else if(strcmp(section,"[characters]")==0){ - if(pdb==3){ - int chr=p[0][0]; - int start=atoi(p[1]); - int end=atoi(p[2]); - if(sub_data.unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1]; - else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0); - if(end<start) MSG_ERR("error in font desc: end<start for char '%c'\n",chr); - else { - desc->start[chr]=start; - desc->width[chr]=end-start+1; - desc->font[chr]=fontdb; - ++chardb; - } - continue; - } - } - MSG_ERR("Syntax error in font desc: %s\n",sor); - } - fclose(f); - for(i=0;i<=fontdb;i++){ - if(!desc->pic_a[i] || !desc->pic_b[i]){ - MSG_ERR("font: Missing bitmap(s) for sub-font #%d\n",i); - delete desc; - return NULL; - } - // re-sample alpha - int f=factor*256.0f; - int size=desc->pic_a[i]->w*desc->pic_a[i]->h; - int j; - MSG_V("font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout); - for(j=0;j<size;j++){ - int x=desc->pic_a[i]->bmp[j]; // alpha - int y=desc->pic_b[i]->bmp[j]; // bitmap - -#ifdef FAST_OSD - x=(x<(255-f))?0:1; -#else - - x=255-((x*f)>>8); // scale - - if(x+y>255) x=255-y; // to avoid overflows - - if(x<1) x=1; else - if(x>=252) x=0; -#endif - - desc->pic_a[i]->bmp[j]=x; -// desc->pic_b[i]->bmp[j]=0; // hack - } - MSG_V("DONE!\n"); - if(!desc->height) desc->height=desc->pic_a[i]->h; - } - - j='_'; - if(desc->font[j]<0) j='?'; - for(i=0;i<512;i++) - if(desc->font[i]<0){ - desc->start[i]=desc->start[j]; - desc->width[i]=desc->width[j]; - desc->font[i]=desc->font[j]; - } - desc->font[' ']=-1; - desc->width[' ']=desc->spacewidth; - - MSG_OK("Font %s loaded successfully! (%d chars)\n",fname,chardb); - return desc; -} - -#if 0 -int main(){ - -read_font_desc("high_arpi.desc",1); - -} -#endif Deleted: mplayerxp/libvo/font_load.h =================================================================== --- mplayerxp/libvo/font_load.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/font_load.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,28 +0,0 @@ -#ifndef __FONT_LOAD_H -#define __FONT_LOAD_H 1 - -typedef struct { - unsigned char *bmp; - unsigned char *pal; - int w,h,c; -} raw_file; - -typedef struct { - char *name; - char *fpath; - int spacewidth; - int charspace; - int height; -// char *fname_a; -// char *fname_b; - raw_file* pic_a[16]; - raw_file* pic_b[16]; - short font[65536]; - int start[65536]; - short width[65536]; -} font_desc_t; - -raw_file* load_raw(const char *name,int verbose); -font_desc_t* read_font_desc(const char* fname,float factor,int verbose); - -#endif Deleted: mplayerxp/libvo/img_format.cpp =================================================================== --- mplayerxp/libvo/img_format.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/img_format.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,204 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -#include <ctype.h> -#include <stdio.h> -#include <limits.h> -#include "img_format.h" - -const char * __FASTCALL__ vo_format_name(int format) -{ - static char unknow_format[20]; - switch(format) - { - case IMGFMT_RGB1: return("RGB 1-bit"); - case IMGFMT_RGB4: return("RGB 4-bit"); - case IMGFMT_RG4B: return("RGB 4-bit per byte"); - case IMGFMT_RGB8: return("RGB 8-bit"); - case IMGFMT_RGB15: return("RGB 15-bit"); - case IMGFMT_RGB16: return("RGB 16-bit"); - case IMGFMT_RGB24: return("RGB 24-bit"); - case IMGFMT_RGB48NE: return("RGB 48-bit"); -// case IMGFMT_RGB32: return("RGB 32-bit"); - case IMGFMT_BGR1: return("BGR 1-bit"); - case IMGFMT_BGR4: return("BGR 4-bit"); - case IMGFMT_BG4B: return("BGR 4-bit per byte"); - case IMGFMT_BGR8: return("BGR 8-bit"); - case IMGFMT_BGR15: return("BGR 15-bit"); - case IMGFMT_BGR16: return("BGR 16-bit"); - case IMGFMT_BGR24: return("BGR 24-bit"); - case IMGFMT_BGR48NE: return("BGR 48-bit"); -// case IMGFMT_BGR32: return("BGR 32-bit"); - case IMGFMT_ABGR: return("ABGR"); - case IMGFMT_BGRA: return("BGRA"); - case IMGFMT_ARGB: return("ARGB"); - case IMGFMT_RGBA: return("RGBA"); - case IMGFMT_YVU9: return("Planar YVU9"); - case IMGFMT_IF09: return("Planar IF09"); - case IMGFMT_YV12: return("Planar YV12"); - case IMGFMT_I420: return("Planar I420"); - case IMGFMT_IYUV: return("Planar IYUV"); - case IMGFMT_CLPL: return("Planar CLPL"); - case IMGFMT_Y800: return("Planar Y800"); - case IMGFMT_Y8: return("Planar Y8"); - case IMGFMT_444P: return("Planar 444P"); - case IMGFMT_422P: return("Planar 422P"); - case IMGFMT_411P: return("Planar 411P"); - case IMGFMT_NV12: return("Planar NV12"); - case IMGFMT_NV21: return("Planar NV21"); - case IMGFMT_HM12: return("Planar NV12 Macroblock"); - case IMGFMT_IUYV: return("Packed IUYV"); - case IMGFMT_IY41: return("Packed IY41"); - case IMGFMT_IYU1: return("Packed IYU1"); - case IMGFMT_IYU2: return("Packed IYU2"); - case IMGFMT_UYVY: return("Packed UYVY"); - case IMGFMT_UYNV: return("Packed UYNV"); - case IMGFMT_cyuv: return("Packed CYUV"); - case IMGFMT_Y422: return("Packed Y422"); - case IMGFMT_YUY2: return("Packed YUY2"); - case IMGFMT_YUNV: return("Packed YUNV"); - case IMGFMT_YVYU: return("Packed YVYU"); - case IMGFMT_Y41P: return("Packed Y41P"); - case IMGFMT_Y211: return("Packed Y211"); - case IMGFMT_Y41T: return("Packed Y41T"); - case IMGFMT_Y42T: return("Packed Y42T"); - case IMGFMT_V422: return("Packed V422"); - case IMGFMT_V655: return("Packed V655"); - case IMGFMT_CLJR: return("Packed CLJR"); - case IMGFMT_YUVP: return("Packed YUVP"); - case IMGFMT_UYVP: return("Packed UYVP"); - case IMGFMT_420A: return "Planar YV12 with alpha"; - case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian"; - case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian"; - case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian"; - case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian"; - case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian"; - case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian"; - case IMGFMT_MPEGPES: return("Mpeg PES"); - case IMGFMT_ZRMJPEGNI: return("Zoran MJPEG non-interlaced"); - case IMGFMT_ZRMJPEGIT: return("Zoran MJPEG top field first"); - case IMGFMT_ZRMJPEGIB: return("Zoran MJPEG bottom field first"); - case IMGFMT_XVMC_MOCO_MPEG2: return("MPEG1/2 Motion Compensation"); - case IMGFMT_XVMC_IDCT_MPEG2: return("MPEG1/2 Motion Compensation and IDCT"); - } - char *p=reinterpret_cast<char *>(&format); - if(isprint(p[0])&&isprint(p[1])&&isprint(p[2])&&isprint(p[4])) - snprintf(unknow_format,20,"Unknown %c%c%c%c",p[0],p[1],p[2],p[3]); - else - snprintf(unknow_format,20,"Unknown 0x%04x",format); - return unknow_format; -} - -typedef struct s_pix_fourcc{ - PixelFormat pix_fmt; - uint32_t fourcc; -}pix_fourcc; -static pix_fourcc pfcc[] = -{ - { PIX_FMT_YUV420P, IMGFMT_YV12 }, ///< Planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - { PIX_FMT_YUYV422, IMGFMT_YUY2 }, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - { PIX_FMT_RGB24, IMGFMT_RGB24}, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - { PIX_FMT_BGR24, IMGFMT_BGR24}, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - { PIX_FMT_YUV422P, IMGFMT_422P }, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - { PIX_FMT_YUV444P, IMGFMT_444P }, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - { PIX_FMT_RGB32, IMGFMT_RGB32}, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - { PIX_FMT_YUV410P, IMGFMT_YVU9 }, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - { PIX_FMT_YUV410P, IMGFMT_IF09 }, ///< rough alias - { PIX_FMT_YUV411P, IMGFMT_411P }, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - { PIX_FMT_RGB48BE, IMGFMT_RGB48BE }, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian - { PIX_FMT_RGB48LE, IMGFMT_RGB48LE }, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian - { PIX_FMT_RGB565, IMGFMT_RGB16}, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - { PIX_FMT_RGB555, IMGFMT_RGB15}, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 1 - { PIX_FMT_GRAY8, IMGFMT_Y800 }, ///< Y , 8bpp - { PIX_FMT_GRAY8, IMGFMT_Y8 }, ///< alias - { PIX_FMT_MONOWHITE, IMGFMT_RGB1}, ///< Y , 1bpp, 1 is white - { PIX_FMT_MONOBLACK, IMGFMT_RGB1}, ///< Y , 1bpp, 0 is black - { PIX_FMT_PAL8, IMGFMT_RGB8 }, ///< 8 bit with PIX_FMT_RGB32 palette - { PIX_FMT_YUVJ420P,IMGFMT_YV12 }, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - { PIX_FMT_YUVJ420P,IMGFMT_I420 }, ///< alias - { PIX_FMT_YUVJ422P,IMGFMT_422P }, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - { PIX_FMT_YUVJ444P,IMGFMT_444P }, ///< Planar YUV 4:4:4, 24bpp, full scale (jpeg) - { PIX_FMT_XVMC_MPEG2_MC, IMGFMT_XVMC},///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - { PIX_FMT_XVMC_MPEG2_IDCT, IMGFMT_XVMC_IDCT_MPEG2}, - { PIX_FMT_UYVY422, IMGFMT_UYVY }, ///< Packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - { PIX_FMT_UYYVYY411, IMGFMT_Y41P },///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - { PIX_FMT_BGR32, IMGFMT_BGR32 }, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - { PIX_FMT_BGR565, IMGFMT_BGR16 }, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - { PIX_FMT_BGR555, IMGFMT_BGR15 }, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - { PIX_FMT_BGR8, IMGFMT_BGR8 }, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - { PIX_FMT_BGR4, IMGFMT_BGR4 }, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - { PIX_FMT_BGR4_BYTE,IMGFMT_BGR4_CHAR}, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - { PIX_FMT_RGB8, IMGFMT_RGB8 }, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - { PIX_FMT_RGB4, IMGFMT_RGB4 }, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - { PIX_FMT_RGB4_BYTE,IMGFMT_RGB4_CHAR }, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - { PIX_FMT_NV12, IMGFMT_NV12 }, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - { PIX_FMT_NV21, IMGFMT_NV21 }, ///< as above, but U and V bytes are swapped - - { PIX_FMT_YUVA420P, IMGFMT_420A },///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) - { PIX_FMT_YUV420P16LE, IMGFMT_420P16_LE }, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian - { PIX_FMT_YUV420P16BE, IMGFMT_420P16_BE },///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian - { PIX_FMT_YUV422P16LE, IMGFMT_422P16_LE },///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian - { PIX_FMT_YUV422P16BE, IMGFMT_422P16_BE },///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - { PIX_FMT_YUV444P16LE, IMGFMT_444P16_LE },///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian - { PIX_FMT_YUV444P16BE, IMGFMT_444P16_BE },///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - - { PIX_FMT_RGB32_1, IMGFMT_RGBA }, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - { PIX_FMT_BGR32_1, IMGFMT_BGRA } ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness -}; - -PixelFormat pixfmt_from_fourcc(uint32_t fourcc) -{ - unsigned i; - for(i=0;i<sizeof(pfcc)/sizeof(pix_fourcc);i++) { - if(fourcc==pfcc[i].fourcc) return pfcc[i].pix_fmt; - } - return PIX_FMT_NONE; -} - -uint32_t fourcc_from_pixfmt(enum PixelFormat pixfmt) -{ - unsigned i; - for(i=0;i<sizeof(pfcc)/sizeof(pix_fourcc);i++) { - if(pixfmt==pfcc[i].pix_fmt) return pfcc[i].fourcc; - } - return UINT_MAX; -} - -unsigned rgbfmt_depth(unsigned fmt) -{ - switch(pixfmt_from_fourcc(fmt)) { - case PIX_FMT_RGB48BE: - case PIX_FMT_RGB48LE: -// case PIX_FMT_BGR48BE: -// case PIX_FMT_BGR48LE: - return 48; - case PIX_FMT_BGRA: - case PIX_FMT_ABGR: - case PIX_FMT_RGBA: - case PIX_FMT_ARGB: - return 32; - case PIX_FMT_BGR24: - case PIX_FMT_RGB24: - return 24; - case PIX_FMT_BGR565: - case PIX_FMT_RGB565: - case PIX_FMT_GRAY16BE: - case PIX_FMT_GRAY16LE: - return 16; - case PIX_FMT_BGR555: - case PIX_FMT_RGB555: - return 15; - case PIX_FMT_BGR8: - case PIX_FMT_RGB8: - return 8; - case PIX_FMT_BGR4: - case PIX_FMT_RGB4: - case PIX_FMT_BGR4_BYTE: - case PIX_FMT_RGB4_BYTE: - return 4; - case PIX_FMT_MONOBLACK: - return 1; - default: - return 256; - } -} Deleted: mplayerxp/libvo/img_format.h =================================================================== --- mplayerxp/libvo/img_format.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/img_format.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,161 +0,0 @@ - -#ifndef __IMG_FORMAT_H -#define __IMG_FORMAT_H -#include <inttypes.h> -#include <stdint.h> -#include "mp_config.h" -#include "mp_conf_lavc.h" - -/* RGB/BGR Formats */ -enum { - IMGFMT_RGB_MASK =0xFFFFFF00, - IMGFMT_RGB =(('R'<<24)|('G'<<16)|('B'<<8)), - IMGFMT_RGB1 =(IMGFMT_RGB|1), - IMGFMT_RGB4 =(IMGFMT_RGB|4), - IMGFMT_RGB4_CHAR =(IMGFMT_RGB|4|128), // RGB4 with 1 pixel per byte - IMGFMT_RGB8 =(IMGFMT_RGB|8), - IMGFMT_RGB15 =(IMGFMT_RGB|15), - IMGFMT_RGB16 =(IMGFMT_RGB|16), - IMGFMT_RGB24 =(IMGFMT_RGB|24), - IMGFMT_RGB32 =(IMGFMT_RGB|32), - IMGFMT_RGB48LE =(IMGFMT_RGB|48), - IMGFMT_RGB48BE =(IMGFMT_RGB|48|128), - - IMGFMT_BGR_MASK =0xFFFFFF00, - IMGFMT_BGR =(('B'<<24)|('G'<<16)|('R'<<8)), - IMGFMT_BGR1 =(IMGFMT_BGR|1), - IMGFMT_BGR4 =(IMGFMT_BGR|4), - IMGFMT_BGR4_CHAR =(IMGFMT_BGR|4|128), // BGR4 with 1 pixel per byte - IMGFMT_BGR8 =(IMGFMT_BGR|8), - IMGFMT_BGR15 =(IMGFMT_BGR|15), - IMGFMT_BGR16 =(IMGFMT_BGR|16), - IMGFMT_BGR24 =(IMGFMT_BGR|24), - IMGFMT_BGR32 =(IMGFMT_BGR|32), - IMGFMT_BGR48LE =(IMGFMT_BGR|48), - IMGFMT_BGR48BE =(IMGFMT_BGR|48|128), - -#ifdef WORDS_BIGENDIAN - IMGFMT_ABGR =IMGFMT_RGB32, - IMGFMT_BGRA =(IMGFMT_RGB32|64), - IMGFMT_ARGB =IMGFMT_BGR32, - IMGFMT_RGBA =(IMGFMT_BGR32|64), - IMGFMT_RGB48NE =IMGFMT_RGB48BE, - IMGFMT_BGR48NE =IMGFMT_RGB48LE, -#else - IMGFMT_ABGR =(IMGFMT_BGR32|64), - IMGFMT_BGRA =IMGFMT_BGR32, - IMGFMT_ARGB =(IMGFMT_RGB32|64), - IMGFMT_RGBA =IMGFMT_RGB32, - IMGFMT_RGB48NE =IMGFMT_RGB48LE, - IMGFMT_BGR48NE =IMGFMT_RGB48BE, -#endif -/* old names for compatibility */ - IMGFMT_RG4B =IMGFMT_RGB4_CHAR, - IMGFMT_BG4B =IMGFMT_BGR4_CHAR, -/* Planar YUV Formats */ - IMGFMT_YVU9 =0x39555659, - IMGFMT_IF09 =0x39304649, - IMGFMT_YV12 =0x32315659, - IMGFMT_I420 =0x30323449, - IMGFMT_IYUV =0x56555949, - IMGFMT_CLPL =0x4C504C43, - IMGFMT_Y800 =0x30303859, - IMGFMT_Y8 =0x20203859, - IMGFMT_NV12 =0x3231564E, - IMGFMT_NV21 =0x3132564E, -/* unofficial Planar Formats, FIXME if official 4CC exists */ - IMGFMT_444P =0x50343434, - IMGFMT_422P =0x50323234, - IMGFMT_411P =0x50313134, - IMGFMT_HM12 =0x32314D48, -/* Packed YUV Formats */ - IMGFMT_IUYV =0x56595549, - IMGFMT_IY41 =0x31435949, - IMGFMT_IYU1 =0x31555949, - IMGFMT_IYU2 =0x32555949, - IMGFMT_UYVY =0x59565955, - IMGFMT_UYNV =0x564E5955, - IMGFMT_cyuv =0x76757963, - IMGFMT_Y422 =0x32323459, - IMGFMT_YUY2 =0x32595559, - IMGFMT_YUNV =0x564E5559, - IMGFMT_YVYU =0x55595659, - IMGFMT_Y41P =0x50313459, - IMGFMT_Y211 =0x31313259, - IMGFMT_Y41T =0x54313459, - IMGFMT_Y42T =0x54323459, - IMGFMT_V422 =0x32323456, - IMGFMT_V655 =0x35353656, - IMGFMT_CLJR =0x524A4C43, - IMGFMT_YUVP =0x50565559, - IMGFMT_UYVP =0x50565955, -// 4:2:0 planar with alpha - IMGFMT_420A =0x41303234, - - IMGFMT_444P16_LE =0x51343434, - IMGFMT_444P16_BE =0x34343451, - IMGFMT_422P16_LE =0x51323234, - IMGFMT_422P16_BE =0x34323251, - IMGFMT_420P16_LE =0x51303234, - IMGFMT_420P16_BE =0x34323051, -#if HAVE_BIGENDIAN - IMGFMT_444P16 =IMGFMT_444P16_BE, - IMGFMT_422P16 =IMGFMT_422P16_BE, - IMGFMT_420P16 =IMGFMT_420P16_BE, -#else - IMGFMT_444P16 =IMGFMT_444P16_LE, - IMGFMT_422P16 =IMGFMT_422P16_LE, - IMGFMT_420P16 =IMGFMT_420P16_LE, -#endif -/* Compressed Formats */ - IMGFMT_MPEGPES =(('M'<<24)|('P'<<16)|('E'<<8)|('S')), -/* Formats that are understood by zoran chips, we include - * non-interlaced, interlaced top-first, interlaced bottom-first */ - IMGFMT_ZRMJPEGNI =(('Z'<<24)|('R'<<16)|('N'<<8)|('I')), - IMGFMT_ZRMJPEGIT =(('Z'<<24)|('R'<<16)|('I'<<8)|('T')), - IMGFMT_ZRMJPEGIB =(('Z'<<24)|('R'<<16)|('I'<<8)|('B')), -// I think that this code could not be used by any other codec/format - IMGFMT_XVMC =0x1DC70000, - IMGFMT_XVMC_MASK =0xFFFF0000, -//these are chroma420 - IMGFMT_XVMC_MOCO_MPEG2=(IMGFMT_XVMC|0x02), - IMGFMT_XVMC_IDCT_MPEG2=(IMGFMT_XVMC|0x82), -// VDPAU specific format. - IMGFMT_VDPAU =0x1DC80000, - IMGFMT_VDPAU_MASK =0xFFFF0000, - IMGFMT_VDPAU_MPEG1 =(IMGFMT_VDPAU|0x01), - IMGFMT_VDPAU_MPEG2 =(IMGFMT_VDPAU|0x02), - IMGFMT_VDPAU_H264 =(IMGFMT_VDPAU|0x03), - IMGFMT_VDPAU_WMV3 =(IMGFMT_VDPAU|0x04), - IMGFMT_VDPAU_VC1 =(IMGFMT_VDPAU|0x05), - IMGFMT_VDPAU_MPEG4 =(IMGFMT_VDPAU|0x06) -}; - -static inline int IMGFMT_IS_RGB(uint32_t fmt) { return (fmt&IMGFMT_RGB_MASK)==IMGFMT_RGB; } -static inline int IMGFMT_IS_BGR(uint32_t fmt) { return (fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR; } -static inline int IMGFMT_RGB_DEPTH(uint32_t fmt) { return (fmt&0x3F); } -static inline int IMGFMT_BGR_DEPTH(uint32_t fmt) { return (fmt&0x3F); } -static inline int IMGFMT_IS_YUVP16_LE(uint32_t fmt) { return ((fmt^IMGFMT_420P16_LE) & 0xff0000ff) == 0; } -static inline int IMGFMT_IS_YUVP16_BE(uint32_t fmt) { return ((fmt^IMGFMT_420P16_BE) & 0xff0000ff) == 0; } -static inline int IMGFMT_IS_YUVP16_NE(uint32_t fmt) { return ((fmt^IMGFMT_420P16 ) & 0xff0000ff) == 0; } -static inline int IMGFMT_IS_YUVP16(uint32_t fmt) { return (IMGFMT_IS_YUVP16_LE(fmt)||IMGFMT_IS_YUVP16_BE(fmt)); } -static inline int IMGFMT_IS_XVMC(uint32_t fmt) { return ((fmt)&IMGFMT_XVMC_MASK)==IMGFMT_XVMC; } -static inline int IMGFMT_IS_VDPAU(uint32_t fmt) { return ((fmt)&IMGFMT_VDPAU_MASK)==IMGFMT_VDPAU; } - -typedef struct { - any_t* data; - int size; - int id; // stream id. usually 0x1E0 - int timestamp; // pts, 90000 Hz counter based -} vo_mpegpes_t; - -/** Returns human-readable fourcc description - * @param format fourcc of image - * @return string of format name -**/ -const char * __FASTCALL__ vo_format_name(int format); -enum PixelFormat pixfmt_from_fourcc(uint32_t fourcc); -uint32_t fourcc_from_pixfmt(enum PixelFormat pixfmt); -extern unsigned rgbfmt_depth(unsigned fmt); - -#endif Deleted: mplayerxp/libvo/jpeg_enc.cpp =================================================================== --- mplayerxp/libvo/jpeg_enc.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/jpeg_enc.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,451 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* Straightforward (to be) optimized JPEG encoder for the YUV422 format - * based on mjpeg code from ffmpeg. - * - * Copyright (c) 2002, Rik Snel - * Parts from ffmpeg Copyright (c) 2000, 2001 Gerard Lantau - * - * This program is mp_free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For an excellent introduction to the JPEG format, see: - * http://www.ece.purdue.edu/~bouman/grad-labs/lab8/pdf/lab.pdf - */ - -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#ifdef USE_FASTMEMCPY -#include "fastmemcpy.h" -#endif -/* We need this #define because we need ../libavcodec/common.h to #define - * be2me_32, otherwise the linker will complain that it doesn't exist */ -#include "mp_conf_lavc.h" - -#include "jpeg_enc.h" -#include "vo_msg.h" - -/* zr_mjpeg_encode_mb needs access to these tables for the black & white - * option */ -typedef struct MJpegContext { - UINT8 huff_size_dc_luminance[12]; - UINT16 huff_code_dc_luminance[12]; - UINT8 huff_size_dc_chrominance[12]; - UINT16 huff_code_dc_chrominance[12]; - - UINT8 huff_size_ac_luminance[256]; - UINT16 huff_code_ac_luminance[256]; - UINT8 huff_size_ac_chrominance[256]; - UINT16 huff_code_ac_chrominance[256]; -} MJpegContext; - - -/* A very important function pointer */ -extern int (*dct_quantize)(MpegEncContext *s, - DCTELEM *block, int n, int qscale); - - -/* Begin excessive code duplication ************************************/ -/* Code coming from mpegvideo.c and mjpeg.c in ../libavcodec ***********/ - -static const unsigned short aanscales[64] = { - /* precomputed values scaled up by 14 bits */ - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, - 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, - 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, - 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, - 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, - 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, - 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 -}; - -static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale) -{ - int i; - - if (av_fdct == jpeg_fdct_ifast) { - for(i=0;i<64;i++) { - /* 16 <= qscale * quant_matrix[i] <= 7905 */ - /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ - /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ - /* 3444240 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */ - - qmat[block_permute_op(i)] = (int)((UINT64_C(1) << (QMAT_SHIFT + 11)) / - (aanscales[i] * qscale * quant_matrix[block_permute_op(i)])); - } - } else { - for(i=0;i<64;i++) { - /* We can safely suppose that 16 <= quant_matrix[i] <= 255 - So 16 <= qscale * quant_matrix[i] <= 7905 - so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 - so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67 - */ - qmat[i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]); - qmat16[i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[block_permute_op(i)]); - } - } -} - -static inline void encode_dc(MpegEncContext *s, int val, - UINT8 *huff_size, UINT16 *huff_code) -{ - int mant, nbits; - - if (val == 0) { - jput_bits(&s->pb, huff_size[0], huff_code[0]); - } else { - mant = val; - if (val < 0) { - val = -val; - mant--; - } - - /* compute the log (XXX: optimize) */ - nbits = 0; - while (val != 0) { - val = val >> 1; - nbits++; - } - - jput_bits(&s->pb, huff_size[nbits], huff_code[nbits]); - - jput_bits(&s->pb, nbits, mant & ((1 << nbits) - 1)); - } -} - -static void encode_block(MpegEncContext *s, DCTELEM *block, int n) -{ - int mant, nbits, code, i, j; - int component, dc, run, last_index, val; - MJpegContext *m = s->mjpeg_ctx; - UINT8 *huff_size_ac; - UINT16 *huff_code_ac; - - /* DC coef */ - component = (n <= 3 ? 0 : n - 4 + 1); - dc = block[0]; /* overflow is impossible */ - val = dc - s->last_dc[component]; - if (n < 4) { - encode_dc(s, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance); - huff_size_ac = m->huff_size_ac_luminance; - huff_code_ac = m->huff_code_ac_luminance; - } else { - encode_dc(s, val, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance); - huff_size_ac = m->huff_size_ac_chrominance; - huff_code_ac = m->huff_code_ac_chrominance; - } - s->last_dc[component] = dc; - - /* AC coefs */ - - run = 0; - last_index = s->block_last_index[n]; - for(i=1;i<=last_index;i++) { - j = zigzag_direct[i]; - val = block[j]; - if (val == 0) { - run++; - } else { - while (run >= 16) { - jput_bits(&s->pb, huff_size_ac[0xf0], huff_code_ac[0xf0]); - run -= 16; - } - mant = val; - if (val < 0) { - val = -val; - mant--; - } - - /* compute the log (XXX: optimize) */ - nbits = 0; - while (val != 0) { - val = val >> 1; - nbits++; - } - code = (run << 4) | nbits; - - jput_bits(&s->pb, huff_size_ac[code], huff_code_ac[code]); - - jput_bits(&s->pb, nbits, mant & ((1 << nbits) - 1)); - run = 0; - } - } - - /* output EOB only if not already 64 values */ - if (last_index < 63 || run != 0) - jput_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]); -} - -/* End excessive code duplication **************************************/ - -/* this function is a reproduction of the one in mjpeg, it includes two - * changes, it allows for black&white encoding (it skips the U and V - * macroblocks and it outputs the huffman code for 'no change' (dc) and - * 'all zero' (ac)) and it takes 4 macroblocks (422) instead of 6 (420) */ -static void zr_mjpeg_encode_mb(jpeg_enc_t *j) { - - MJpegContext *m = j->s->mjpeg_ctx; - - encode_block(j->s, j->s->block[0], 0); - encode_block(j->s, j->s->block[1], 1); - if (j->bw) { - /* U */ - jput_bits(&j->s->pb, m->huff_size_dc_chrominance[0], - m->huff_code_dc_chrominance[0]); - jput_bits(&j->s->pb, m->huff_size_ac_chrominance[0], - m->huff_code_ac_chrominance[0]); - /* V */ - jput_bits(&j->s->pb, m->huff_size_dc_chrominance[0], - m->huff_code_dc_chrominance[0]); - jput_bits(&j->s->pb, m->huff_size_ac_chrominance[0], - m->huff_code_ac_chrominance[0]); - } else { - /* we trick encode_block here so that it uses - * chrominance huffman tables instead of luminance ones - * (see the effect of second argument of encode_block) */ - encode_block(j->s, j->s->block[2], 4); - encode_block(j->s, j->s->block[3], 5); - } -} - -/* this function can take all kinds of YUV colorspaces - * YV12, YVYU, UYVY. The necesary parameters must be set up by the caller - * y_ps means "y pixel size", y_rs means "y row size". - * For YUYV, for example, is u_buf = y_buf + 1, v_buf = y_buf + 3, - * y_ps = 2, u_ps = 4, v_ps = 4, y_rs = u_rs = v_rs. - * - * The actual buffers must be passed with mjpeg_encode_frame, this is - * to make it possible to call encode on the buffer provided by the - * codec in draw_frame. - * - * The data is straightened out at the moment it is put in DCT - * blocks, there are therefore no spurious memcopies involved */ -/* Notice that w must be a multiple of 16 and h must be a multiple of 8 */ -/* We produce YUV422 jpegs, the colors must be subsampled horizontally, - * if the colors are also subsampled vertically, then this function - * performs cheap upsampling (better solution will be: a DCT that is - * optimized in the case that every two rows are the same) */ -/* cu = 0 means 'No cheap upsampling' - * cu = 1 means 'perform cheap upsampling' */ -/* The encoder doesn't know anything about interlacing, the halve height - * needs to be passed and the double rowstride. Which field gets encoded - * is decided by what buffers are passed to mjpeg_encode_frame */ -jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, - int u_psize, int u_rsize, int v_psize, int v_rsize, - int cu, int q, int b) { - jpeg_enc_t *j; - int i = 0; - MSGL_V( "JPEnc init: %dx%d %d %d %d %d %d %d\n", - w, h, y_psize, y_rsize, u_psize, - u_rsize, v_psize, v_rsize); - - j = mp_malloc(sizeof(jpeg_enc_t)); - if (j == NULL) return NULL; - - j->s = mp_malloc(sizeof(MpegEncContext)); - if (j->s == NULL) { - delete j; - return NULL; - } - - /* info on how to access the pixels */ - j->y_ps = y_psize; - j->u_ps = u_psize; - j->v_ps = v_psize; - j->y_rs = y_rsize; - j->u_rs = u_rsize; - j->v_rs = v_rsize; - - j->s->width = w; - j->s->height = h; - j->s->qscale = q; - - j->s->out_format = FMT_MJPEG; - j->s->intra_only = 1; - j->s->encoding = 1; - j->s->pict_type = I_TYPE; - j->s->y_dc_scale = 8; - j->s->c_dc_scale = 8; - - j->s->mjpeg_write_tables = 1; - j->s->mjpeg_vsample[0] = 1; - j->s->mjpeg_vsample[1] = 1; - j->s->mjpeg_vsample[2] = 1; - j->s->mjpeg_hsample[0] = 2; - j->s->mjpeg_hsample[1] = 1; - j->s->mjpeg_hsample[2] = 1; - - j->cheap_upsample = cu; - j->bw = b; - - /* if libavcodec is used by the decoder then we must not - * initialize again, but if it is not initialized then we must - * initialize it here. There must be a better way to find out - * if it is initialized */ - if (av_fdct != jpeg_fdct_ifast -#ifdef CAN_COMPILE_MMX - && av_fdct != fdct_mmx -#endif - ) { - /* we need to initialize libavcodec */ - avcodec_init(); - } - - if (mjpeg_init(j->s) < 0) { - delete j->s; - delete j; - return NULL; - } - - if (MPV_common_init(j->s) < 0) { - delete j->s; - delete j; - return NULL; - } - - /* correct the value for sc->mb_height */ - j->s->mb_height = j->s->height/8; - j->s->mb_intra = 1; - - j->s->intra_matrix[0] = default_intra_matrix[0]; - for (i = 1; i < 64; i++) - j->s->intra_matrix[i] = - (default_intra_matrix[i]*j->s->qscale) >> 3; - convert_matrix(j->s->q_intra_matrix, j->s->q_intra_matrix16, - j->s->intra_matrix, 8); - return j; -} - -int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, - unsigned char *u_data, unsigned char *v_data, char *bufr) { - int i, k, mb_x, mb_y; - short int *dest; - unsigned char *source; - /* initialize the buffer */ - - init_put_bits(&j->s->pb, bufr, 1024*256, NULL, NULL); - - mjpeg_picture_header(j->s); - - j->s->last_dc[0] = 128; - j->s->last_dc[1] = 128; - j->s->last_dc[2] = 128; - - for (mb_y = 0; mb_y < j->s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < j->s->mb_width; mb_x++) { - /* conversion 8 to 16 bit and filling of blocks - * must be mmx optimized */ - /* fill 2 Y macroblocks and one U and one V */ - source = mb_y * 8 * j->y_rs + - 16 * j->y_ps * mb_x + y_data; - dest = j->s->block[0]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->y_ps]; - } - dest += 8; - source += j->y_rs; - } - source = mb_y * 8 * j->y_rs + - (16*mb_x + 8)*j->y_ps + y_data; - dest = j->s->block[1]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->y_ps]; - } - dest += 8; - source += j->y_rs; - } - if (!j->bw && j->cheap_upsample) { - source = mb_y*4*j->u_rs + - 8*mb_x*j->u_ps + u_data; - dest = j->s->block[2]; - for (i = 0; i < 4; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->u_ps]; - dest[k+8] = source[k*j->u_ps]; - } - dest += 16; - source += j->u_rs; - } - source = mb_y*4*j->v_rs + - 8*mb_x*j->v_ps + v_data; - dest = j->s->block[3]; - for (i = 0; i < 4; i++) { - for (k = 0; k < 8; k++) { - dest[k] = source[k*j->v_ps]; - dest[k+8] = source[k*j->v_ps]; - } - dest += 16; - source += j->u_rs; - } - } else if (!j->bw && !j->cheap_upsample) { - source = mb_y*8*j->u_rs + - 8*mb_x*j->u_ps + u_data; - dest = j->s->block[2]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) - dest[k] = source[k*j->u_ps]; - dest += 8; - source += j->u_rs; - } - source = mb_y*8*j->v_rs + - 8*mb_x*j->v_ps + v_data; - dest = j->s->block[3]; - for (i = 0; i < 8; i++) { - for (k = 0; k < 8; k++) - dest[k] = source[k*j->v_ps]; - dest += 8; - source += j->u_rs; - } - } - emms_c(); /* is this really needed? */ - - j->s->block_last_index[0] = - dct_quantize(j->s, j->s->block[0], - 0, j->s->qscale); - j->s->block_last_index[1] = - dct_quantize(j->s, j->s->block[1], - 1, j->s->qscale); - - if (!j->bw) { - j->s->block_last_index[4] = - dct_quantize(j->s, j->s->block[2], - 4, j->s->qscale); - j->s->block_last_index[5] = - dct_quantize(j->s, j->s->block[3], - 5, j->s->qscale); - } - zr_mjpeg_encode_mb(j); - } - } - emms_c(); - mjpeg_picture_trailer(j->s); - flush_put_bits(&j->s->pb); - - if (j->s->mjpeg_write_tables == 1) - j->s->mjpeg_write_tables = 0; - - return pbBufPtr(&(j->s->pb)) - j->s->pb.buf; -} - -void jpeg_enc_uninit(jpeg_enc_t *j) { - mjpeg_close(j->s); - delete j->s; - delete j; -} - Deleted: mplayerxp/libvo/jpeg_enc.h =================================================================== --- mplayerxp/libvo/jpeg_enc.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/jpeg_enc.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,45 +0,0 @@ -/* Straightforward (to be) optimized JPEG encoder for the YUV422 format - * based on mjpeg code from ffmpeg. - * - * Copyright (c) 2002, Rik Snel - * Parts from ffmpeg Copyright (c) 2000, 2001 Gerard Lantau - * - * This program is mp_free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For an excellent introduction to the JPEG format, see: - * http://www.ece.purdue.edu/~bourman/grad-labs/lab8/pdf/lab.pdf - */ - - -typedef struct { - struct MpegEncContext *s; - int cheap_upsample; - int bw; - int y_ps; - int u_ps; - int v_ps; - int y_rs; - int u_rs; - int v_rs; -} jpeg_enc_t; - -jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, - int u_psize, int u_rsize, int v_psize, int v_rsize, - int cu, int q, int b); - -int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, - unsigned char *u_data, unsigned char *v_data, char *bufr); - -void jpeg_enc_uninit(jpeg_enc_t *j); Deleted: mplayerxp/libvo/osd_render.cpp =================================================================== --- mplayerxp/libvo/osd_render.cpp 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/osd_render.cpp 2012-12-11 16:18:22 UTC (rev 542) @@ -1,263 +0,0 @@ -#include "mp_config.h" -#include "osdep/mplib.h" -using namespace mpxp; -/* - Generic alpha renderers for all YUV modes and RGB depths. - These are "reference implementations", should be optimized later (MMX, etc) - Templating Code from Michael Niedermayer (mic...@gm...) is under GPL -*/ - -#include <stdio.h> -#include <pthread.h> - -#include <inttypes.h> -#include "osdep/cpudetect.h" -#include "osdep/mangle.h" -#include "mplayerxp.h" -#include "osd_render.h" -#include "vo_msg.h" - -#if defined(__MMX__) -static const uint64_t bFF __attribute__((used)) __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; -static const unsigned long long mask24lh __attribute__((used)) __attribute__((aligned(8))) = 0xFFFF000000000000ULL; -static const unsigned long long mask24hl __attribute__((used)) __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; -#endif - -#define PVECTOR_ACCEL_H "osd_render_template.h" -#include "pvector/pvector_inc.h" - -namespace mpxp { -#ifdef FAST_OSD_TABLE -static unsigned short fast_osd_15bpp_table[256]; -static unsigned short fast_osd_16bpp_table[256]; -#endif - -static void __FASTCALL__ vo_draw_alpha_rgb15_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - int y; - for(y=0;y<h;y++){ - register unsigned short *dst = (unsigned short*) dstbase; - register int x; - for(x=0;x<w;x++){ - if(srca[x]){ -#ifdef FAST_OSD -#ifdef FAST_OSD_TABLE - dst[x]=fast_osd_15bpp_table[src[x]]; -#else - register unsigned int a=src[x]>>3; - dst[x]=(a<<10)|(a<<5)|a; -#endif -#else - unsigned char r=dst[x]&0x1F; - unsigned char g=(dst[x]>>5)&0x1F; - unsigned char b=(dst[x]>>10)&0x1F; - r=(((r*srca[x])>>5)+src[x])>>3; - g=(((g*srca[x])>>5)+src[x])>>3; - b=(((b*srca[x])>>5)+src[x])>>3; - dst[x]=(b<<10)|(g<<5)|r; -#endif - } - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } - return; -} - -static void __FASTCALL__ vo_draw_alpha_rgb16_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - int y; - for(y=0;y<h;y++){ - register unsigned short *dst = (unsigned short*) dstbase; - register int x; - for(x=0;x<w;x++){ - if(srca[x]){ -#ifdef FAST_OSD -#ifdef FAST_OSD_TABLE - dst[x]=fast_osd_16bpp_table[src[x]]; -#else - dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3); -#endif -#else - unsigned char r=dst[x]&0x1F; - unsigned char g=(dst[x]>>5)&0x3F; - unsigned char b=(dst[x]>>11)&0x1F; - r=(((r*srca[x])>>5)+src[x])>>3; - g=(((g*srca[x])>>6)+src[x])>>2; - b=(((b*srca[x])>>5)+src[x])>>3; - dst[x]=(b<<11)|(g<<5)|r; -#endif - } - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } - return; -} - -static void __FASTCALL__ vo_draw_alpha_uyvy_c(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - vo_draw_alpha_yuy2_c(w,h,src,srca,srcstride,dstbase+1,dststride,finalize); -} - -static void __FASTCALL__ vo_draw_alpha_null(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - UNUSED(w); - UNUSED(h); - UNUSED(src); - UNUSED(srca); - UNUSED(srcstride); - UNUSED(dstbase); - UNUSED(dststride); - UNUSED(finalize); -} - -void OSD_Render::render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) const -{ - (*draw_alpha_ptr)(w,h,src,srca,srcstride,dstbase,dststride,finalize); -} - -void OSD_Render::get_draw_alpha(unsigned fmt) { - MSG_DBG2("get_draw_alpha(%s)\n",vo_format_name(fmt)); - switch(fmt) { - case IMGFMT_BGR15: - case IMGFMT_RGB15: - draw_alpha_ptr=draw_alpha_rgb15_ptr; - break; - case IMGFMT_BGR16: - case IMGFMT_RGB16: - draw_alpha_ptr=draw_alpha_rgb16_ptr; - break; - case IMGFMT_BGR24: - case IMGFMT_RGB24: - draw_alpha_ptr=draw_alpha_rgb24_ptr; - break; - case IMGFMT_BGR32: - case IMGFMT_RGB32: - draw_alpha_ptr=draw_alpha_rgb32_ptr; - break; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_Y800: - case IMGFMT_Y8: - draw_alpha_ptr=draw_alpha_yv12_ptr; - break; - case IMGFMT_YUY2: - draw_alpha_ptr=draw_alpha_yuy2_ptr; - break; - case IMGFMT_UYVY: - draw_alpha_ptr=draw_alpha_uyvy_ptr; - break; - default: - MSG_ERR("draw alpha for %s fourcc not implemented yet!",vo_format_name(fmt)); - draw_alpha_ptr=vo_draw_alpha_null; - break; - } -} - -OSD_Render::OSD_Render(unsigned fourcc) -{ -#ifdef FAST_OSD_TABLE - int i; - for(i=0;i<256;i++){ - fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3); - fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3); - } -#endif -/*FIXME the optimized stuff is a lie for 15/16bpp as they arent optimized yet*/ -// ordered per speed fasterst first -#ifdef __AVX__ -if(gCpuCaps.hasSSE41) -{ - MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_AVX; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_AVX; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_AVX; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_AVX; -} -else -#endif -#ifdef __SSE4_1__ -if(gCpuCaps.hasSSE41) -{ - MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE4; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE4; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE4; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE4; -} -else -#endif -#ifdef __SSSE3__ -if(gCpuCaps.hasSSSE3) -{ - MSG_V("Using SSSE3 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSSE3; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSSE3; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSSE3; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSSE3; -} -else -#endif -#ifdef __SSE3__ -if(gCpuCaps.hasSSE3) -{ - MSG_V("Using SSE3 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE3; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE3; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE3; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE3; -} -else -#endif -#ifdef __SSE2__ -if(gCpuCaps.hasSSE2) -{ - MSG_V("Using SSE2 Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE2; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE2; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE2; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE2; -} -else -#endif -#ifndef __x86_64__ -#ifdef __SSE__ -if(gCpuCaps.hasMMX2) -{ - MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_SSE; -} -else -#endif -//#ifdef __MMX__ -//if(gCpuCaps.hasMMX) -//{ -// MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); -// draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; -// draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; -// draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; -// draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_MMX; -//} -//else -//#endif -#endif -{ - MSG_V("Using generic OnScreenDisplay\n"); - draw_alpha_yv12_ptr=vo_draw_alpha_yv12_c; - draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_c; - draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_c; - draw_alpha_rgb32_ptr=vo_draw_alpha_rgb32_c; -} - draw_alpha_uyvy_ptr=vo_draw_alpha_uyvy_c; - draw_alpha_rgb15_ptr=vo_draw_alpha_rgb15_c; - draw_alpha_rgb16_ptr=vo_draw_alpha_rgb16_c; - get_draw_alpha(fourcc); -} - -OSD_Render::~OSD_Render(){} -} // namesapce mpxp Deleted: mplayerxp/libvo/osd_render.h =================================================================== --- mplayerxp/libvo/osd_render.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/osd_render.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,27 +0,0 @@ -#ifndef __MPLAYER_OSD_RENDER_H_INCLUDED -#define __MPLAYER_OSD_RENDER_H_INCLUDED 1 - -/* Generic alpha renderers for all YUV modes and RGB depths. */ -/* These are "reference implementations", should be optimized later (MMX, etc) */ -namespace mpxp { - class OSD_Render : public Opaque { - public: - OSD_Render(unsigned fourcc); - virtual ~OSD_Render(); - - void render(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize) const; - private: - void get_draw_alpha(unsigned fmt); - typedef void (* __FASTCALL__ draw_alpha_f)(int w,int h, const unsigned char* src, const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize); - draw_alpha_f draw_alpha_ptr; - draw_alpha_f draw_alpha_yv12_ptr; - draw_alpha_f draw_alpha_yuy2_ptr; - draw_alpha_f draw_alpha_uyvy_ptr; - draw_alpha_f draw_alpha_rgb24_ptr; - draw_alpha_f draw_alpha_rgb32_ptr; - draw_alpha_f draw_alpha_rgb15_ptr; - draw_alpha_f draw_alpha_rgb16_ptr; - }; -} // namespace mpxp - -#endif Deleted: mplayerxp/libvo/osd_render_template.h =================================================================== --- mplayerxp/libvo/osd_render_template.h 2012-12-11 16:06:04 UTC (rev 541) +++ mplayerxp/libvo/osd_render_template.h 2012-12-11 16:18:22 UTC (rev 542) @@ -1,318 +0,0 @@ -// Generic alpha renderers for all YUV modes and RGB depths. -// Optimized by Nick and Michael -// Code from Michael Niedermayer (mic...@gm...) is under GPL -#include "pvector/pvector.h" - -#ifdef HAVE_INT_PVECTOR -static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_load)(const any_t*__P) -{ - return *(const __m64 *)__P; -} -#undef _m_load -#define _m_load PVECTOR_RENAME(_m_load) - -static __inline __m64 __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_load_half)(const any_t*__P) -{ - return _mm_cvtsi32_si64 (*(const int *)__P); -} -#undef _m_load_half -#define _m_load_half PVECTOR_RENAME(_m_load_half) - -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_store)(any_t*__P, __m64 src) -{ - *(__m64 *)__P = src; -} -#undef _m_store -#define _m_store PVECTOR_RENAME(_m_store) - -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_store_half)(any_t*__P, __m64 src) -{ - *(int *)__P = _mm_cvtsi64_si32(src); -} -#undef _m_store_half -#define _m_store_half PVECTOR_RENAME(_m_store_half) - -stat... [truncated message content] |