[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[422] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-21 13:21:14
|
Revision: 422 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=422&view=rev Author: nickols_k Date: 2012-11-21 13:21:00 +0000 (Wed, 21 Nov 2012) Log Message: ----------- more c++ sources + constantization + redesign query_format + redesign vosub_vidix Modified Paths: -------------- mplayerxp/libao2/Makefile mplayerxp/libvo/Makefile mplayerxp/libvo/img_format.h mplayerxp/libvo/osd.cpp mplayerxp/libvo/sub.h mplayerxp/libvo/video_out.cpp mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vosub_vidix.h mplayerxp/libvo/x11_common.h mplayerxp/postproc/vf_vo.cpp mplayerxp/xmpcore/mp_image.h Added Paths: ----------- mplayerxp/libvo/aspect.cpp mplayerxp/libvo/jpeg_enc.cpp mplayerxp/libvo/osd_template.h mplayerxp/libvo/vo_dga.cpp mplayerxp/libvo/vo_fbdev.cpp 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/vosub_vidix.cpp mplayerxp/libvo/x11_common.cpp Removed Paths: ------------- mplayerxp/libvo/aspect.c mplayerxp/libvo/jpeg_enc.c mplayerxp/libvo/osd_template.c mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/x11_common.c Modified: mplayerxp/libao2/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libao2/Makefile 2012-11-21 13:21:00 UTC (rev 422) @@ -60,7 +60,7 @@ dep: depend depend: - $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend + $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # # include dependency files if they exist Modified: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/Makefile 2012-11-21 13:21:00 UTC (rev 422) @@ -3,30 +3,30 @@ LIBNAME = libvo.a CXXSRCS=video_out.cpp font_load.cpp img_format.cpp screenshot.cpp sub.cpp osd.cpp -SRCS=aspect.c vo_null.c +CXXSRCS+=aspect.cpp vo_null.cpp ifeq ($(HAVE_SDL),yes) -SRCS+=vo_sdl.c +CXXSRCS+=vo_sdl.cpp endif ifeq ($(HAVE_OPENGL),yes) -SRCS+=vo_opengl.c +CXXSRCS+=vo_opengl.cpp endif ifeq ($(HAVE_X11),yes) -SRCS+=vo_x11.c x11_common.c +CXXSRCS+=vo_x11.cpp x11_common.cpp endif ifeq ($(HAVE_XV),yes) -SRCS+=vo_xv.c +CXXSRCS+=vo_xv.cpp endif ifeq ($(HAVE_DGA),yes) -SRCS+=vo_dga.c +CXXSRCS+=vo_dga.cpp endif ifeq ($(HAVE_FBDEV),yes) -SRCS+=vo_fbdev.c +CXXSRCS+=vo_fbdev.cpp endif ifeq ($(HAVE_VESA),yes) -SRCS += vo_vesa.c +CXXSRCS += vo_vesa.cpp endif ifeq ($(CONFIG_VIDIX),yes) -SRCS += vosub_vidix.c +CXXSRCS += vosub_vidix.cpp endif CFLAGS = $(OPTFLAGS) -I. -I.. -DMPG12PLAY -Wall -W @@ -63,7 +63,7 @@ dep: depend depend: - $(CC) -MM $(CFLAGS) $(SRCS) $(CXXSRCS) 1>.depend + $(CXX) -MM $(CXXFLAGS) $(SRCS) $(CXXSRCS) 1>.depend # # include dependency files if they exist Deleted: mplayerxp/libvo/aspect.c =================================================================== --- mplayerxp/libvo/aspect.c 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/aspect.c 2012-11-21 13:21:00 UTC (rev 422) @@ -1,90 +0,0 @@ -/* Stuff for correct aspect scaling. */ -#include "aspect.h" - -//#define ASPECT_DEBUG - -#ifdef ASPECT_DEBUG -#include <stdio.h> -#endif -#include "vo_msg.h" - -float monitor_aspect=0; - -static struct { - uint32_t orgw; // real width - uint32_t orgh; // real height - uint32_t prew; // prescaled width - uint32_t preh; // prescaled height - uint32_t scrw; // horizontal resolution - uint32_t scrh; // vertical resolution -} aspdat; - -void __FASTCALL__ aspect_save_orig(uint32_t orgw, uint32_t orgh){ - aspdat.orgw = orgw; - aspdat.orgh = orgh; -} - -void __FASTCALL__ aspect_save_prescale(uint32_t prew, uint32_t preh){ - aspdat.prew = prew; - aspdat.preh = preh; -} - -void __FASTCALL__ aspect_save_screenres(uint32_t scrw, uint32_t scrh){ - aspdat.scrw = scrw; - aspdat.scrh = scrh; - monitor_aspect = mp_conf.monitor_pixel_aspect * scrw / scrh; -} - -/* aspect is called with the source resolution and the - * resolution, that the scaled image should fit into - */ - -void __FASTCALL__ aspect(uint32_t *srcw, uint32_t *srch, int zoom){ - uint32_t tmpw; - -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(0) fitin: %dx%d zoom: %d \n",aspdat.scrw,aspdat.scrh,zoom); - MSG_DBG2("aspect(1) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh); -#endif - if(zoom){ - if(aspdat.prew >= aspdat.preh) - { - /* Landscape mode */ - *srcw = aspdat.scrw; - *srch = (uint32_t)(((float)aspdat.scrw / (float)aspdat.prew * (float)aspdat.preh) - * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect))); - } - else - { - /* Portrait mode */ - *srch = aspdat.scrh; - *srcw = (uint32_t)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) - * ((float)aspdat.scrw / ((float)aspdat.scrh * monitor_aspect))); - } - }else{ - *srcw = aspdat.prew; - *srch = (uint32_t)((float)aspdat.preh - * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect))); - } - (*srch)+= (*srch)%2; // round -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(2) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh); -#endif - if(*srch>aspdat.scrh || *srch<aspdat.orgh){ - if(zoom) - tmpw = (uint32_t)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) - * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect)))); - else - tmpw = (uint32_t)((float)aspdat.prew - * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect)))); - if(tmpw<=aspdat.scrw && tmpw>=aspdat.orgw){ - *srch = zoom?aspdat.scrh:aspdat.preh; - *srcw = tmpw; - *srcw+= *srcw%2; // round - } - } -#ifdef ASPECT_DEBUG - MSG_DBG2("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh); -#endif -} - Copied: mplayerxp/libvo/aspect.cpp (from rev 417, mplayerxp/libvo/aspect.c) =================================================================== --- mplayerxp/libvo/aspect.cpp (rev 0) +++ mplayerxp/libvo/aspect.cpp 2012-11-21 13:21:00 UTC (rev 422) @@ -0,0 +1,90 @@ +/* Stuff for correct aspect scaling. */ +#include "aspect.h" + +//#define ASPECT_DEBUG + +#ifdef ASPECT_DEBUG +#include <stdio.h> +#endif +#include "vo_msg.h" + +float monitor_aspect=0; + +static struct { + uint32_t orgw; // real width + uint32_t orgh; // real height + uint32_t prew; // prescaled width + uint32_t preh; // prescaled height + uint32_t scrw; // horizontal resolution + uint32_t scrh; // vertical resolution +} aspdat; + +void __FASTCALL__ aspect_save_orig(uint32_t orgw, uint32_t orgh){ + aspdat.orgw = orgw; + aspdat.orgh = orgh; +} + +void __FASTCALL__ aspect_save_prescale(uint32_t prew, uint32_t preh){ + aspdat.prew = prew; + aspdat.preh = preh; +} + +void __FASTCALL__ aspect_save_screenres(uint32_t scrw, uint32_t scrh){ + aspdat.scrw = scrw; + aspdat.scrh = scrh; + monitor_aspect = mp_conf.monitor_pixel_aspect * scrw / scrh; +} + +/* aspect is called with the source resolution and the + * resolution, that the scaled image should fit into + */ + +void __FASTCALL__ aspect(uint32_t *srcw, uint32_t *srch, int zoom){ + uint32_t tmpw; + +#ifdef ASPECT_DEBUG + MSG_DBG2("aspect(0) fitin: %dx%d zoom: %d \n",aspdat.scrw,aspdat.scrh,zoom); + MSG_DBG2("aspect(1) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh); +#endif + if(zoom){ + if(aspdat.prew >= aspdat.preh) + { + /* Landscape mode */ + *srcw = aspdat.scrw; + *srch = (uint32_t)(((float)aspdat.scrw / (float)aspdat.prew * (float)aspdat.preh) + * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect))); + } + else + { + /* Portrait mode */ + *srch = aspdat.scrh; + *srcw = (uint32_t)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) + * ((float)aspdat.scrw / ((float)aspdat.scrh * monitor_aspect))); + } + }else{ + *srcw = aspdat.prew; + *srch = (uint32_t)((float)aspdat.preh + * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect))); + } + (*srch)+= (*srch)%2; // round +#ifdef ASPECT_DEBUG + MSG_DBG2("aspect(2) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh); +#endif + if(*srch>aspdat.scrh || *srch<aspdat.orgh){ + if(zoom) + tmpw = (uint32_t)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) + * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect)))); + else + tmpw = (uint32_t)((float)aspdat.prew + * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect)))); + if(tmpw<=aspdat.scrw && tmpw>=aspdat.orgw){ + *srch = zoom?aspdat.scrh:aspdat.preh; + *srcw = tmpw; + *srcw+= *srcw%2; // round + } + } +#ifdef ASPECT_DEBUG + MSG_DBG2("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh); +#endif +} + Modified: mplayerxp/libvo/img_format.h =================================================================== --- mplayerxp/libvo/img_format.h 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/img_format.h 2012-11-21 13:21:00 UTC (rev 422) @@ -4,12 +4,8 @@ #include <inttypes.h> #include <stdint.h> #include "mp_config.h" -#include "libavutil/pixfmt.h" +#include "mp_conf_lavc.h" -#ifdef __cplusplus -extern "C" { -#endif - /* RGB/BGR Formats */ enum { IMGFMT_RGB_MASK =0xFFFFFF00, @@ -161,8 +157,5 @@ enum PixelFormat pixfmt_from_fourcc(uint32_t fourcc); uint32_t fourcc_from_pixfmt(enum PixelFormat pixfmt); extern unsigned rgbfmt_depth(unsigned fmt); -#ifdef __cplusplus -} -#endif #endif Deleted: mplayerxp/libvo/jpeg_enc.c =================================================================== --- mplayerxp/libvo/jpeg_enc.c 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/jpeg_enc.c 2012-11-21 13:21:00 UTC (rev 422) @@ -1,451 +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/~bouman/grad-labs/lab8/pdf/lab.pdf - */ - - - -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include "mp_config.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) { - mp_free(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) { - mp_free(j->s); - mp_free(j); - return NULL; - } - - if (MPV_common_init(j->s) < 0) { - mp_free(j->s); - mp_free(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); - mp_free(j->s); - mp_free(j); -} - Copied: mplayerxp/libvo/jpeg_enc.cpp (from rev 417, mplayerxp/libvo/jpeg_enc.c) =================================================================== --- mplayerxp/libvo/jpeg_enc.cpp (rev 0) +++ mplayerxp/libvo/jpeg_enc.cpp 2012-11-21 13:21:00 UTC (rev 422) @@ -0,0 +1,451 @@ +/* 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> +#include "mp_config.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) { + mp_free(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) { + mp_free(j->s); + mp_free(j); + return NULL; + } + + if (MPV_common_init(j->s) < 0) { + mp_free(j->s); + mp_free(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); + mp_free(j->s); + mp_free(j); +} + Modified: mplayerxp/libvo/osd.cpp =================================================================== --- mplayerxp/libvo/osd.cpp 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/osd.cpp 2012-11-21 13:21:00 UTC (rev 422) @@ -23,7 +23,7 @@ static const unsigned long long mask24hl __attribute__((used)) __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; #endif -#define PVECTOR_ACCEL_H "osd_template.c" +#define PVECTOR_ACCEL_H "osd_template.h" #include "pvector/pvector_inc.h" #ifdef FAST_OSD_TABLE Deleted: mplayerxp/libvo/osd_template.c =================================================================== --- mplayerxp/libvo/osd_template.c 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/osd_template.c 2012-11-21 13:21:00 UTC (rev 422) @@ -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) - -static __inline void __attribute__((__gnu_inline__, __always_inline__)) -PVECTOR_RENAME(_m_movntq)(any_t*__P, __m64 src) -{ -#ifdef HAVE_MMX2 - _mm_stream_pi(__P,src); -#else - _m_store(__P,src); -#endif -} -#undef _m_movntq -#define _m_movntq PVECTOR_RENAME(_m_movntq) - -#endif - -static inline void PVECTOR_RENAME(vo_draw_alpha_yv12)(int w,int h,const unsigned char* src,const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - unsigned y; -#ifdef HAVE_INT_PVECTOR - __ivec vzero = _ivec_setzero(); -#endif -PROFILE_START(); - for(y=0;y<(unsigned)h;y++){ - int x; - x=0; -#ifdef HAVE_INT_PVECTOR - _ivec_prefetchw(&dstbase[x]); - _ivec_prefetch(&src[x]); - _ivec_prefetch(&srca[x]); - /* MOVNTDQ: #GP(0) - If memory operand is not aligned on a 16-byte boundary */ - if(!_ivec_aligned(dstbase)) - for(;x<w;x++){ - unsigned char *dst=&dstbase[x]; - if(srca[x]) *dst=((dstbase[x]*srca[x])>>8)+src[x]; - if(_ivec_aligned(dst)) break; /* align on sizeof(MMREG) boundary */ - } - if((w-x)>=_ivec_size()) - for(;x<w;x+=_ivec_size()){ - __ivec vmsk,vdest,vsrc,vsrca,vt[4]; - _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); - _ivec_prefetch(&src[x+_ivec_size()*4]); - _ivec_prefetch(&srca[x+_ivec_size()*4]); - vdest = _ivec_loada(&dstbase[x]); - if(_ivec_aligned(&src[x])) - vsrc = _ivec_loada(&src[x]); - else - vsrc = _ivec_loadu(&src[x]); - if(_ivec_aligned(&srca[x])) - vsrca = _ivec_loada(&srca[x]); - else - vsrca = _ivec_loadu(&srca[x]); - vmsk = _ivec_not(_ivec_cmpeq_s8(vsrca,vzero)); - vt[0] = _ivec_u16_from_u8(vdest,&vt[1]); - vt[2] = _ivec_u16_from_u8(vsrca,&vt[3]); - vt[0] = _ivec_srl_s16_imm(_ivec_mullo_s16(vt[0],vt[2]),8); - vt[1] = _ivec_srl_s16_imm(_ivec_mullo_s16(vt[1],vt[3]),8); - vt[0] = _ivec_add_s8(_ivec_u8_from_u16(vt[0],vt[1]),vsrc); - vt[1] = _ivec_blend_u8(vdest,vt[0],vmsk); - if(finalize) - _ivec_stream(&dstbase[x],vt[1]); - else - _ivec_storea(&dstbase[x],vt[1]); - } -#endif - for(;x<w;x++){ - if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } -#ifdef HAVE_INT_PVECTOR - _ivec_empty(); - if(finalize) _ivec_sfence(); -#endif -PROFILE_END("vo_draw_alpha_yv12"); - return; -} - -static inline void PVECTOR_RENAME(vo_draw_alpha_yuy2)(int w,int h,const unsigned char* src,const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - int y; -#if defined(FAST_OSD) && !defined(HAVE_MMX) - w=w>>1; -#endif -PROFILE_START(); - for(y=0;y<h;y++){ - register int x=0; -#ifdef HAVE_INT_PVECTOR - /* TODO: port this stuff on PVector */ - __m64 mm[8]; - _ivec_prefetchw(&dstbase[x]); - _ivec_prefetch(&src[x]); - _ivec_prefetch(&srca[x]); - mm[7]=_mm_setzero_si64(); - mm[5]=_mm_set1_pi8(0xFF); - mm[4]=mm[5]; - mm[5]=_m_psllwi(mm[5],8); - mm[4]=_m_psrlwi(mm[4],8); - for(;x<w;x+=4){ - _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); - _ivec_prefetch(&src[x+_ivec_size()*4]); - _ivec_prefetch(&srca[x+_ivec_size()*4]); - mm[0]=_m_load(&(((char *)dstbase)[x*2])); - mm[1]=mm[0]; - mm[0]=_m_pand(mm[0],mm[4]); - mm[2]=_m_load_half(&(((char *)srca)[x])); - mm[2]=_m_paddb(mm[2],_m_load(&bFF)); - mm[2]=_m_punpcklbw(mm[2],mm[7]); - mm[0]=_m_pmullw(mm[0],mm[2]); - mm[0]=_m_psrlwi(mm[0],8); - mm[1]=_m_pand(mm[1],mm[5]); - mm[2]=_m_load_half(&(((char *)src)[x])); - mm[2]=_m_punpcklbw(mm[2],mm[7]); - mm[0]=_m_por(mm[0],mm[1]); - mm[0]=_m_paddb(mm[0],mm[2]); - if(finalize) - _m_movntq(&(((char *)dstbase)[x*2]),mm[0]); - else - _m_store(&(((char *)dstbase)[x*2]),mm[0]); - } -#endif - for(;x<w;x++){ -#ifdef FAST_OSD - if(srca[2*x+0]) dstbase[4*x+0]=src[2*x+0]; - if(srca[2*x+1]) dstbase[4*x+2]=src[2*x+1]; -#else - if(srca[x]) { - dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x]; - dstbase[2*x+1]=((((signed)dstbase[2*x+1]-128)*srca[x])>>8)+128; - } -#endif - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } -#ifdef HAVE_INT_PVECTOR - _ivec_empty(); - if(finalize) _ivec_sfence(); -#endif -PROFILE_END("vo_draw_alpha_yuy2"); - return; -} - -static inline void PVECTOR_RENAME(vo_draw_alpha_rgb24)(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 char *dst = dstbase; - register int x=0; -#ifdef HAVE_INT_PVECTOR - __m64 mm[8]; - _ivec_prefetchw(&dstbase[x]); - _ivec_prefetch(&src[x]); - _ivec_prefetch(&srca[x]); - mm[7]=_mm_setzero_si64(); - mm[6]=_mm_set1_pi8(0xFF); - for(;x<w;x+=2){ - if(srca[x] || srca[x+1]) { - _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); - _ivec_prefetch(&src[x+_ivec_size()*4]); - _ivec_prefetch(&srca[x+_ivec_size()*4]); - mm[0]=_m_load(&dstbase[0]); - mm[1]=mm[0]; - mm[5]=mm[0]; - mm[0]=_m_punpcklbw(mm[0],mm[7]); - mm[1]=_m_punpckhbw(mm[1],mm[7]); - mm[2]=_m_load_half(&srca[x]); - mm[2]=_m_paddb(mm[2],mm[6]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[3]=mm[2]; - mm[2]=_m_punpcklbw(mm[2],mm[7]); - mm[3]=_m_punpckhbw(mm[3],mm[7]); - mm[0]=_m_pmullw(mm[0],mm[2]); - mm[1]=_m_pmullw(mm[1],mm[3]); - mm[0]=_m_psrlwi(mm[0],8); - mm[1]=_m_psrlwi(mm[1],8); - mm[0]=_m_packuswb(mm[0],mm[1]); - mm[2]=_m_load_half(&src[x]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[0]=_m_paddb(mm[0],mm[2]); - mm[5]=_m_pand(mm[5],_m_load(&mask24lh)); - mm[0]=_m_pand(mm[0],_m_load(&mask24hl)); - mm[5]=_m_por(mm[5],mm[0]); - if(finalize) - _m_movntq(&dstbase[0],mm[5]); - else - _m_store(&dstbase[0],mm[5]); - } - dst += 6; - } -#endif /* arch_x86 */ - for(;x<w;x++){ - if(srca[x]){ -#ifdef FAST_OSD - dst[0]=dst[1]=dst[2]=src[x]; -#else - dst[0]=((dst[0]*srca[x])>>8)+src[x]; - dst[1]=((dst[1]*srca[x])>>8)+src[x]; - dst[2]=((dst[2]*srca[x])>>8)+src[x]; -#endif - } - dst+=3; // 24bpp - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } -#ifdef HAVE_INT_PVECTOR - _ivec_empty(); - if(finalize) _ivec_sfence(); -#endif - return; -} - -static inline void PVECTOR_RENAME(vo_draw_alpha_rgb32)(int w,int h,const unsigned char* src,const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ - int y; -PROFILE_START(); - for(y=0;y<h;y++){ - register int x=0; -#ifdef HAVE_INT_PVECTOR - __m64 mm[8]; - _ivec_prefetchw(&dstbase[x]); - _ivec_prefetch(&src[x]); - _ivec_prefetch(&srca[x]); - mm[7]=_mm_setzero_si64(); - mm[6]=_mm_set1_pi8(0xFF); - for(;x<w;x+=2){ - if(srca[x] || srca[x+1]) { - _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); - _ivec_prefetch(&src[x+_ivec_size()*4]); - _ivec_prefetch(&srca[x+_ivec_size()*4]); - mm[0]=_m_load(&dstbase[4*x]); - mm[1]=mm[0]; - mm[0]=_m_punpcklbw(mm[0],mm[7]); - mm[1]=_m_punpckhbw(mm[1],mm[7]); - mm[2]=_m_load_half(&srca[x]); - mm[2]=_m_paddb(mm[2],mm[6]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[3]=mm[2]; - mm[2]=_m_punpcklbw(mm[2],mm[7]); - mm[3]=_m_punpckhbw(mm[3],mm[7]); - mm[0]=_m_pmullw(mm[0],mm[2]); - mm[1]=_m_pmullw(mm[1],mm[3]); - mm[0]=_m_psrlwi(mm[0],8); - mm[1]=_m_psrlwi(mm[1],8); - mm[0]=_m_packuswb(mm[0],mm[1]); - mm[2]=_m_load_half(&src[x]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[2]=_m_punpcklbw(mm[2],mm[2]); - mm[0]=_m_paddb(mm[0],mm[2]); - if(finalize) - _m_movntq(&dstbase[4*x],mm[0]); - else - _m_store(&dstbase[4*x],mm[0]); - } - } -#endif /* arch_x86 */ - for(;x<w;x++){ - if(srca[x]){ -#ifdef FAST_OSD - dstbase[4*x+0]=dstbase[4*x+1]=dstbase[4*x+2]=src[x]; -#else - dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x]; - dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x]; - dstbase[4*x+2]=((dstbase[4*x+2]*srca[x])>>8)+src[x]; -#endif - } - } - src+=srcstride; - srca+=srcstride; - dstbase+=dststride; - } -#ifdef HAVE_INT_PVECTOR - _ivec_empty(); - if(finalize) _ivec_sfence(); -#endif -PROFILE_END("vo_draw_alpha_rgb32"); - return; -} Copied: mplayerxp/libvo/osd_template.h (from rev 417, mplayerxp/libvo/osd_template.c) =================================================================== --- mplayerxp/libvo/osd_template.h (rev 0) +++ mplayerxp/libvo/osd_template.h 2012-11-21 13:21:00 UTC (rev 422) @@ -0,0 +1,318 @@ +// 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) + +static __inline void __attribute__((__gnu_inline__, __always_inline__)) +PVECTOR_RENAME(_m_movntq)(any_t*__P, __m64 src) +{ +#ifdef HAVE_MMX2 + _mm_stream_pi(__P,src); +#else + _m_store(__P,src); +#endif +} +#undef _m_movntq +#define _m_movntq PVECTOR_RENAME(_m_movntq) + +#endif + +static inline void PVECTOR_RENAME(vo_draw_alpha_yv12)(int w,int h,const unsigned char* src,const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ + unsigned y; +#ifdef HAVE_INT_PVECTOR + __ivec vzero = _ivec_setzero(); +#endif +PROFILE_START(); + for(y=0;y<(unsigned)h;y++){ + int x; + x=0; +#ifdef HAVE_INT_PVECTOR + _ivec_prefetchw(&dstbase[x]); + _ivec_prefetch(&src[x]); + _ivec_prefetch(&srca[x]); + /* MOVNTDQ: #GP(0) - If memory operand is not aligned on a 16-byte boundary */ + if(!_ivec_aligned(dstbase)) + for(;x<w;x++){ + unsigned char *dst=&dstbase[x]; + if(srca[x]) *dst=((dstbase[x]*srca[x])>>8)+src[x]; + if(_ivec_aligned(dst)) break; /* align on sizeof(MMREG) boundary */ + } + if((w-x)>=_ivec_size()) + for(;x<w;x+=_ivec_size()){ + __ivec vmsk,vdest,vsrc,vsrca,vt[4]; + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); + vdest = _ivec_loada(&dstbase[x]); + if(_ivec_aligned(&src[x])) + vsrc = _ivec_loada(&src[x]); + else + vsrc = _ivec_loadu(&src[x]); + if(_ivec_aligned(&srca[x])) + vsrca = _ivec_loada(&srca[x]); + else + vsrca = _ivec_loadu(&srca[x]); + vmsk = _ivec_not(_ivec_cmpeq_s8(vsrca,vzero)); + vt[0] = _ivec_u16_from_u8(vdest,&vt[1]); + vt[2] = _ivec_u16_from_u8(vsrca,&vt[3]); + vt[0] = _ivec_srl_s16_imm(_ivec_mullo_s16(vt[0],vt[2]),8); + vt[1] = _ivec_srl_s16_imm(_ivec_mullo_s16(vt[1],vt[3]),8); + vt[0] = _ivec_add_s8(_ivec_u8_from_u16(vt[0],vt[1]),vsrc); + vt[1] = _ivec_blend_u8(vdest,vt[0],vmsk); + if(finalize) + _ivec_stream(&dstbase[x],vt[1]); + else + _ivec_storea(&dstbase[x],vt[1]); + } +#endif + for(;x<w;x++){ + if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; + } + src+=srcstride; + srca+=srcstride; + dstbase+=dststride; + } +#ifdef HAVE_INT_PVECTOR + _ivec_empty(); + if(finalize) _ivec_sfence(); +#endif +PROFILE_END("vo_draw_alpha_yv12"); + return; +} + +static inline void PVECTOR_RENAME(vo_draw_alpha_yuy2)(int w,int h,const unsigned char* src,const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ + int y; +#if defined(FAST_OSD) && !defined(HAVE_MMX) + w=w>>1; +#endif +PROFILE_START(); + for(y=0;y<h;y++){ + register int x=0; +#ifdef HAVE_INT_PVECTOR + /* TODO: port this stuff on PVector */ + __m64 mm[8]; + _ivec_prefetchw(&dstbase[x]); + _ivec_prefetch(&src[x]); + _ivec_prefetch(&srca[x]); + mm[7]=_mm_setzero_si64(); + mm[5]=_mm_set1_pi8(0xFF); + mm[4]=mm[5]; + mm[5]=_m_psllwi(mm[5],8); + mm[4]=_m_psrlwi(mm[4],8); + for(;x<w;x+=4){ + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); + mm[0]=_m_load(&(((char *)dstbase)[x*2])); + mm[1]=mm[0]; + mm[0]=_m_pand(mm[0],mm[4]); + mm[2]=_m_load_half(&(((char *)srca)[x])); + mm[2]=_m_paddb(mm[2],_m_load(&bFF)); + mm[2]=_m_punpcklbw(mm[2],mm[7]); + mm[0]=_m_pmullw(mm[0],mm[2]); + mm[0]=_m_psrlwi(mm[0],8); + mm[1]=_m_pand(mm[1],mm[5]); + mm[2]=_m_load_half(&(((char *)src)[x])); + mm[2]=_m_punpcklbw(mm[2],mm[7]); + mm[0]=_m_por(mm[0],mm[1]); + mm[0]=_m_paddb(mm[0],mm[2]); + if(finalize) + _m_movntq(&(((char *)dstbase)[x*2]),mm[0]); + else + _m_store(&(((char *)dstbase)[x*2]),mm[0]); + } +#endif + for(;x<w;x++){ +#ifdef FAST_OSD + if(srca[2*x+0]) dstbase[4*x+0]=src[2*x+0]; + if(srca[2*x+1]) dstbase[4*x+2]=src[2*x+1]; +#else + if(srca[x]) { + dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x]; + dstbase[2*x+1]=((((signed)dstbase[2*x+1]-128)*srca[x])>>8)+128; + } +#endif + } + src+=srcstride; + srca+=srcstride; + dstbase+=dststride; + } +#ifdef HAVE_INT_PVECTOR + _ivec_empty(); + if(finalize) _ivec_sfence(); +#endif +PROFILE_END("vo_draw_alpha_yuy2"); + return; +} + +static inline void PVECTOR_RENAME(vo_draw_alpha_rgb24)(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 char *dst = dstbase; + register int x=0; +#ifdef HAVE_INT_PVECTOR + __m64 mm[8]; + _ivec_prefetchw(&dstbase[x]); + _ivec_prefetch(&src[x]); + _ivec_prefetch(&srca[x]); + mm[7]=_mm_setzero_si64(); + mm[6]=_mm_set1_pi8(0xFF); + for(;x<w;x+=2){ + if(srca[x] || srca[x+1]) { + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); + mm[0]=_m_load(&dstbase[0]); + mm[1]=mm[0]; + mm[5]=mm[0]; + mm[0]=_m_punpcklbw(mm[0],mm[7]); + mm[1]=_m_punpckhbw(mm[1],mm[7]); + mm[2]=_m_load_half(&srca[x]); + mm[2]=_m_paddb(mm[2],mm[6]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[3]=mm[2]; + mm[2]=_m_punpcklbw(mm[2],mm[7]); + mm[3]=_m_punpckhbw(mm[3],mm[7]); + mm[0]=_m_pmullw(mm[0],mm[2]); + mm[1]=_m_pmullw(mm[1],mm[3]); + mm[0]=_m_psrlwi(mm[0],8); + mm[1]=_m_psrlwi(mm[1],8); + mm[0]=_m_packuswb(mm[0],mm[1]); + mm[2]=_m_load_half(&src[x]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[0]=_m_paddb(mm[0],mm[2]); + mm[5]=_m_pand(mm[5],_m_load(&mask24lh)); + mm[0]=_m_pand(mm[0],_m_load(&mask24hl)); + mm[5]=_m_por(mm[5],mm[0]); + if(finalize) + _m_movntq(&dstbase[0],mm[5]); + else + _m_store(&dstbase[0],mm[5]); + } + dst += 6; + } +#endif /* arch_x86 */ + for(;x<w;x++){ + if(srca[x]){ +#ifdef FAST_OSD + dst[0]=dst[1]=dst[2]=src[x]; +#else + dst[0]=((dst[0]*srca[x])>>8)+src[x]; + dst[1]=((dst[1]*srca[x])>>8)+src[x]; + dst[2]=((dst[2]*srca[x])>>8)+src[x]; +#endif + } + dst+=3; // 24bpp + } + src+=srcstride; + srca+=srcstride; + dstbase+=dststride; + } +#ifdef HAVE_INT_PVECTOR + _ivec_empty(); + if(finalize) _ivec_sfence(); +#endif + return; +} + +static inline void PVECTOR_RENAME(vo_draw_alpha_rgb32)(int w,int h,const unsigned char* src,const unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride,int finalize){ + int y; +PROFILE_START(); + for(y=0;y<h;y++){ + register int x=0; +#ifdef HAVE_INT_PVECTOR + __m64 mm[8]; + _ivec_prefetchw(&dstbase[x]); + _ivec_prefetch(&src[x]); + _ivec_prefetch(&srca[x]); + mm[7]=_mm_setzero_si64(); + mm[6]=_mm_set1_pi8(0xFF); + for(;x<w;x+=2){ + if(srca[x] || srca[x+1]) { + _ivec_prefetchw(&dstbase[x+_ivec_size()*4]); + _ivec_prefetch(&src[x+_ivec_size()*4]); + _ivec_prefetch(&srca[x+_ivec_size()*4]); + mm[0]=_m_load(&dstbase[4*x]); + mm[1]=mm[0]; + mm[0]=_m_punpcklbw(mm[0],mm[7]); + mm[1]=_m_punpckhbw(mm[1],mm[7]); + mm[2]=_m_load_half(&srca[x]); + mm[2]=_m_paddb(mm[2],mm[6]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[3]=mm[2]; + mm[2]=_m_punpcklbw(mm[2],mm[7]); + mm[3]=_m_punpckhbw(mm[3],mm[7]); + mm[0]=_m_pmullw(mm[0],mm[2]); + mm[1]=_m_pmullw(mm[1],mm[3]); + mm[0]=_m_psrlwi(mm[0],8); + mm[1]=_m_psrlwi(mm[1],8); + mm[0]=_m_packuswb(mm[0],mm[1]); + mm[2]=_m_load_half(&src[x]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[2]=_m_punpcklbw(mm[2],mm[2]); + mm[0]=_m_paddb(mm[0],mm[2]); + if(finalize) + _m_movntq(&dstbase[4*x],mm[0]); + else + _m_store(&dstbase[4*x],mm[0]); + } + } +#endif /* arch_x86 */ + for(;x<w;x++){ + if(srca[x]){ +#ifdef FAST_OSD + dstbase[4*x+0]=dstbase[4*x+1]=dstbase[4*x+2]=src[x]; +#else + dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x]; + dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x]; + dstbase[4*x+2]=((dstbase[4*x+2]*srca[x])>>8)+src[x]; +#endif + } + } + src+=srcstride; + srca+=srcstride; + dstbase+=dststride; + } +#ifdef HAVE_INT_PVECTOR + _ivec_empty(); + if(finalize) _ivec_sfence(); +#endif +PROFILE_END("vo_draw_alpha_rgb32"); + return; +} Modified: mplayerxp/libvo/sub.h =================================================================== --- mplayerxp/libvo/sub.h 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/sub.h 2012-11-21 13:21:00 UTC (rev 422) @@ -3,10 +3,6 @@ #include <inttypes.h> #include "osd.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct mp_osd_bbox_s { int x1,y1,x2,y2; } mp_osd_bbox_t; @@ -104,8 +100,5 @@ int __FASTCALL__ vo_osd_changed(int new_value); int __FASTCALL__ get_osd_height(any_t* vo,int c,int h); void __FASTCALL__ osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); -#ifdef __cplusplus -} -#endif #endif Modified: mplayerxp/libvo/video_out.cpp =================================================================== --- mplayerxp/libvo/video_out.cpp 2012-11-21 12:54:43 UTC (rev 421) +++ mplayerxp/libvo/video_out.cpp 2012-11-21 13:21:00 UTC (rev 422) @@ -51,18 +51,18 @@ // // Externally visible list of all vo drivers // -extern vo_functions_t video_out_x11; -extern vo_functions_t video_out_xv; -extern vo_functions_t video_out_dga; -extern vo_functions_t video_out_sdl; -extern vo_functions_t video_out_null; -extern vo_functions_t video_out_pgm; -extern vo_functions_t video_out_md5; -extern vo_functions_t video_out_fbdev; -extern vo_functions_t video_out_png; -extern vo_functions_t video_out_opengl; +extern const vo_functions_t video_out_x11; +extern const vo_functions_t video_out_xv; +extern const vo_functions_t video_out_dga; +extern const vo_functions_t video_out_sdl; +extern const vo_functions_t video_out_null; +extern const vo_functions_t video_out_pgm; +extern const vo_functions_t video_out_md5; +extern const vo_functions_t video_out_fbdev; +extern const vo_functions_t video_out_png; +extern const vo_functions_t video_out_opengl; #ifdef HAVE_VESA -extern vo_functions_t video_out_vesa; +extern const vo_functions_t video_out_vesa; #endif static const vo_functions_t* video_out_drivers[] = @@ -454,17 +454,18 @@ uint32_t __FASTCALL__ vo_query_format(vo_data_t*vo,uint32_t* fourcc, unsigned src_w, unsigned src_h) { vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; - uint32_t retval,dri_forced_fourcc; + uint32_t dri_forced_fourcc; + MPXP_Rc retval; vo_query_fourcc_t qfourcc; MSG_DBG3("dri_vo_dbg: vo_query_format(%08lX)\n",*fourcc); qfourcc.fourcc = *fourcc; qfourcc.w = src_w; qfourcc.h = src_h; - retval = priv->video_out->control(vo,VOCTRL_QUERY_FORMAT,&qfourcc); - MSG_V("dri_vo: request for %s fourcc: %s\n",vo_format_name(*fourcc),retval?"OK":"False"); + if(priv->video_out->control(vo,VOCTRL_QUERY_FORMAT,&qfourcc)==MPXP_False) + qfourcc.flags=VOCAP_NA; + MSG_V("dri_vo: request for %s fourcc: %i\n",vo_format_name(*fourcc),qfourcc.flags); dri_forced_fourcc = *fourcc; - if(retval) retval = 0x3; /... [truncated message content] |