Changeset 6ec82b018ceee54f37157333ce6bc74dd23b57cb
- Timestamp:
- 16/04/07 23:59:39
(2 years ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1176760779 +0000
- git-parent:
[c7bcb18012ebac706106e40b1d67ddd830e130e3]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1176760779 +0000
- Message:
- erase.c: add bluring effect, fix a bunch of bugs and compile warnings. It now looks good.
- deinterlace.c: compile warning fix.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rae6af36 |
r6ec82b0 |
|
| 370 | 370 | { |
|---|
| 371 | 371 | vout_thread_t *p_real_vout = NULL; |
|---|
| 372 | | video_format_t fmt = {0}; |
|---|
| | 372 | video_format_t fmt; |
|---|
| | 373 | memset( &fmt, 0, sizeof( video_format_t ) ); |
|---|
| 373 | 374 | |
|---|
| 374 | 375 | msg_Dbg( p_vout, "spawning the real video output" ); |
|---|
| r71a183b |
r6ec82b0 |
|
| 95 | 95 | { |
|---|
| 96 | 96 | image_handler_t *p_image; |
|---|
| 97 | | video_format_t fmt_in = {0}, fmt_out = {0}; |
|---|
| | 97 | video_format_t fmt_in, fmt_out; |
|---|
| | 98 | memset( &fmt_in, 0, sizeof( video_format_t ) ); |
|---|
| | 99 | memset( &fmt_out, 0, sizeof( video_format_t ) ); |
|---|
| 98 | 100 | fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); |
|---|
| 99 | 101 | if( p_filter->p_sys->p_mask ) |
|---|
| … | … | |
| 239 | 241 | uint8_t *p_mask = p_sys->p_mask->A_PIXELS; |
|---|
| 240 | 242 | |
|---|
| | 243 | int i_x = p_sys->i_x, i_y = p_sys->i_y; |
|---|
| 241 | 244 | int x, y; |
|---|
| 242 | 245 | int i_height = i_mask_visible_lines; |
|---|
| 243 | 246 | int i_width = i_mask_visible_pitch; |
|---|
| 244 | | if( i_plane ) |
|---|
| | 247 | if( i_plane ) /* U_PLANE or V_PLANE */ |
|---|
| 245 | 248 | { |
|---|
| 246 | | i_height /= 2; |
|---|
| 247 | | i_width /= 2; |
|---|
| | 249 | i_width /= 2; |
|---|
| | 250 | i_height /= 2; |
|---|
| | 251 | i_x /= 2; |
|---|
| | 252 | i_y /= 2; |
|---|
| 248 | 253 | } |
|---|
| 249 | | i_height = __MIN( i_visible_lines - (i_plane?p_sys->i_y/2:p_sys->i_y), i_height ); |
|---|
| 250 | | i_width = __MIN( i_visible_pitch - (i_plane?p_sys->i_x/2:p_sys->i_x), i_width ); |
|---|
| | 254 | i_height = __MIN( i_visible_lines - i_y, i_height ); |
|---|
| | 255 | i_width = __MIN( i_visible_pitch - i_x, i_width ); |
|---|
| 251 | 256 | |
|---|
| 252 | 257 | p_filter->p_libvlc->pf_memcpy( p_outpix, p_inpix, i_pitch * i_lines ); |
|---|
| 253 | 258 | |
|---|
| 254 | | for( y = 0; y < i_height; |
|---|
| 255 | | y++, p_mask += i_plane ? 2*i_mask_pitch : i_mask_pitch ) |
|---|
| | 259 | for( y = 0; y < i_height; y++, p_mask += i_mask_pitch ) |
|---|
| 256 | 260 | { |
|---|
| 257 | | uint8_t prev, next; |
|---|
| 258 | | int prev_x = 0, next_x = -1; |
|---|
| 259 | | p_outpix = i_plane ? |
|---|
| 260 | | p_outpic->p[i_plane].p_pixels |
|---|
| 261 | | + (p_sys->i_y/2+y)*i_pitch + (p_sys->i_x/2) |
|---|
| 262 | | : |
|---|
| 263 | | p_outpic->p[i_plane].p_pixels |
|---|
| 264 | | + (p_sys->i_y+y)*i_pitch + p_sys->i_x; |
|---|
| 265 | | if( p_sys->i_x ) |
|---|
| | 261 | uint8_t prev, next = 0; |
|---|
| | 262 | int prev_x = -1, next_x = -2; |
|---|
| | 263 | p_outpix = p_outpic->p[i_plane].p_pixels + (i_y+y)*i_pitch + i_x; |
|---|
| | 264 | if( i_x ) |
|---|
| 266 | 265 | { |
|---|
| 267 | 266 | prev = *(p_outpix-1); |
|---|
| 268 | 267 | } |
|---|
| 269 | | else if( y || p_sys->i_y ) |
|---|
| | 268 | else if( y || i_y ) |
|---|
| 270 | 269 | { |
|---|
| 271 | 270 | prev = *(p_outpix-i_pitch); |
|---|
| … | … | |
| 294 | 293 | { |
|---|
| 295 | 294 | if( x0 == x ) x0++; |
|---|
| 296 | | if( (i_plane?p_sys->i_x/2:p_sys->i_x)+i_width >= i_visible_pitch ) |
|---|
| | 295 | if( x0 >= i_visible_pitch ) |
|---|
| 297 | 296 | { |
|---|
| 298 | 297 | next_x = x0; |
|---|
| … | … | |
| 305 | 304 | } |
|---|
| 306 | 305 | } |
|---|
| | 306 | if( !( i_x || y || i_y ) ) |
|---|
| | 307 | prev = next; |
|---|
| 307 | 308 | } |
|---|
| 308 | 309 | /* interpolate new value */ |
|---|
| 309 | | p_outpix[x] = prev + (x-prev_x)*(next-prev)/(next_x-prev_x); |
|---|
| | 310 | p_outpix[x] = prev;// + (x-prev_x)*(next-prev)/(next_x-prev_x); |
|---|
| 310 | 311 | } |
|---|
| 311 | 312 | else |
|---|
| … | … | |
| 316 | 317 | } |
|---|
| 317 | 318 | } |
|---|
| | 319 | |
|---|
| | 320 | /* Vertical bluring */ |
|---|
| | 321 | p_mask = p_sys->p_mask->A_PIXELS; |
|---|
| | 322 | i_height = i_mask_visible_lines / (i_plane?2:1); |
|---|
| | 323 | i_height = __MIN( i_visible_lines - i_y - 2, i_height ); |
|---|
| | 324 | for( y = __MAX(i_y-2,0); y < i_height; |
|---|
| | 325 | y++, p_mask += i_mask_pitch ) |
|---|
| | 326 | { |
|---|
| | 327 | p_outpix = p_outpic->p[i_plane].p_pixels + (i_y+y)*i_pitch + i_x; |
|---|
| | 328 | for( x = 0; x < i_width; x++ ) |
|---|
| | 329 | { |
|---|
| | 330 | if( p_mask[i_plane?2*x:x] > 127 ) |
|---|
| | 331 | { |
|---|
| | 332 | p_outpix[x] = |
|---|
| | 333 | ( (p_outpix[x-2*i_pitch]<<1) /* 2 */ |
|---|
| | 334 | + (p_outpix[x-i_pitch]<<2) /* 4 */ |
|---|
| | 335 | + (p_outpix[x]<<2) /* 4 */ |
|---|
| | 336 | + (p_outpix[x+i_pitch]<<2) /* 4 */ |
|---|
| | 337 | + (p_outpix[x+2*i_pitch]<<1) )>>4; /* 2 */ |
|---|
| | 338 | } |
|---|
| | 339 | } |
|---|
| | 340 | } |
|---|
| | 341 | |
|---|
| 318 | 342 | } |
|---|
| 319 | 343 | } |
|---|