Changeset e2ff540dbb82d5505d869e422255fa57bc7b202a
- Timestamp:
- 05/08/04 12:16:58
(4 years ago)
- Author:
- Gildas Bazin <gbazin@videolan.org>
- git-committer:
- Gildas Bazin <gbazin@videolan.org> 1091701018 +0000
- git-parent:
[d82767397e842b8a2e5cd323bec6482116fed0c2]
- git-author:
- Gildas Bazin <gbazin@videolan.org> 1091701018 +0000
- Message:
* modules/video_filter/blend.c: sanity checks.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r7476804 |
re2ff540 |
|
| 45 | 45 | int, int ); |
|---|
| 46 | 46 | static void BlendI420( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 47 | | int, int ); |
|---|
| | 47 | int, int, int, int ); |
|---|
| 48 | 48 | static void BlendR16( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 49 | | int, int ); |
|---|
| | 49 | int, int, int, int ); |
|---|
| 50 | 50 | static void BlendR24( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 51 | | int, int ); |
|---|
| | 51 | int, int, int, int ); |
|---|
| 52 | 52 | static void BlendYUY2( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 53 | | int, int ); |
|---|
| | 53 | int, int, int, int ); |
|---|
| 54 | 54 | static void BlendPalI420( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 55 | | int, int ); |
|---|
| | 55 | int, int, int, int ); |
|---|
| 56 | 56 | static void BlendPalYUY2( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 57 | | int, int ); |
|---|
| | 57 | int, int, int, int ); |
|---|
| 58 | 58 | static void BlendPalRV( filter_t *, picture_t *, picture_t *, picture_t *, |
|---|
| 59 | | int, int ); |
|---|
| | 59 | int, int, int, int ); |
|---|
| 60 | 60 | |
|---|
| 61 | 61 | /***************************************************************************** |
|---|
| … | … | |
| 118 | 118 | int i_x_offset, int i_y_offset ) |
|---|
| 119 | 119 | { |
|---|
| | 120 | int i_width, i_height; |
|---|
| | 121 | |
|---|
| | 122 | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| | 123 | p_filter->fmt_in.video.i_visible_width ); |
|---|
| | 124 | |
|---|
| | 125 | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| | 126 | p_filter->fmt_in.video.i_visible_height ); |
|---|
| | 127 | |
|---|
| | 128 | if( i_width <= 0 || i_height <= 0 ) return; |
|---|
| | 129 | |
|---|
| 120 | 130 | if( p_filter->fmt_in.video.i_chroma == VLC_FOURCC('Y','U','V','A') && |
|---|
| 121 | 131 | ( p_filter->fmt_out.video.i_chroma == VLC_FOURCC('I','4','2','0') || |
|---|
| … | … | |
| 123 | 133 | { |
|---|
| 124 | 134 | BlendI420( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 125 | | i_x_offset, i_y_offset ); |
|---|
| | 135 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 126 | 136 | return; |
|---|
| 127 | 137 | } |
|---|
| … | … | |
| 130 | 140 | { |
|---|
| 131 | 141 | BlendYUY2( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 132 | | i_x_offset, i_y_offset ); |
|---|
| | 142 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 133 | 143 | return; |
|---|
| 134 | 144 | } |
|---|
| … | … | |
| 137 | 147 | { |
|---|
| 138 | 148 | BlendR16( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 139 | | i_x_offset, i_y_offset ); |
|---|
| | 149 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 140 | 150 | return; |
|---|
| 141 | 151 | } |
|---|
| … | … | |
| 145 | 155 | { |
|---|
| 146 | 156 | BlendR24( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 147 | | i_x_offset, i_y_offset ); |
|---|
| | 157 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 148 | 158 | return; |
|---|
| 149 | 159 | } |
|---|
| … | … | |
| 153 | 163 | { |
|---|
| 154 | 164 | BlendPalI420( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 155 | | i_x_offset, i_y_offset ); |
|---|
| | 165 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 156 | 166 | return; |
|---|
| 157 | 167 | } |
|---|
| … | … | |
| 160 | 170 | { |
|---|
| 161 | 171 | BlendPalYUY2( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 162 | | i_x_offset, i_y_offset ); |
|---|
| | 172 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 163 | 173 | return; |
|---|
| 164 | 174 | } |
|---|
| … | … | |
| 169 | 179 | { |
|---|
| 170 | 180 | BlendPalRV( p_filter, p_dst, p_dst_orig, p_src, |
|---|
| 171 | | i_x_offset, i_y_offset ); |
|---|
| | 181 | i_x_offset, i_y_offset, i_width, i_height ); |
|---|
| 172 | 182 | return; |
|---|
| 173 | 183 | } |
|---|
| … | … | |
| 178 | 188 | static void BlendI420( filter_t *p_filter, picture_t *p_dst, |
|---|
| 179 | 189 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 180 | | int i_x_offset, int i_y_offset ) |
|---|
| | 190 | int i_x_offset, int i_y_offset, |
|---|
| | 191 | int i_width, int i_height ) |
|---|
| 181 | 192 | { |
|---|
| 182 | 193 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| … | … | |
| 185 | 196 | uint8_t *p_src1_v, *p_src2_v, *p_dst_v; |
|---|
| 186 | 197 | uint8_t *p_trans; |
|---|
| 187 | | int i_width, i_height, i_x, i_y; |
|---|
| | 198 | int i_x, i_y; |
|---|
| 188 | 199 | vlc_bool_t b_even_scanline = i_y_offset % 2; |
|---|
| 189 | 200 | |
|---|
| … | … | |
| 231 | 242 | p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 232 | 243 | |
|---|
| 233 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 234 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 235 | | |
|---|
| 236 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 237 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 238 | | |
|---|
| 239 | 244 | #define MAX_TRANS 255 |
|---|
| 240 | 245 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 322 | 327 | static void BlendR16( filter_t *p_filter, picture_t *p_dst_pic, |
|---|
| 323 | 328 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 324 | | int i_x_offset, int i_y_offset ) |
|---|
| | 329 | int i_x_offset, int i_y_offset, |
|---|
| | 330 | int i_width, int i_height ) |
|---|
| 325 | 331 | { |
|---|
| 326 | 332 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| … | … | |
| 328 | 334 | uint8_t *p_src2_u, *p_src2_v; |
|---|
| 329 | 335 | uint8_t *p_trans; |
|---|
| 330 | | int i_width, i_height, i_x, i_y, i_pix_pitch; |
|---|
| | 336 | int i_x, i_y, i_pix_pitch; |
|---|
| 331 | 337 | int r, g, b; |
|---|
| 332 | 338 | |
|---|
| … | … | |
| 359 | 365 | p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 360 | 366 | |
|---|
| 361 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 362 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 363 | | |
|---|
| 364 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 365 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 366 | | |
|---|
| 367 | 367 | #define MAX_TRANS 255 |
|---|
| 368 | 368 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 408 | 408 | static void BlendR24( filter_t *p_filter, picture_t *p_dst_pic, |
|---|
| 409 | 409 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 410 | | int i_x_offset, int i_y_offset ) |
|---|
| | 410 | int i_x_offset, int i_y_offset, |
|---|
| | 411 | int i_width, int i_height ) |
|---|
| 411 | 412 | { |
|---|
| 412 | 413 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| … | … | |
| 414 | 415 | uint8_t *p_src2_u, *p_src2_v; |
|---|
| 415 | 416 | uint8_t *p_trans; |
|---|
| 416 | | int i_width, i_height, i_x, i_y, i_pix_pitch; |
|---|
| | 417 | int i_x, i_y, i_pix_pitch; |
|---|
| 417 | 418 | int r, g, b; |
|---|
| 418 | 419 | |
|---|
| … | … | |
| 445 | 446 | p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 446 | 447 | |
|---|
| 447 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 448 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 449 | | |
|---|
| 450 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 451 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 452 | | |
|---|
| 453 | 448 | #define MAX_TRANS 255 |
|---|
| 454 | 449 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 504 | 499 | static void BlendYUY2( filter_t *p_filter, picture_t *p_dst_pic, |
|---|
| 505 | 500 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 506 | | int i_x_offset, int i_y_offset ) |
|---|
| | 501 | int i_x_offset, int i_y_offset, |
|---|
| | 502 | int i_width, int i_height ) |
|---|
| 507 | 503 | { |
|---|
| 508 | 504 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| … | … | |
| 510 | 506 | uint8_t *p_src2_u, *p_src2_v; |
|---|
| 511 | 507 | uint8_t *p_trans; |
|---|
| 512 | | int i_width, i_height, i_x, i_y, i_pix_pitch; |
|---|
| | 508 | int i_x, i_y, i_pix_pitch; |
|---|
| 513 | 509 | |
|---|
| 514 | 510 | i_pix_pitch = 2; |
|---|
| … | … | |
| 540 | 536 | p_src->p[A_PLANE].i_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 541 | 537 | |
|---|
| 542 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 543 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 544 | | |
|---|
| 545 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 546 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 547 | | |
|---|
| 548 | 538 | #define MAX_TRANS 255 |
|---|
| 549 | 539 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 610 | 600 | static void BlendPalI420( filter_t *p_filter, picture_t *p_dst, |
|---|
| 611 | 601 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 612 | | int i_x_offset, int i_y_offset ) |
|---|
| | 602 | int i_x_offset, int i_y_offset, |
|---|
| | 603 | int i_width, int i_height ) |
|---|
| 613 | 604 | { |
|---|
| 614 | 605 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| … | … | |
| 616 | 607 | uint8_t *p_src1_u, *p_dst_u; |
|---|
| 617 | 608 | uint8_t *p_src1_v, *p_dst_v; |
|---|
| 618 | | int i_width, i_height, i_x, i_y; |
|---|
| | 609 | int i_x, i_y; |
|---|
| 619 | 610 | vlc_bool_t b_even_scanline = i_y_offset % 2; |
|---|
| 620 | 611 | |
|---|
| … | … | |
| 651 | 642 | i_src2_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 652 | 643 | |
|---|
| 653 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 654 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 655 | | |
|---|
| 656 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 657 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 658 | | |
|---|
| 659 | 644 | #define MAX_TRANS 255 |
|---|
| 660 | 645 | #define TRANS_BITS 8 |
|---|
| … | … | |
| 721 | 706 | static void BlendPalYUY2( filter_t *p_filter, picture_t *p_dst_pic, |
|---|
| 722 | 707 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 723 | | int i_x_offset, int i_y_offset ) |
|---|
| | 708 | int i_x_offset, int i_y_offset, |
|---|
| | 709 | int i_width, int i_height ) |
|---|
| 724 | 710 | { |
|---|
| 725 | 711 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| 726 | 712 | uint8_t *p_src1, *p_src2, *p_dst; |
|---|
| 727 | | int i_width, i_height, i_x, i_y, i_pix_pitch; |
|---|
| | 713 | int i_x, i_y, i_pix_pitch; |
|---|
| 728 | 714 | |
|---|
| 729 | 715 | i_pix_pitch = 2; |
|---|
| … | … | |
| 741 | 727 | p_src2 = p_src->p->p_pixels + p_filter->fmt_in.video.i_x_offset + |
|---|
| 742 | 728 | i_src2_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 743 | | |
|---|
| 744 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 745 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 746 | | |
|---|
| 747 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 748 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 749 | 729 | |
|---|
| 750 | 730 | #define MAX_TRANS 255 |
|---|
| … | … | |
| 814 | 794 | static void BlendPalRV( filter_t *p_filter, picture_t *p_dst_pic, |
|---|
| 815 | 795 | picture_t *p_dst_orig, picture_t *p_src, |
|---|
| 816 | | int i_x_offset, int i_y_offset ) |
|---|
| | 796 | int i_x_offset, int i_y_offset, |
|---|
| | 797 | int i_width, int i_height ) |
|---|
| 817 | 798 | { |
|---|
| 818 | 799 | int i_src1_pitch, i_src2_pitch, i_dst_pitch; |
|---|
| 819 | 800 | uint8_t *p_src1, *p_src2, *p_dst; |
|---|
| 820 | | int i_width, i_height, i_x, i_y, i_pix_pitch; |
|---|
| | 801 | int i_x, i_y, i_pix_pitch; |
|---|
| 821 | 802 | int r, g, b; |
|---|
| 822 | 803 | video_palette_t rgbpalette; |
|---|
| … | … | |
| 836 | 817 | p_src2 = p_src->p->p_pixels + p_filter->fmt_in.video.i_x_offset + |
|---|
| 837 | 818 | i_src2_pitch * p_filter->fmt_in.video.i_y_offset; |
|---|
| 838 | | |
|---|
| 839 | | i_width = __MIN( p_filter->fmt_out.video.i_visible_width - i_x_offset, |
|---|
| 840 | | p_filter->fmt_in.video.i_visible_width ); |
|---|
| 841 | | |
|---|
| 842 | | i_height = __MIN( p_filter->fmt_out.video.i_visible_height - i_y_offset, |
|---|
| 843 | | p_filter->fmt_in.video.i_visible_height ); |
|---|
| 844 | 819 | |
|---|
| 845 | 820 | #define MAX_TRANS 255 |
|---|