[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[93] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-09 16:01:53
|
Revision: 93 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=93&view=rev Author: nickols_k Date: 2010-01-09 16:01:47 +0000 (Sat, 09 Jan 2010) Log Message: ----------- code cleanups and bugfixes Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/mp_image.c mplayerxp/mp_image.h mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_yuvcsp.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/libmpcodecs/dec_video.c 2010-01-09 16:01:47 UTC (rev 93) @@ -169,11 +169,8 @@ smp_num_cpus=omp_get_num_procs(); vf_flags=vf_query_flags(sh_video->vfilter); use_vf_threads=0; - MSG_V("[mpdec] vf_flags=%08X num_cpus=%u\n",vf_flags,smp_num_cpus); - if(((vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) { - MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); - use_vf_threads=1; - } + MSG_DBG2("[mpdec] vf_flags=%08X num_cpus=%u\n",vf_flags,smp_num_cpus); + if(((vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; } #else MSG_V("[mpdec] GOMP was not compiled-in! Using single threaded video filtering!\n"); @@ -225,6 +222,11 @@ if(use_vf_threads) { unsigned i,y,h_step,h; mp_image_t ampi[smp_num_cpus]; + static int hello_printed=0; + if(!hello_printed) { + MSG_OK("[VC] using %u threads for video filters\n",smp_num_cpus); + hello_printed=1; + } h_step = mpi->h/smp_num_cpus; h=mpi->height; mpi->height=h_step; @@ -232,12 +234,13 @@ for(i=0;i<smp_num_cpus;i++) { ampi[i] = *mpi; ampi[i].y = y; - ampi[i].height = h_step+y; + ampi[i].height = h_step; + ampi[i].chroma_height = h_step >> mpi->chroma_y_shift; y+=h_step; } #pragma omp parallel for shared(vf) private(i) for(i=0;i<smp_num_cpus;i++) { - MSG_V("Put slice[%u %u] in threads\n",ampi[i].y,h_step); + MSG_DBG2("Put slice[%u %u] in threads\n",ampi[i].y,h_step); vf->put_slice(vf,&i[i]); } if(y<h) { Modified: mplayerxp/mp_image.c =================================================================== --- mplayerxp/mp_image.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/mp_image.c 2010-01-09 16:01:47 UTC (rev 93) @@ -199,14 +199,28 @@ void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi) { if(mpi->flags&MP_IMGFLAG_PLANAR){ memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0],mpi->stride[0]); + dmpi->stride[0],mpi->stride[0]); memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1],mpi->stride[1]); + dmpi->stride[1],mpi->stride[1]); memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2],mpi->stride[2]); + dmpi->stride[2],mpi->stride[2]); } else { - memcpy_pic(dmpi->planes[0],mpi->planes[0], - mpi->w*(dmpi->bpp/8), mpi->h, - dmpi->stride[0],mpi->stride[0]); + memcpy_pic(dmpi->planes[0],mpi->planes[0], + mpi->w*(dmpi->bpp/8), mpi->h, + dmpi->stride[0],mpi->stride[0]); } } + +void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height) +{ + unsigned uv_off = (y>>mpi->chroma_y_shift); + *dmpi = *mpi; + dmpi->planes[0] = mpi->planes[0] + (mpi->stride[0]*y); + dmpi->planes[1] = mpi->planes[1] + (mpi->stride[1]*uv_off); + dmpi->planes[2] = mpi->planes[2] + (mpi->stride[2]*uv_off); + dmpi->planes[3] = mpi->planes[3] + (mpi->stride[3]*uv_off); + dmpi->qscale = mpi->qscale + (mpi->qstride*y); + dmpi->y = 0; + dmpi->h = height; + dmpi->chroma_height = (height >> mpi->chroma_y_shift); +} Modified: mplayerxp/mp_image.h =================================================================== --- mplayerxp/mp_image.h 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/mp_image.h 2010-01-09 16:01:47 UTC (rev 93) @@ -106,5 +106,6 @@ extern void free_mp_image(mp_image_t* mpi); extern mp_image_t* alloc_mpi(int w, int h, unsigned int fmt); extern void copy_mpi(mp_image_t *dmpi,const mp_image_t *mpi); +extern void mpi_fake_slice(mp_image_t *dmpi,const mp_image_t *mpi,unsigned y,unsigned height); #endif Modified: mplayerxp/postproc/vf_2xsai.c =================================================================== --- mplayerxp/postproc/vf_2xsai.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_2xsai.c 2010-01-09 16:01:47 UTC (rev 93) @@ -35,7 +35,7 @@ // if (d != 15 && d != 16 && d != 24 && d != 32) // return -1; - /* Get lowest color bit */ + /* Get lowest color bit */ for (i = 0; i < 255; i++) { if (!minr) minr = makecol(i, 0, 0); @@ -65,7 +65,7 @@ // TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask); // TRACE("QColor Mask: 0x%lX\n", qcolorMask); // TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask); - + xsai_depth = d; return 0; @@ -83,12 +83,12 @@ static unsigned char *src_line[4]; static unsigned char *dst_line[2]; -void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, +void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, uint8_t *dst, uint32_t dst_pitch, uint32_t stx, uint32_t sty, uint32_t width, uint32_t height) { - unsigned int x, y; + unsigned int i,j,x, y; uint32_t color[16]; /* Point to the first 3 lines. */ @@ -123,15 +123,15 @@ #ifdef _OPENMP #pragma omp parallel for #endif - for (y = sty; y < height; y++) { - + for (j = 0; j < height; j++) { + y = j+sty; dst_line[0] = dst + dst_pitch*2*y; dst_line[1] = dst + dst_pitch*(2*y+1); - + /* Todo: x = width - 2, x = width - 1 */ - - for (x = stx; x < width; x++) { + for (i = 0; i < width; x++) { uint32_t product1a, product1b, product2a, product2b; + x = i+stx; //--------------------------------------- B0 B1 B2 B3 0 1 2 3 // 4 5* 6 S2 -> 4 5* 6 7 @@ -160,7 +160,6 @@ product1b = color[5]; else product1b = INTERPOLATE(color[5], color[6]); - product2b = product1b; } @@ -193,7 +192,7 @@ product1a = INTERPOLATE(color[9], color[5]); else product1a = color[5]; - + if (PixelsPerMask == 2) { *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); @@ -204,16 +203,16 @@ *((uint32_t *) (&dst_line[1][x * 8])) = product2a; *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b; } - + /* Move color matrix forward */ color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15]; - + if (x < width - 3) { x += 3; if (PixelsPerMask == 2) { - color[3] = *(((unsigned short*)src_line[0]) + x); + color[3] = *(((unsigned short*)src_line[0]) + x); color[7] = *(((unsigned short*)src_line[1]) + x); color[11] = *(((unsigned short*)src_line[2]) + x); color[15] = *(((unsigned short*)src_line[3]) + x); @@ -231,14 +230,14 @@ /* We're done with one line, so we shift the source lines up */ src_line[0] = src_line[1]; src_line[1] = src_line[2]; - src_line[2] = src_line[3]; + src_line[2] = src_line[3]; /* Read next line */ if (y + 3 >= height) src_line[3] = src_line[2]; else src_line[3] = src_line[2] + src_pitch; - + /* Then shift the color matrix up */ if (PixelsPerMask == 2) { unsigned short *sbp; @@ -262,9 +261,9 @@ lbp = (uint32_t*)src_line[3]; color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); } - + } // y loop - + } Modified: mplayerxp/postproc/vf_format.c =================================================================== --- mplayerxp/postproc/vf_format.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_format.c 2010-01-09 16:01:47 UTC (rev 93) @@ -109,7 +109,7 @@ "format", "Nickols_K", "FIXME! get_image()/put_image()", - VF_FLAGS_THREADS, + VF_FLAGS_THREADS|VF_FLAGS_SLICES, vf_open }; Modified: mplayerxp/postproc/vf_il.c =================================================================== --- mplayerxp/postproc/vf_il.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_il.c 2010-01-09 16:01:47 UTC (rev 93) @@ -103,7 +103,7 @@ interleave(dmpi->planes[2], mpi->planes[2], cw,ch, dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); } - + return vf_next_put_slice(vf,dmpi); } Modified: mplayerxp/postproc/vf_palette.c =================================================================== --- mplayerxp/postproc/vf_palette.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_palette.c 2010-01-09 16:01:47 UTC (rev 93) @@ -75,7 +75,7 @@ static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ mp_image_t *dmpi; - + // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, @@ -151,7 +151,7 @@ } } } - + return vf_next_put_slice(vf,dmpi); } Modified: mplayerxp/postproc/vf_perspective.c =================================================================== --- mplayerxp/postproc/vf_perspective.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_perspective.c 2010-01-09 16:01:47 UTC (rev 93) @@ -219,7 +219,7 @@ index= u + v*srcStride; subUI= SUB_PIXELS - subU; subVI= SUB_PIXELS - subV; - + if((unsigned)u < (unsigned)(w - 1)){ if((unsigned)v < (unsigned)(h - 1)){ sum= subVI*(subUI*src[index ] + subU*src[index +1]) Modified: mplayerxp/postproc/vf_rgb2bgr.c =================================================================== --- mplayerxp/postproc/vf_rgb2bgr.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_rgb2bgr.c 2010-01-09 16:01:47 UTC (rev 93) @@ -34,7 +34,7 @@ case IMGFMT_BGR24: return IMGFMT_RGB24; case IMGFMT_BGR32: return IMGFMT_RGB32; } - return 0; + return 0; } static int __FASTCALL__ config(struct vf_instance_s* vf, Modified: mplayerxp/postproc/vf_yuvcsp.c =================================================================== --- mplayerxp/postproc/vf_yuvcsp.c 2010-01-09 14:39:07 UTC (rev 92) +++ mplayerxp/postproc/vf_yuvcsp.c 2010-01-09 16:01:47 UTC (rev 93) @@ -31,7 +31,7 @@ } static int __FASTCALL__ put_slice(struct vf_instance_s* vf, mp_image_t *mpi){ - int i,j; + unsigned i,j,y,x; uint8_t *y_in, *cb_in, *cr_in; uint8_t *y_out, *cb_out, *cr_out; @@ -47,15 +47,19 @@ cb_out = vf->dmpi->planes[1]; cr_out = vf->dmpi->planes[2]; - for (i = mpi->y; i < mpi->height; i++) - for (j = mpi->x; j < mpi->width; j++) - y_out[i*vf->dmpi->stride[0]+j] = clamp_y(y_in[i*mpi->stride[0]+j]); - - for (i = (mpi->y)>>(mpi->chroma_y_shift); i < mpi->chroma_height; i++) + for (i = 0; i < mpi->height; i++) + for (j = mpi->x; j < mpi->width; j++) { + y = i+mpi->y; + x = j+mpi->x; + y_out[y*vf->dmpi->stride[0]+x] = clamp_y(y_in[y*mpi->stride[0]+x]); + } + for (i = 0; i < mpi->chroma_height; i++) for (j = (mpi->x)>>(mpi->chroma_x_shift); j < mpi->chroma_width; j++) { - cb_out[i*vf->dmpi->stride[1]+j] = clamp_c(cb_in[i*mpi->stride[1]+j]); - cr_out[i*vf->dmpi->stride[2]+j] = clamp_c(cr_in[i*mpi->stride[2]+j]); + y=i+(mpi->y>>mpi->chroma_y_shift); + x=j+(mpi->y>>mpi->chroma_x_shift); + cb_out[y*vf->dmpi->stride[1]+x] = clamp_c(cb_in[y*mpi->stride[1]+x]); + cr_out[y*vf->dmpi->stride[2]+x] = clamp_c(cr_in[y*mpi->stride[2]+x]); } return vf_next_put_slice(vf,vf->dmpi); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |