From 6e9cbdc10448203e7c8b2de41447442fcc9f7bae Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 13 May 2009 02:58:57 +0000 Subject: whitespace cosmetics: Remove all trailing whitespace. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/aspecttest.c | 2 +- libvo/font_load.c | 28 +++--- libvo/font_load.h | 4 +- libvo/font_load_ft.c | 74 +++++++------- libvo/geometry.c | 6 +- libvo/gl_common.c | 6 +- libvo/gl_common.h | 4 +- libvo/gtf.c | 120 +++++++++++------------ libvo/gtf.h | 10 +- libvo/jpeg_enc.c | 100 +++++++++---------- libvo/jpeg_enc.h | 4 +- libvo/mga_common.c | 30 +++--- libvo/osd_template.c | 8 +- libvo/spuenc.c | 34 +++---- libvo/sub.c | 54 +++++----- libvo/vesa_lvo.c | 4 +- libvo/videodev_mjpeg.h | 2 +- libvo/vo_3dfx.c | 86 ++++++++-------- libvo/vo_aa.c | 46 ++++----- libvo/vo_bl.c | 38 ++++---- libvo/vo_caca.c | 6 +- libvo/vo_corevideo.h | 14 +-- libvo/vo_corevideo.m | 206 +++++++++++++++++++-------------------- libvo/vo_cvidix.c | 6 +- libvo/vo_dga.c | 34 +++---- libvo/vo_directfb2.c | 198 ++++++++++++++++++------------------- libvo/vo_directx.c | 246 +++++++++++++++++++++++----------------------- libvo/vo_dxr2.c | 42 ++++---- libvo/vo_dxr3.c | 120 +++++++++++------------ libvo/vo_fbdev2.c | 16 +-- libvo/vo_gif89a.c | 28 +++--- libvo/vo_gl.c | 8 +- libvo/vo_ivtv.c | 30 +++--- libvo/vo_jpeg.c | 34 +++---- libvo/vo_md5sum.c | 2 +- libvo/vo_mga.c | 6 +- libvo/vo_mpegpes.c | 12 +-- libvo/vo_null.c | 4 +- libvo/vo_png.c | 58 +++++------ libvo/vo_pnm.c | 16 +-- libvo/vo_quartz.c | 2 +- libvo/vo_quartz.h | 6 +- libvo/vo_s3fb.c | 46 ++++----- libvo/vo_sdl.c | 260 ++++++++++++++++++++++++------------------------- libvo/vo_tdfx_vid.c | 36 +++---- libvo/vo_v4l2.c | 26 ++--- libvo/vo_vdpau.c | 2 +- libvo/vo_vesa.c | 64 ++++++------ libvo/vo_winvidix.c | 80 +++++++-------- libvo/vo_x11.c | 8 +- libvo/vo_xover.c | 20 ++-- libvo/vo_xv.c | 4 +- libvo/vo_yuv4mpeg.c | 62 ++++++------ libvo/vo_zr.c | 120 +++++++++++------------ libvo/vo_zr2.c | 44 ++++----- libvo/vosub_vidix.c | 20 ++-- libvo/w32_common.c | 8 +- libvo/x11_common.c | 22 ++--- 58 files changed, 1288 insertions(+), 1288 deletions(-) (limited to 'libvo') diff --git a/libvo/aspecttest.c b/libvo/aspecttest.c index 9beebcf766..5fe6416fce 100644 --- a/libvo/aspecttest.c +++ b/libvo/aspecttest.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { return 1; } printf("monitor_aspect: %f\n",monitor_aspect); - aspect(&w,&h,z); + aspect(&w,&h,z); printf("new size: %dx%d\n",w,h); return 0; } diff --git a/libvo/font_load.c b/libvo/font_load.c index ad2311e37a..e7d36d8a2c 100644 --- a/libvo/font_load.c +++ b/libvo/font_load.c @@ -91,13 +91,13 @@ if ((dn = malloc(i+1))){ } 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; @@ -117,7 +117,7 @@ while(fgets(sor,1020,f)){ /* skip files that look like: TTF (0x00, 0x01), PFM (0x00, 0x01), PFB * (0x80, 0x01), PCF (0x01, 0x66), fon ("MZ"), gzipped (0x1f, 0x8b) */ - + if (first) { if (!sor[0] || sor[1] == 1 || (sor[0] == 'M' && sor[1] == 'Z') || (sor[0] == 0x1f && sor[1] == 0x8b) || (sor[0] == 1 && sor[1] == 0x66)) { mp_msg(MSGT_OSD, MSGL_ERR, "%s doesn't look like a bitmap font description, ignoring.\n", fname); @@ -125,7 +125,7 @@ while(fgets(sor,1020,f)){ } first = 0; } - + p[0]=d;++pdb; while(1){ int c=*s++; @@ -143,14 +143,14 @@ while(fgets(sor,1020,f)){ } } else { if(id==c){ id=0;continue;} // idezojel - + } *d=c;d++; ec=c; } if(d==sor2) continue; // skip empty lines *d=0; - + // printf("params=%d sor=%s\n",pdb,sor); // for(i=0;ifpath) @@ -174,7 +174,7 @@ while(fgets(sor,1020,f)){ desc->fpath=strdup(p[0]); continue; } - } else + } else #ifdef __AMIGAOS4__ #define FONT_PATH_SEP "" @@ -193,7 +193,7 @@ while(fgets(sor,1020,f)){ desc->fpath,p[1]); if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ free(cp); - if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) + if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) goto fail_out; snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", default_dir,p[1]); @@ -214,7 +214,7 @@ while(fgets(sor,1020,f)){ desc->fpath,p[1]); if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ free(cp); - if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) + if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) goto fail_out; snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", default_dir,p[1]); @@ -310,8 +310,8 @@ for(i=0;i<=fontdb;i++){ //x^=255; // invert if(x+y>255) x=255-y; // to avoid overflows - - //x=0; + + //x=0; //x=((x*f*(255-y))>>16); //x=((x*f*(255-y))>>16)+y; //x=(x*f)>>8;if(xbbox.yMax)/(double)face->units_per_EM*ppem+1; ymin = (double)(face->bbox.yMin)/(double)face->units_per_EM*ppem-1; - + width = ppem*(face->bbox.xMax-face->bbox.xMin)/face->units_per_EM+3+2*padding; if (desc->max_width < width) desc->max_width = width; width = ALIGN(width); @@ -222,7 +222,7 @@ static int check_font(font_desc_t *desc, float ppem, int padding, int pic_idx, mp_msg(MSGT_OSD, MSGL_ERR, "Something went wrong. Use the source!\n"); return -1; } - + height = ymax - ymin + 2*padding; if (height <= 0) { mp_msg(MSGT_OSD, MSGL_ERR, "Wrong bounding box, height <= 0 !\n"); @@ -231,7 +231,7 @@ static int check_font(font_desc_t *desc, float ppem, int padding, int pic_idx, if (desc->max_height < height) desc->max_height = height; desc->pic_b[pic_idx]->charheight = height; - + // fprintf(stderr, "font height2: %d\n", height); desc->pic_b[pic_idx]->baseline = ymax + padding; desc->pic_b[pic_idx]->padding = padding; @@ -239,7 +239,7 @@ static int check_font(font_desc_t *desc, float ppem, int padding, int pic_idx, desc->pic_b[pic_idx]->current_count = 0; bbuffer = NULL; - + desc->pic_b[pic_idx]->w = width; desc->pic_b[pic_idx]->h = height; desc->pic_b[pic_idx]->c = colors; @@ -261,7 +261,7 @@ static void outline( int msize) { int x, y; - + for (y = 0; yfont[c]; int error; - + // fprintf(stderr, "render_one_glyph %d\n", c); if (!desc->dynamic) return; @@ -507,7 +507,7 @@ void render_one_glyph(font_desc_t *desc, int c) if (desc->font[c] == -1) return; glyph_index = desc->glyph_index[c]; - + // load glyph error = FT_Load_Glyph(desc->faces[font], glyph_index, load_flags); if (error) { @@ -538,7 +538,7 @@ void render_one_glyph(font_desc_t *desc, int c) // fprintf(stderr, "glyph generated\n"); maxw = desc->pic_b[font]->charwidth; - + if (glyph->bitmap.width > maxw) { fprintf(stderr, "glyph too wide!\n"); } @@ -559,7 +559,7 @@ void render_one_glyph(font_desc_t *desc, int c) memset(desc->pic_b[font]->bmp+off, 0, increment); memset(desc->pic_a[font]->bmp+off, 0, increment); } - + abuffer = desc->pic_a[font]->bmp; bbuffer = desc->pic_b[font]->bmp; @@ -571,10 +571,10 @@ void render_one_glyph(font_desc_t *desc, int c) desc->pic_b[font]->baseline - glyph->top, desc->pic_b[font]->charwidth, desc->pic_b[font]->charheight, glyph->bitmap.width <= maxw ? glyph->bitmap.width : maxw); - + // fprintf(stderr, "glyph pasted\n"); FT_Done_Glyph((FT_Glyph)glyph); - + /* advance pen */ pen_xa = f266ToInt(slot->advance.x) + 2*desc->pic_b[font]->padding; if (pen_xa > maxw) pen_xa = maxw; @@ -594,7 +594,7 @@ void render_one_glyph(font_desc_t *desc, int c) desc->tables.o_size); } // fprintf(stderr, "fg: outline t = %lf\n", GetTimer()-t); - + if (desc->tables.g_r) { blur(abuffer+off, desc->tables.tmp, width, height, stride, desc->tables.gt2, desc->tables.g_r, @@ -650,19 +650,19 @@ static int prepare_font(font_desc_t *desc, FT_Face face, float ppem, int pic_idx // fprintf(stderr, "fg: w = %d, h = %d\n", desc->pic_a[pic_idx]->w, desc->pic_a[pic_idx]->h); return 0; - + } static int generate_tables(font_desc_t *desc, double thickness, double radius) { int width = desc->max_height; int height = desc->max_width; - + double A = log(1.0/base)/(radius*radius*2); int mx, my, i; double volume_diff, volume_factor = 0; unsigned char *omtp; - + desc->tables.g_r = ceil(radius); desc->tables.o_r = ceil(thickness); desc->tables.g_w = 2*desc->tables.g_r+1; @@ -683,7 +683,7 @@ static int generate_tables(font_desc_t *desc, double thickness, double radius) omtp = desc->tables.omt; desc->tables.tmp = malloc((width+1)*height*sizeof(short)); - + if (desc->tables.om==NULL || desc->tables.omt==NULL || desc->tables.tmp==NULL) { return -1; }; @@ -712,7 +712,7 @@ static int generate_tables(font_desc_t *desc, double thickness, double radius) } } } - + /* outline matrix */ for (my = 0; mytables.o_w; ++my) { for (mx = 0; mxtables.o_w; ++mx) { @@ -757,22 +757,22 @@ static int prepare_charset(char *charmap, char *encoding, FT_ULong *charset, FT_ int count = 0; int charset_size; iconv_t cd; - + // check if ucs-4 is available cd = iconv_open(charmap, charmap); if (cd==(iconv_t)-1) { mp_msg(MSGT_OSD, MSGL_ERR, "iconv doesn't know %s encoding. Use the source!\n", charmap); return -1; } - + iconv_close(cd); - + cd = iconv_open(charmap, encoding); if (cd==(iconv_t)-1) { mp_msg(MSGT_OSD, MSGL_ERR, "Unsupported encoding `%s', use iconv --list to list character sets known on your system.\n", encoding); return -1; } - + charset_size = 256 - first_char; for (i = 0; idynamic = 1; - + /* setup sane defaults */ desc->name = NULL; desc->fpath = NULL; @@ -866,21 +866,21 @@ static font_desc_t* init_font_desc(void) desc->start[i] = desc->width[i] = desc->font[i] = -1; for(i = 0; i < 16; i++) desc->pic_a[i] = desc->pic_b[i] = NULL; - + return desc; } void free_font_desc(font_desc_t *desc) { int i; - + if (!desc) return; // if (!desc->dynamic) return; // some vo_aa crap, better leaking than crashing if (desc->name) free(desc->name); if (desc->fpath) free(desc->fpath); - + for(i = 0; i < 16; i++) { if (desc->pic_a[i]) { if (desc->pic_a[i]->bmp) free(desc->pic_a[i]->bmp); @@ -903,14 +903,14 @@ void free_font_desc(font_desc_t *desc) for(i = 0; i < desc->face_cnt; i++) { FT_Done_Face(desc->faces[i]); } - + free(desc); } static int load_sub_face(const char *name, int face_index, FT_Face *face) { int err = -1; - + if (name) err = FT_New_Face(library, name, face_index, face); if (err) { @@ -940,12 +940,12 @@ static int load_osd_face(FT_Face *face) int kerning(font_desc_t *desc, int prevc, int c) { FT_Vector kern; - + if (!desc->dynamic) return 0; if (prevc < 0 || c < 0) return 0; if (desc->font[prevc] != desc->font[c]) return 0; if (desc->font[prevc] == -1 || desc->font[c] == -1) return 0; - FT_Get_Kerning(desc->faces[desc->font[c]], + FT_Get_Kerning(desc->faces[desc->font[c]], desc->glyph_index[prevc], desc->glyph_index[c], ft_kerning_default, &kern); @@ -968,7 +968,7 @@ font_desc_t* read_font_desc_ft(const char *fname, int face_index, int movie_widt int charset_size; int i, j; int unicode; - + float movie_size; float subtitle_font_ppem; @@ -1065,14 +1065,14 @@ gen_osd: err = prepare_font(desc, face, osd_font_ppem, desc->face_cnt-1, OSD_CHARSET_SIZE, osd_charset, osd_charcodes, 0, subtitle_font_thickness, subtitle_font_radius); - + if (err) { mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_CannotPrepareOSDFont); goto err_out; } err = generate_tables(desc, subtitle_font_thickness, subtitle_font_radius); - + if (err) { mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_CannotGenerateTables); goto err_out; @@ -1108,7 +1108,7 @@ err_out: int init_freetype(void) { int err; - + /* initialize freetype */ err = FT_Init_FreeType(&library); if (err) { @@ -1126,7 +1126,7 @@ int done_freetype(void) if (!using_freetype) return 0; - + err = FT_Done_FreeType(library); if (err) { mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_DoneFreeTypeFailed); diff --git a/libvo/geometry.c b/libvo/geometry.c index 7c6dc54087..189c351fc5 100644 --- a/libvo/geometry.c +++ b/libvo/geometry.c @@ -34,7 +34,7 @@ int geometry_xy_changed = 0; // xpos,ypos: position of the left upper corner // widw,widh: width and height of the window -// scrw,scrh: width and height of the current screen +// scrw,scrh: width and height of the current screen int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) { int width, height, xoff, yoff, xper, yper; @@ -81,7 +81,7 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", width, height, xoff, yoff, xper, yper); - + if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0); if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0); @@ -90,7 +90,7 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) width, height, xoff, yoff, xper, yper); mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); - + if (xoff != INT_MIN && xpos) *xpos = xoff; if (yoff != INT_MIN && ypos) *ypos = yoff; if (width > 0 && widw) *widw = width; diff --git a/libvo/gl_common.c b/libvo/gl_common.c index b89c7fac07..b9ded01436 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -45,7 +45,7 @@ void (APIENTRY *GenBuffers)(GLsizei, GLuint *); void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *); void (APIENTRY *BindBuffer)(GLenum, GLuint); -GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); +GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); GLboolean (APIENTRY *UnmapBuffer)(GLenum); void (APIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum); void (APIENTRY *CombinerParameterfv)(GLenum, const GLfloat *); @@ -192,7 +192,7 @@ int glFindFormat(uint32_t fmt, int *bpp, GLint *gl_texfmt, if (!gl_texfmt) gl_texfmt = &dummy3; if (!gl_format) gl_format = &dummy2; if (!gl_type) gl_type = &dummy2; - + *bpp = IMGFMT_IS_BGR(fmt)?IMGFMT_BGR_DEPTH(fmt):IMGFMT_RGB_DEPTH(fmt); *gl_texfmt = 3; switch (fmt) { @@ -1440,7 +1440,7 @@ void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h, #ifdef GL_WIN32 #include "w32_common.h" /** - * \brief little helper since wglGetProcAddress definition does not fit our + * \brief little helper since wglGetProcAddress definition does not fit our * getProcAddress * \param procName name of function to look up * \return function pointer returned by wglGetProcAddress diff --git a/libvo/gl_common.h b/libvo/gl_common.h index 6f9ec6f1e3..8f9ce55dab 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -51,7 +51,7 @@ /** * \defgroup glextdefines OpenGL extension defines - * + * * conditionally define all extension defines used. * vendor specific extensions should be marked as such * (e.g. _NV), _ARB is not used to ease readability. @@ -374,7 +374,7 @@ void swapGlBuffers(void); extern void (APIENTRY *GenBuffers)(GLsizei, GLuint *); extern void (APIENTRY *DeleteBuffers)(GLsizei, const GLuint *); extern void (APIENTRY *BindBuffer)(GLenum, GLuint); -extern GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); +extern GLvoid* (APIENTRY *MapBuffer)(GLenum, GLenum); extern GLboolean (APIENTRY *UnmapBuffer)(GLenum); extern void (APIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum); extern void (APIENTRY *CombinerParameterfv)(GLenum, const GLfloat *); diff --git a/libvo/gtf.c b/libvo/gtf.c index 4e8429fe9e..ce82d39a70 100644 --- a/libvo/gtf.c +++ b/libvo/gtf.c @@ -23,9 +23,9 @@ //Version 0.4 #include "config.h" -#include -#include -#include +#include +#include +#include #include "gtf.h" #undef GTF_DEBUG @@ -52,7 +52,7 @@ static void GetRoundedConstants(GTF_constants *c) c->m = (GTF_given_constants.k / 256) * GTF_given_constants.m; } -void GTF_calcTimings(double X,double Y,double freq, int type, +void GTF_calcTimings(double X,double Y,double freq, int type, int want_margins, int want_interlace,struct VesaCRTCInfoBlock *result ) { GTF_constants c; @@ -62,37 +62,37 @@ void GTF_calcTimings(double X,double Y,double freq, int type, double total_active_pixels, ideal_duty_cycle, blanking_time, H_total_pixels; double H_freq, pixel_freq,actual_V_frame_freq; double H_sync_start, H_sync_end, H_back_porch, H_front_porch, H_sync_width; - double V_back_porch, V_front_porch, V_sync_start, V_sync_end,V_sync_width; + double V_back_porch, V_front_porch, V_sync_start, V_sync_end,V_sync_width; double ideal_H_period; GetRoundedConstants(&c); - + pixel_freq = RR = freq; /* DETERMINE IF 1/2 LINE INTERLACE IS PRESENT */ - - interlace = 0; - + + interlace = 0; + if (want_interlace) { - RR = RR * 2; + RR = RR * 2; Y=Y/2; interlace = 0.5; } - + result->Flags = 0; - + if ((Y==300)||(Y==200)||(Y==240)) { Y*=2; result->Flags = VESA_CRTC_DOUBLESCAN; /* TODO: check if mode support */ - } - + } + /* DETERMINE NUMBER OF LINES IN V MARGIN */ /* DETERMINE NUMBER OF PIXELS IN H MARGIN [pixels] */ - + margin_left = margin_right = 0; margin_top = margin_bottom = 0; - + if (want_margins) { margin_top = margin_bottom = (c.margin_width / 100) * Y; margin_left = round(( X* c.margin_width/100)/c.char_cell_granularity) \ @@ -100,31 +100,31 @@ void GTF_calcTimings(double X,double Y,double freq, int type, margin_right = margin_left; DEBUG_PRINTF("margin_left_right : %f\n",margin_right) DEBUG_PRINTF("margin_top_bottom : %f\n",margin_top) - } - - /* FIND TOTAL NUMBER OF ACTIVE PIXELS (IMAGE + MARGIN) [pixels] */ - + } + + /* FIND TOTAL NUMBER OF ACTIVE PIXELS (IMAGE + MARGIN) [pixels] */ + total_active_pixels = margin_left + margin_right + X; DEBUG_PRINTF("total_active_pixels: %f\n",total_active_pixels) if (type == GTF_PF) { - ideal_H_period = ((c.c-100)+(sqrt(((100-c.c)*(100-c.c) )+(0.4*c.m*(total_active_pixels + margin_left + margin_right) / freq))))/2/c.m*1000; - + ideal_H_period = ((c.c-100)+(sqrt(((100-c.c)*(100-c.c) )+(0.4*c.m*(total_active_pixels + margin_left + margin_right) / freq))))/2/c.m*1000; + DEBUG_PRINTF("ideal_H_period: %f\n",ideal_H_period) - + /* FIND IDEAL BLANKING DUTY CYCLE FROM FORMULA [%] */ ideal_duty_cycle = c.c - (c.m * ideal_H_period /1000); DEBUG_PRINTF("ideal_duty_cycle: %f\n",ideal_duty_cycle) /* FIND BLANKING TIME (TO NEAREST CHAR CELL) [pixels] */ - + blanking_time = round(total_active_pixels * ideal_duty_cycle \ / (100-ideal_duty_cycle) / (2*c.char_cell_granularity)) \ * (2*c.char_cell_granularity); DEBUG_PRINTF("blanking_time : %f\n",blanking_time ) - /* FIND TOTAL NUMBER OF PIXELS IN A LINE [pixels] */ + /* FIND TOTAL NUMBER OF PIXELS IN A LINE [pixels] */ H_total_pixels = total_active_pixels + blanking_time ; DEBUG_PRINTF("H_total_pixels: %f\n",H_total_pixels) H_freq = freq / H_total_pixels * 1000; @@ -133,20 +133,20 @@ void GTF_calcTimings(double X,double Y,double freq, int type, DEBUG_PRINTF("actual_H_period: %f\n",actual_H_period) sync_plus_BP = round(H_freq * c.min_Vsync_BP/1000); // sync_plus_BP = round( freq / H_total_pixels * c.min_Vsync_BP); - + DEBUG_PRINTF("sync_plus_BP: %f\n",sync_plus_BP) - } else if (type == GTF_VF) + } else if (type == GTF_VF) { - + /* ESTIMATE HORIZ. PERIOD [us] */ estimated_H_period = (( 1/RR ) - c.min_Vsync_BP/1000000 ) / (Y + (2 * margin_top) + c.min_front_porch + interlace) * 1000000; - + DEBUG_PRINTF("estimated_H_period: %f\n",estimated_H_period) /* FIND NUMBER OF LINES IN (SYNC + BACK PORCH) [lines] */ - + sync_plus_BP = round( c.min_Vsync_BP / estimated_H_period ); DEBUG_PRINTF("sync_plus_BP: %f\n",sync_plus_BP) @@ -155,9 +155,9 @@ void GTF_calcTimings(double X,double Y,double freq, int type, sync_plus_BP = round(freq * c.min_Vsync_BP/1000); DEBUG_PRINTF("sync_plus_BP: %f\n",sync_plus_BP) } - - - + + + /* FIND TOTAL NUMBER OF LINES IN VERTICAL FIELD */ V_total_lines_field = sync_plus_BP+interlace+margin_bottom+margin_top+Y+c.min_front_porch; @@ -166,11 +166,11 @@ void GTF_calcTimings(double X,double Y,double freq, int type, if (type == GTF_VF) { /* ESTIMATE VERTICAL FIELD RATE [hz] */ - + estimated_V_field_rate = 1 / estimated_H_period / V_total_lines_field * 1000000; DEBUG_PRINTF(" estimated_V_field_rate: %f\n", estimated_V_field_rate) /* FIND ACTUAL HORIZONTAL PERIOD [us] */ - + actual_H_period = estimated_H_period / (RR / estimated_V_field_rate); DEBUG_PRINTF("actual_H_period: %f\n",actual_H_period) /* FIND ACTUAL VERTICAL FIELD FREQUENCY [Hz] */ @@ -211,24 +211,24 @@ void GTF_calcTimings(double X,double Y,double freq, int type, { /* Hz */ actual_V_field_freq = freq / V_total_lines_field * 1000; - DEBUG_PRINTF("actual_V_field_freq: %f\n",actual_V_field_freq) + DEBUG_PRINTF("actual_V_field_freq: %f\n",actual_V_field_freq) } - - + + actual_V_frame_freq = actual_V_field_freq; /* FIND ACTUAL VERTICAL FRAME FREQUENCY [Hz]*/ - + if (want_interlace) actual_V_frame_freq = actual_V_field_freq / 2; DEBUG_PRINTF("actual_V_frame_freq: %f\n",actual_V_frame_freq) - + // V_freq = actual_V_frame_freq; -// DEBUG_PRINTF("V_freq %f\n",V_freq) +// DEBUG_PRINTF("V_freq %f\n",V_freq) + - if (!(type == GTF_PF)) - { - /* FIND TOTAL NUMBER OF PIXELS IN A LINE [pixels] */ + { + /* FIND TOTAL NUMBER OF PIXELS IN A LINE [pixels] */ H_total_pixels = total_active_pixels + blanking_time ; DEBUG_PRINTF("H_total_pixels: %f\n",H_total_pixels) if (type == GTF_VF) @@ -245,15 +245,15 @@ void GTF_calcTimings(double X,double Y,double freq, int type, } /* FIND ACTUAL HORIZONTAL FREQUENCY [KHz] */ - + H_freq = 1000 / actual_H_period; DEBUG_PRINTF("H_freq %f\n",H_freq) - + } /* FIND NUMBER OF LINES IN BACK PORCH [lines] */ - + BP = sync_plus_BP - c.Vsync_need; DEBUG_PRINTF("BP: %f\n",BP) @@ -264,27 +264,27 @@ void GTF_calcTimings(double X,double Y,double freq, int type, /* FIND FRONT H PORCH(TO NEAREST CHAR CELL) */ H_front_porch = (blanking_time/2) - H_sync_width; - DEBUG_PRINTF("H_front_porch %f\n",H_front_porch) + DEBUG_PRINTF("H_front_porch %f\n",H_front_porch) /* FIND BACK H PORCH(TO NEAREST CHAR CELL) */ H_back_porch = H_sync_width + H_front_porch; - DEBUG_PRINTF("H_back_porch%f\n",H_back_porch) + DEBUG_PRINTF("H_back_porch%f\n",H_back_porch) H_sync_start = H_total_pixels - (H_sync_width + H_back_porch); DEBUG_PRINTF("H_sync_start %f\n",H_sync_start) H_sync_end = H_total_pixels - H_back_porch; - DEBUG_PRINTF("H_sync_end %f\n",H_sync_end) - + DEBUG_PRINTF("H_sync_end %f\n",H_sync_end) + V_back_porch = interlace + BP; DEBUG_PRINTF("V_back_porch%f\n",V_back_porch) V_front_porch = interlace + c.min_front_porch; - DEBUG_PRINTF("V_front_porch%f\n",V_front_porch) - + DEBUG_PRINTF("V_front_porch%f\n",V_front_porch) + V_sync_width = c.Vsync_need; V_sync_start = V_total_lines_field - (V_sync_width + V_back_porch); - DEBUG_PRINTF("V_sync_start %f\n",V_sync_start) + DEBUG_PRINTF("V_sync_start %f\n",V_sync_start) V_sync_end = V_total_lines_field - V_back_porch; - DEBUG_PRINTF("V_sync_end %f\n",V_sync_end) - + DEBUG_PRINTF("V_sync_end %f\n",V_sync_end) + result->hTotal = H_total_pixels; result-> hSyncStart = H_sync_start; /* Horizontal sync start in pixels */ result-> hSyncEnd = H_sync_end; /* Horizontal sync end in pixels */ @@ -292,15 +292,15 @@ void GTF_calcTimings(double X,double Y,double freq, int type, result-> vSyncStart = V_sync_start; /* Vertical sync start in lines */ result-> vSyncEnd = V_sync_end; /* Vertical sync end in lines */ result-> Flags = (result->Flags)|VESA_CRTC_HSYNC_NEG; /* Flags (Interlaced, Double Scan etc) */ - - if (want_interlace) + + if (want_interlace) { result->Flags = (result->Flags) | VESA_CRTC_INTERLACED; } - + result-> PixelClock = pixel_freq*1000000; /* Pixel clock in units of Hz */ result-> RefreshRate = actual_V_frame_freq*100;/* Refresh rate in units of 0.01 Hz*/ - + } diff --git a/libvo/gtf.h b/libvo/gtf.h index 057d7b352e..837fc24e69 100644 --- a/libvo/gtf.h +++ b/libvo/gtf.h @@ -21,11 +21,11 @@ #include -#define GTF_VF 0 -#define GTF_HF 1 +#define GTF_VF 0 +#define GTF_HF 1 #define GTF_PF 2 - + typedef struct { double Vsync_need; /* Number of lines for vert sync (default 3) */ double min_Vsync_BP; /* Minimum vertical sync + back porch (us) (default 550)*/ @@ -39,7 +39,7 @@ typedef struct { double m; /* Blanking formula gradient (default 600)*/ } GTF_constants; -//#ifndef __VESA_VBELIB_INCLUDED__ +//#ifndef __VESA_VBELIB_INCLUDED__ // struct VesaCRTCInfoBlock { // unsigned short hTotal; /* Horizontal total in pixels */ // unsigned short hSyncStart; /* Horizontal sync start in pixels */ @@ -51,7 +51,7 @@ typedef struct { // unsigned long PixelClock; /* Pixel clock in units of Hz */ // unsigned short RefreshRate;/* Refresh rate in units of 0.01 Hz*/ // unsigned char Reserved[40];/* remainder of CRTCInfoBlock*/ -//}__attribute__ ((packed)); +//}__attribute__ ((packed)); //#define VESA_CRTC_DOUBLESCAN 0x01 //#define VESA_CRTC_INTERLACED 0x02 diff --git a/libvo/jpeg_enc.c b/libvo/jpeg_enc.c index 6cf00f7e56..5356d4b26d 100644 --- a/libvo/jpeg_enc.c +++ b/libvo/jpeg_enc.c @@ -33,7 +33,7 @@ #include #include "config.h" #include "mp_msg.h" -/* We need this #define because we need ../libavcodec/common.h to #define +/* We need this #define because we need ../libavcodec/common.h to #define * be2me_32, otherwise the linker will complain that it doesn't exist */ #define HAVE_AV_CONFIG_H #include "libavcodec/avcodec.h" @@ -61,7 +61,7 @@ static const unsigned short aanscales[64] = { 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 }; -static void convert_matrix(MpegEncContext *s, int (*qmat)[64], +static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax) { @@ -72,9 +72,9 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], if (s->dsp.fdct == ff_jpeg_fdct_islow) { for (i = 0; i < 64; i++) { const int j = s->dsp.idct_permutation[i]; - /* 16 <= qscale * quant_matrix[i] <= 7905 + /* 16 <= qscale * quant_matrix[i] <= 7905 * 19952 <= aanscales[i] * \ - * qscale * quant_matrix[i] <= 205026 + * qscale * quant_matrix[i] <= 205026 * (1<<36)/19952 >= (1<<36)/(aanscales[i] * \ * qscale * quant_matrix[i]) >= (1<<36)/249205025 * 3444240 >= (1<<36)/(aanscales[i] * @@ -89,8 +89,8 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], /* 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[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 11)) / + + qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 11)) / (aanscales[i] * qscale * quant_matrix[j])); } } else { @@ -111,7 +111,7 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], } } -static inline void encode_dc(MpegEncContext *s, int val, +static inline void encode_dc(MpegEncContext *s, int val, uint8_t *huff_size, uint16_t *huff_code) { int mant, nbits; @@ -124,16 +124,16 @@ static inline void encode_dc(MpegEncContext *s, int val, val = -val; mant--; } - + /* compute the log (XXX: optimize) */ nbits = 0; while (val != 0) { val = val >> 1; nbits++; } - + put_bits(&s->pb, huff_size[nbits], huff_code[nbits]); - + put_bits(&s->pb, nbits, mant & ((1 << nbits) - 1)); } } @@ -145,7 +145,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n) MJpegContext *m = s->mjpeg_ctx; uint8_t *huff_size_ac; uint16_t *huff_code_ac; - + /* DC coef */ component = (n <= 3 ? 0 : n - 4 + 1); dc = block[0]; /* overflow is impossible */ @@ -160,9 +160,9 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n) 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++) { @@ -180,7 +180,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n) val = -val; mant--; } - + /* compute the log (XXX: optimize) */ nbits = 0; while (val != 0) { @@ -190,7 +190,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n) code = (run << 4) | nbits; put_bits(&s->pb, huff_size_ac[code], huff_code_ac[code]); - + put_bits(&s->pb, nbits, mant & ((1 << nbits) - 1)); run = 0; } @@ -210,7 +210,7 @@ static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index for(i=0; i<=last_index; i++){ const int j = s->intra_scantable.permutated[i]; int level = block[j]; - + if (level>maxlevel) level=maxlevel; else if(levelhuff_code_ac_chrominance[0]); } else { /* we trick encode_block here so that it uses - * chrominance huffman tables instead of luminance ones + * 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[2], 4); encode_block(j->s, j->s->block[3], 5); } } @@ -252,13 +252,13 @@ static void zr_mjpeg_encode_mb(jpeg_enc_t *j) { /* 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, + * 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 */ @@ -271,13 +271,13 @@ static void zr_mjpeg_encode_mb(jpeg_enc_t *j) { /* 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, +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; mp_msg(MSGT_VO, MSGL_V, "JPEnc init: %dx%d %d %d %d %d %d %d\n", - w, h, y_psize, y_rsize, u_psize, + w, h, y_psize, y_rsize, u_psize, u_rsize, v_psize, v_rsize); j = av_malloc(sizeof(jpeg_enc_t)); @@ -291,11 +291,11 @@ jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, } /* info on how to access the pixels */ - j->y_ps = y_psize; - j->u_ps = u_psize; + 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->y_rs = y_rsize; + j->u_rs = u_rsize; j->v_rs = v_rsize; j->s->width = w; @@ -355,15 +355,15 @@ jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, j->s->mb_intra = 1; j->s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0]; - for (i = 1; i < 64; i++) + for (i = 1; i < 64; i++) j->s->intra_matrix[i] = av_clip_uint8( (ff_mpeg1_default_intra_matrix[i]*j->s->qscale) >> 3); - convert_matrix(j->s, j->s->q_intra_matrix, j->s->q_intra_matrix16, + convert_matrix(j->s, j->s->q_intra_matrix, j->s->q_intra_matrix16, j->s->intra_matrix, j->s->intra_quant_bias, 8, 8); return j; -} +} -int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, +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, overflow; short int *dest; @@ -376,8 +376,8 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, j->s->header_bits = put_bits_count(&j->s->pb); - j->s->last_dc[0] = 128; - j->s->last_dc[1] = 128; + 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++) { @@ -385,7 +385,7 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, /* 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 + + 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++) { @@ -395,7 +395,7 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, dest += 8; source += j->y_rs; } - source = mb_y * 8 * 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++) { @@ -406,7 +406,7 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, source += j->y_rs; } if (!j->bw && j->cheap_upsample) { - source = mb_y*4*j->u_rs + + 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++) { @@ -417,7 +417,7 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, dest += 16; source += j->u_rs; } - source = mb_y*4*j->v_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++) { @@ -429,20 +429,20 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, source += j->u_rs; } } else if (!j->bw && !j->cheap_upsample) { - source = mb_y*8*j->u_rs + + 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++) + 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 + + 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++) + for (k = 0; k < 8; k++) dest[k] = source[k*j->v_ps]; dest += 8; source += j->u_rs; @@ -450,27 +450,27 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, } emms_c(); /* is this really needed? */ - j->s->block_last_index[0] = - j->s->dct_quantize(j->s, j->s->block[0], + j->s->block_last_index[0] = + j->s->dct_quantize(j->s, j->s->block[0], 0, 8, &overflow); - if (overflow) clip_coeffs(j->s, j->s->block[0], + if (overflow) clip_coeffs(j->s, j->s->block[0], j->s->block_last_index[0]); - j->s->block_last_index[1] = - j->s->dct_quantize(j->s, j->s->block[1], + j->s->block_last_index[1] = + j->s->dct_quantize(j->s, j->s->block[1], 1, 8, &overflow); - if (overflow) clip_coeffs(j->s, j->s->block[1], + if (overflow) clip_coeffs(j->s, j->s->block[1], j->s->block_last_index[1]); if (!j->bw) { j->s->block_last_index[4] = j->s->dct_quantize(j->s, j->s->block[2], 4, 8, &overflow); - if (overflow) clip_coeffs(j->s, j->s->block[2], + if (overflow) clip_coeffs(j->s, j->s->block[2], j->s->block_last_index[2]); j->s->block_last_index[5] = j->s->dct_quantize(j->s, j->s->block[3], 5, 8, &overflow); - if (overflow) clip_coeffs(j->s, j->s->block[3], + if (overflow) clip_coeffs(j->s, j->s->block[3], j->s->block_last_index[3]); } zr_mjpeg_encode_mb(j); @@ -478,12 +478,12 @@ int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data, } emms_c(); ff_mjpeg_encode_picture_trailer(j->s); - flush_put_bits(&j->s->pb); + flush_put_bits(&j->s->pb); //FIXME //if (j->s->mjpeg_write_tables == 1) // j->s->mjpeg_write_tables = 0; - + return put_bits_ptr(&(j->s->pb)) - j->s->pb.buf; } diff --git a/libvo/jpeg_enc.h b/libvo/jpeg_enc.h index 786d664a41..c3255ad99d 100644 --- a/libvo/jpeg_enc.h +++ b/libvo/jpeg_enc.h @@ -40,11 +40,11 @@ typedef struct { int v_rs; } jpeg_enc_t; -jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize, +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, +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); diff --git a/libvo/mga_common.c b/libvo/mga_common.c index 6981123eb8..13b73d1b45 100644 --- a/libvo/mga_common.c +++ b/libvo/mga_common.c @@ -100,11 +100,11 @@ draw_slice_g400(uint8_t *image[], int stride[], int w,int h,int x,int y) dest = vid_data + bespitch * y + x; mem2agpcpy_pic(dest, image[0], w, h, bespitch, stride[0]); - + w/=2;h/=2;x/=2;y/=2; dest = vid_data + bespitch*mga_vid_config.src_height + bespitch2 * y + x; - dest2= dest + bespitch2*mga_vid_config.src_height / 2; + dest2= dest + bespitch2*mga_vid_config.src_height / 2; if(mga_vid_config.format==MGA_VID_FORMAT_YV12){ // mga_vid's YV12 assumes Y,U,V order (insteda of Y,V,U) :( @@ -265,7 +265,7 @@ static int control(uint32_t request, void *data, ...) if (ioctl(f,MGA_VID_GET_LUMA,&prev)) { perror("Error in mga_vid_config ioctl()"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); + mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); return VO_FALSE; } @@ -274,7 +274,7 @@ static int control(uint32_t request, void *data, ...) va_start(ap, data); value = va_arg(ap, int); va_end(ap); - + // printf("value: %d -> ",value); value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127 // printf("%d \n",value); @@ -283,7 +283,7 @@ static int control(uint32_t request, void *data, ...) luma = (prev&0xFFFF0000)|(value&0xFFFF); else luma = (prev&0xFFFF)|(value<<16); - + if (ioctl(f,MGA_VID_SET_LUMA,luma)) { perror("Error in mga_vid_config ioctl()"); mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotSetLumaValuesFromTheKernelModule); @@ -299,7 +299,7 @@ static int control(uint32_t request, void *data, ...) int * value; short val; uint32_t luma; - + if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE; if (ioctl(f,MGA_VID_GET_LUMA,&luma)) { @@ -307,12 +307,12 @@ static int control(uint32_t request, void *data, ...) mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); return VO_FALSE; } - + if ( !strcmp( data,"contrast" ) ) val=(luma & 0xFFFF); else val=(luma >> 16); - + va_start(ap, data); value = va_arg(ap, int*); va_end(ap); @@ -321,7 +321,7 @@ static int control(uint32_t request, void *data, ...) return VO_TRUE; } - + #ifndef VO_XMGA case VOCTRL_FULLSCREEN: if (vo_screenwidth && vo_screenheight) @@ -356,7 +356,7 @@ static int control(uint32_t request, void *data, ...) { // int old_y = vo_panscan_y; panscan_calc(); -// if ( old_y != vo_panscan_y ) +// if ( old_y != vo_panscan_y ) set_window(); } return VO_TRUE; @@ -383,7 +383,7 @@ static int mga_init(int width,int height,unsigned int format){ case IMGFMT_UYVY: mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2; mga_vid_config.format=MGA_VID_FORMAT_UYVY; break; - default: + default: mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_InvalidOutputFormat,format); return -1; } @@ -396,7 +396,7 @@ static int mga_init(int width,int height,unsigned int format){ mga_vid_config.dest_height= height; mga_vid_config.colkey_on=0; - + mga_vid_config.num_frames=(vo_directrendering && !vo_doublebuffering)?1:3; mga_vid_config.version=MGA_VID_VERSION; @@ -434,7 +434,7 @@ static int mga_init(int width,int height,unsigned int format){ return -1; } } - + mp_msg(MSGT_VO,MSGL_V,"[MGA] Using %d buffers.\n",mga_vid_config.num_frames); frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0); @@ -477,10 +477,10 @@ static int preinit(const char *vo_subdevice) mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldntOpen,devname); return -1; } - + // check whether the mga_vid driver has the same // version as we expect - + ioctl(f,MGA_VID_GET_VERSION,&ver); if(MGA_VID_VERSION != ver) { diff --git a/libvo/osd_template.c b/libvo/osd_template.c index 954135c55a..e59b4e5681 100644 --- a/libvo/osd_template.c +++ b/libvo/osd_template.c @@ -56,7 +56,7 @@ static inline void RENAME(vo_draw_alpha_yv12)(int w,int h, unsigned char* src, u "movq %%mm5, %%mm7\n\t" "psllw $8, %%mm5\n\t" //FF00FF00FF00 "psrlw $8, %%mm4\n\t" //00FF00FF00FF - ::); + ::); #endif for(y=0;y * * (modified a bit to work with the dxr3 driver...4/2/2002 cg) - * + * * Based on the hard work of: * * Samuel Hocevar and Michel Lespinasse @@ -48,13 +48,13 @@ encode_do_control(int x,int y, encodedata* ed, pixbuf* pb) { /* the format of this is well described by a page: * http://members.aol.com/mpucoder/DVD/spu.html - * - * note I changed the layout of commands to turn off the subpic as the - * first command, and then turn on the new subpic...this is so we can - * leave the subpic on for an arbitrary ammount of time as controlled by + * + * note I changed the layout of commands to turn off the subpic as the + * first command, and then turn on the new subpic...this is so we can + * leave the subpic on for an arbitrary ammount of time as controlled by * mplayer (ie when we turn on the subpic we don't know how long it should * stay on when using mplayer). - * with this layout we turn off the last subpic as we are turning on the + * with this layout we turn off the last subpic as we are turning on the * new one. * The original hd it turn on the subpic, and delay the turn off command using * the durration/delay feature. @@ -65,7 +65,7 @@ encode_do_control(int x,int y, encodedata* ed, pixbuf* pb) { // ed->data[i++]= 0x00; // ed->data[i++]= 0x00; //durration before turn off command occurs //in 90000/1024 units - + /* x1 */ // x1=i+4; // ed->data[i++]= x1 >> 8;//location of next command block @@ -73,8 +73,8 @@ encode_do_control(int x,int y, encodedata* ed, pixbuf* pb) { /* finish it */ // ed->data[i++]= 0x02;//turn off command // ed->data[i++]= 0xff;//end of command block - x1= i; //marker for last command block address - + x1= i; //marker for last command block address + /* display duration... */ ed->data[i++]= 0x00; ed->data[i++]= 0x00; //durration before turn on command occurs @@ -92,9 +92,9 @@ encode_do_control(int x,int y, encodedata* ed, pixbuf* pb) { ed->data[i++]= 0x08; ed->data[i++]= 0x7f; /* - * The palette is a coded index (one of 16) 0 is black, 0xf is white + * The palette is a coded index (one of 16) 0 is black, 0xf is white * (unless you screw with the default palette) - * for what I am doing I only use white. + * for what I am doing I only use white. * 7 is lt grey, and 8 is dk grey... * */ /* 0x04: transparency info (reversed) */ @@ -130,11 +130,11 @@ encode_do_control(int x,int y, encodedata* ed, pixbuf* pb) { /* x0 */ ed->data[2]= (controlstart) >> 8; ed->data[3]= (controlstart) & 0xff; - + /* packet size */ ed->data[0]= i >> 8; ed->data[1]= i & 0xff; - + ed->count= i; } @@ -179,7 +179,7 @@ encode_do_row( encodedata* ed, pixbuf* pb, int row ) { unsigned char* pix= pb->pixels + row * pb->x; int color= *pix; int n= 0; /* the number of pixels of this color */ - + while( i++ < pb->x ) { /* FIXME: watch this space for EOL */ if( *pix != color || n == 255 ) { @@ -233,7 +233,7 @@ pixbuf_encode_rle(int x, int y, int w, int h, char *inbuf, int stride,encodedat void pixbuf_load_xpm( pixbuf* pb, char* xpm[] ) { - int colors, chrs, l, n; + int colors, chrs, l, n; char c[4], table[256]; unsigned char *b, *i; @@ -250,7 +250,7 @@ pixbuf_load_xpm( pixbuf* pb, char* xpm[] ) { fprintf( stderr, "the size is excesive\n"); exit (-1); } - + for( l=0; lrgb[l]); if( n < 2 ) { @@ -262,7 +262,7 @@ pixbuf_load_xpm( pixbuf* pb, char* xpm[] ) { pb->pixels= malloc( pb->x * pb->y ); b= pb->pixels; - + for( l= colors+1; l <= pb->y + colors; l++ ) { i= xpm[l]; while( (int)*i) { diff --git a/libvo/sub.c b/libvo/sub.c index 597c121498..665c935b34 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -132,7 +132,7 @@ static void draw_alpha_buf(mp_osd_obj_t* obj, int x0,int y0, int w,int h, unsign x0, x0+w, y0, y0+h); return; } - + for (i = 0; i < h; i++) { for (j = 0; j < w; j++, b++, a++, bs++, as++) { if (*b < *bs) *b = *bs; @@ -207,7 +207,7 @@ inline static void vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){ x+=vo_font->width[c]+vo_font->charspace; h=get_height(c,h); } - + obj->bbox.x2=x-vo_font->charspace; obj->bbox.y2=obj->bbox.y1+h; obj->flags|=OSDFLAG_BBOX; @@ -263,7 +263,7 @@ inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys, int left_ obj->bbox.y1 = obj->y = sy; obj->bbox.x2 = ex; obj->bbox.y2 = ey; - + alloc_buf (obj); len = obj->stride * (obj->bbox.y2 - obj->bbox.y1); memset (obj->bitmap_buffer, OSD_NAV_BOX_ALPHA, len); @@ -465,7 +465,7 @@ TODO: support for separated graphics symbols (where six rectangles does not touc ********** *********** (0:hm/3) *** **** **** **** -*** 1 **** **** 2 **** +*** 1 **** **** 2 **** *** **** **** **** ********** *********** ********** *********** @@ -482,11 +482,11 @@ TODO: support for separated graphics symbols (where six rectangles does not touc ********** *********** (hm-hm/3:hm/3) *** **** **** **** *** 5 **** **** 6 **** -*** **** **** **** -********** *********** +*** **** **** **** +********** *********** ********** *********** -*/ +*/ if(tc.gfx>1){ //separated gfx for(b=0;b<6;b++){ color=(tc.unicode>>b)&1?tc.fg:tc.bg; @@ -522,29 +522,29 @@ int vo_osd_progbar_type=-1; int vo_osd_progbar_value=100; // 0..256 // if we have n=256 bars then OSD progbar looks like below -// +// // 0 1 2 3 ... 256 <= vo_osd_progbar_value // | | | | | // [ === === === ... === ] -// +// // the above schema is rescalled to n=elems bars inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; - + if(vo_osd_progbar_type<0 || !vo_font){ obj->flags&=~OSDFLAG_VISIBLE; return; } - + render_one_glyph(vo_font, OSD_PB_START); render_one_glyph(vo_font, OSD_PB_END); render_one_glyph(vo_font, OSD_PB_0); render_one_glyph(vo_font, OSD_PB_1); render_one_glyph(vo_font, vo_osd_progbar_type); - // calculate bbox corners: + // calculate bbox corners: { int h=0; int y=(dys-vo_font->height)/2; int delimw=vo_font->width[OSD_PB_START] @@ -574,7 +574,7 @@ inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ } alloc_buf(obj); - + { int minw = vo_font->width[OSD_PB_START]+vo_font->width[OSD_PB_END]+vo_font->width[OSD_PB_0]; if (vo_osd_progbar_type>0 && vo_font->font[vo_osd_progbar_type]>=0){ @@ -582,7 +582,7 @@ inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ } if (obj->bbox.x2 - obj->bbox.x1 < minw) return; // space too small, don't render anything } - + // render it: { unsigned char *s; unsigned char *sa; @@ -601,7 +601,7 @@ inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ if (ev & 0xFF) mark++; if (mark>elems) mark=elems; } - + // printf("osd.progbar width=%d xpos=%d\n",width,x); @@ -615,7 +615,7 @@ inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ vo_font->pic_a[font]->bmp+vo_font->start[c], vo_font->pic_a[font]->w); } - + c=OSD_PB_START; if ((font=vo_font->font[c])>=0) draw_alpha_buf(obj,x,y, @@ -678,14 +678,14 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ int xmin=dxs,xmax=0; int h,lasth; int xtblc, utblc; - + obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; if(!vo_sub || !sub_font || !sub_visibility || (sub_font->font[40]<0)){ obj->flags&=~OSDFLAG_VISIBLE; return; } - + obj->bbox.y2=obj->y=dys; obj->params.subtitle.lines=0; @@ -704,7 +704,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ while (l) { xsize = -sub_font->charspace; l--; - t=vo_sub->text[i++]; + t=vo_sub->text[i++]; char_position = 0; char_seq = calloc(strlen(t), sizeof(int)); @@ -749,7 +749,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ prevc = c; } else { int delta_xsize = sub_font->width[c] + sub_font->charspace + kerning(sub_font, prevc, c); - + if (xsize + delta_xsize <= dxs) { if (!x) x = 1; prevc = c; @@ -940,7 +940,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ } if(obj->params.subtitle.lines) obj->y = dys - ((obj->params.subtitle.lines - 1) * sub_font->height + sub_font->pic_a[sub_font->font[40]]->h); - + // free memory if (otp_sub != NULL) { for (tmp = otp_sub->ott; tmp->next != NULL; free(tmp->prev)) { @@ -949,13 +949,13 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ } free(tmp->text); free(tmp); - + for(pmt = otp_sub; pmt->next != NULL; free(pmt->prev)) { pmt = pmt->next; } free(pmt); } - + } /// vertical alignment h = dys - obj->y; @@ -984,7 +984,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ alloc_buf(obj); y = obj->y; - + obj->alignment = 0; switch(vo_sub->alignment) { case SUB_ALIGNMENT_BOTTOMLEFT: @@ -1038,7 +1038,7 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ y+=sub_font->height; } } - + } inline static void vo_update_spudec_sub(mp_osd_obj_t* obj, int dxs, int dys) @@ -1130,7 +1130,7 @@ int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border, prev_dys = dys; defer_counter = 0; } else { - if (!vo_font) + if (!vo_font) load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor); if (!sub_font) { if (sub_font_name) @@ -1244,7 +1244,7 @@ void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){ mp_osd_obj_t* obj=vo_osd_list; vo_update_osd(dxs,dys); while(obj){ - if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE)) && + if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE)) && (obj->flags&OSDFLAG_OLD_BBOX)){ int w=obj->old_bbox.x2-obj->old_bbox.x1; int h=obj->old_bbox.y2-obj->old_bbox.y1; diff --git a/libvo/vesa_lvo.c b/libvo/vesa_lvo.c index 53779a1c13..a7b1120ceb 100644 --- a/libvo/vesa_lvo.c +++ b/libvo/vesa_lvo.c @@ -154,7 +154,7 @@ int vlvo_init(unsigned src_width,unsigned src_height, /*clear the buffer*/ memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames); - return 0; + return 0; } void vlvo_term( void ) @@ -242,7 +242,7 @@ void vlvo_flip_page(void) ioctl(lvo_handler,MGA_VID_FSEL,&next_frame); next_frame=(next_frame+1)%mga_vid_config.num_frames; lvo_mem=frames[next_frame]; - } + } } #if 0 diff --git a/libvo/videodev_mjpeg.h b/libvo/videodev_mjpeg.h index 35c8b41d2f..f6c52057d7 100644 --- a/libvo/videodev_mjpeg.h +++ b/libvo/videodev_mjpeg.h @@ -24,7 +24,7 @@ #include -/* This is identical with the mgavideo internal params struct, +/* This is identical with the mgavideo internal params struct, please tell me if you change this struct here ! vidDesktopStartAddr = vidpage0offset; XF86DGADirectVideo(display,0,0); } -static void -sighup(int foo) +static void +sighup(int foo) { //reg_IO->vidDesktopStartAddr = vidpage0offset; XF86DGADirectVideo(display,0,0); exit(0); } -static void -restore_regs(voodoo_2d_reg *regs) +static void +restore_regs(voodoo_2d_reg *regs) { reg_2d->commandExtra = regs->commandExtra; reg_2d->clip0Min = regs->clip0Min; @@ -141,8 +141,8 @@ restore_regs(voodoo_2d_reg *regs) reg_2d->command = 0; } -static uint32_t -create_window(Display *display, char *title) +static uint32_t +create_window(Display *display, char *title) { int screen; unsigned int fg, bg; @@ -167,7 +167,7 @@ create_window(Display *display, char *title) XGetWindowAttributes(display, DefaultRootWindow(display), &attribs); bpp = attribs.depth; - if (bpp != 16) + if (bpp != 16) { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Only16BppSupported); exit(-1); @@ -200,7 +200,7 @@ create_window(Display *display, char *title) XMapWindow(display, mywindow); /* Wait for map. */ - do + do { XNextEvent(display, &xev); } @@ -213,17 +213,17 @@ create_window(Display *display, char *title) return 0; } -static void -dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t width, uint32_t height) +static void +dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t width, uint32_t height) { // YUV conversion works like this: // // We write the Y, U, and V planes separately into 3dfx YUV Planar memory // region. The nice chip then takes these and packs them into the YUYV // format in the regular frame buffer, starting at yuvBaseAddr, page 2 here. - // Then we tell the 3dfx to do a Screen to Screen Stretch BLT to copy all + // Then we tell the 3dfx to do a Screen to Screen Stretch BLT to copy all // of the data on page 2 onto page 1, converting it to 16 bpp RGB as it goes. - // The result is a nice image on page 1 ready for display. + // The result is a nice image on page 1 ready for display. uint32_t j; uint32_t y_imax, uv_imax, jmax; @@ -236,7 +236,7 @@ dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t wid y_imax = width; // Y plane is twice as wide as U and V planes uv_imax = width>>1; // vidwidth/2/4, width of U and V planes in 32-bit words - for (j=0;jU + (uint32_t) VOODOO_YUV_STRIDE* j ,((uint8_t*) u) + uv_imax* j , uv_imax); @@ -247,8 +247,8 @@ dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t wid LOG("video_out_3dfx: done planar dump\n"); } -static void -screen_to_screen_stretch_blt(uint32_t to, uint32_t from, uint32_t width, uint32_t height) +static void +screen_to_screen_stretch_blt(uint32_t to, uint32_t from, uint32_t width, uint32_t height) { //FIXME - this function should be called by a show_frame function that // uses a series of blts to show only those areas not covered @@ -289,8 +289,8 @@ screen_to_screen_stretch_blt(uint32_t to, uint32_t from, uint32_t width, uint32_ LOG("video_out_3dfx: done blt\n"); } -static void -update_target(void) +static void +update_target(void) { uint32_t xp, yp, w, h, b, d; Window root; @@ -302,14 +302,14 @@ update_target(void) dispwidth = (uint32_t) w; dispheight = (uint32_t) h; - if (is_fullscreen) + if (is_fullscreen) targetoffset = vidpage0offset + (screenheight - dispheight)/2*screenwidth*screendepth + (screenwidth-dispwidth)/2*screendepth; - else + else targetoffset = vidpage0offset + (dispy*screenwidth + dispx)*screendepth; } -static int -config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) +static int +config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) { char *name = ":0.0"; pioData data; @@ -333,7 +333,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin //alarm(120); // Open driver device - if ( fd == -1 ) + if ( fd == -1 ) { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnableToOpenDevice); return -1; @@ -344,7 +344,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin vidheight = height; is_fullscreen = fullscreen = 0; - if (!is_fullscreen) + if (!is_fullscreen) create_window(display, title); // Ask 3dfx driver for base memory address 0 @@ -352,7 +352,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin data.size = 4; data.value = &baseAddr0; data.device = 0; - if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0) + if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0) { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Error,retval); return -1; @@ -363,7 +363,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin data.size = 4; data.value = &baseAddr1; data.device = 0; - if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0) + if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0) { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Error,retval); return -1; @@ -372,11 +372,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin // Map all 3dfx memory areas memBase0 = mmap(0,0x1000000,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr0); memBase1 = mmap(0,3*page_space,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr1); - if (memBase0 == (uint32_t *) 0xFFFFFFFF || memBase1 == (uint32_t *) 0xFFFFFFFF) + if (memBase0 == (uint32_t *) 0xFFFFFFFF || memBase1 == (uint32_t *) 0xFFFFFFFF) { - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_CouldntMapMemoryArea, + mp_msg(M