| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * H.261 common code | ||
| 3 | * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> | ||
| 4 | * Copyright (c) 2004 Maarten Daniels | ||
| 5 | * | ||
| 6 | * This file is part of FFmpeg. | ||
| 7 | * | ||
| 8 | * FFmpeg is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU Lesser General Public | ||
| 10 | * License as published by the Free Software Foundation; either | ||
| 11 | * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * Lesser General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU Lesser General Public | ||
| 19 | * License along with FFmpeg; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | */ | ||
| 22 | |||
| 23 | /** | ||
| 24 | * @file | ||
| 25 | * H.261 codec | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include "h261.h" | ||
| 29 | #include "mpegvideo.h" | ||
| 30 | |||
| 31 | #define IS_FIL(a) ((a) & MB_TYPE_H261_FIL) | ||
| 32 | |||
| 33 | 615078 | static void h261_loop_filter(uint8_t *src, ptrdiff_t stride) | |
| 34 | { | ||
| 35 | int x, y; | ||
| 36 | int temp[64]; | ||
| 37 | |||
| 38 |
2/2✓ Branch 0 taken 4920624 times.
✓ Branch 1 taken 615078 times.
|
5535702 | for (x = 0; x < 8; x++) { |
| 39 | 4920624 | temp[x] = 4 * src[x]; | |
| 40 | 4920624 | temp[x + 7 * 8] = 4 * src[x + 7 * stride]; | |
| 41 | } | ||
| 42 |
2/2✓ Branch 0 taken 3690468 times.
✓ Branch 1 taken 615078 times.
|
4305546 | for (y = 1; y < 7; y++) { |
| 43 |
2/2✓ Branch 0 taken 29523744 times.
✓ Branch 1 taken 3690468 times.
|
33214212 | for (x = 0; x < 8; x++) { |
| 44 | 29523744 | ptrdiff_t xy = y * stride + x; | |
| 45 | 29523744 | ptrdiff_t yz = y * 8 + x; | |
| 46 | 29523744 | temp[yz] = src[xy - stride] + 2 * src[xy] + src[xy + stride]; | |
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 |
2/2✓ Branch 0 taken 4920624 times.
✓ Branch 1 taken 615078 times.
|
5535702 | for (y = 0; y < 8; y++) { |
| 51 | 4920624 | src[y * stride] = (temp[y * 8] + 2) >> 2; | |
| 52 | 4920624 | src[y * stride + 7] = (temp[y * 8 + 7] + 2) >> 2; | |
| 53 |
2/2✓ Branch 0 taken 29523744 times.
✓ Branch 1 taken 4920624 times.
|
34444368 | for (x = 1; x < 7; x++) { |
| 54 | 29523744 | ptrdiff_t xy = y * stride + x; | |
| 55 | 29523744 | ptrdiff_t yz = y * 8 + x; | |
| 56 | 29523744 | src[xy] = (temp[yz - 1] + 2 * temp[yz] + temp[yz + 1] + 8) >> 4; | |
| 57 | } | ||
| 58 | } | ||
| 59 | 615078 | } | |
| 60 | |||
| 61 | 207248 | void ff_h261_loop_filter(MpegEncContext *s) | |
| 62 | { | ||
| 63 | 207248 | const ptrdiff_t linesize = s->linesize; | |
| 64 | 207248 | const ptrdiff_t uvlinesize = s->uvlinesize; | |
| 65 | 207248 | uint8_t *dest_y = s->dest[0]; | |
| 66 | 207248 | uint8_t *dest_cb = s->dest[1]; | |
| 67 | 207248 | uint8_t *dest_cr = s->dest[2]; | |
| 68 | |||
| 69 |
2/2✓ Branch 0 taken 104735 times.
✓ Branch 1 taken 102513 times.
|
207248 | if (!(IS_FIL(s->mtype))) |
| 70 | 104735 | return; | |
| 71 | |||
| 72 | 102513 | h261_loop_filter(dest_y, linesize); | |
| 73 | 102513 | h261_loop_filter(dest_y + 8, linesize); | |
| 74 | 102513 | h261_loop_filter(dest_y + 8 * linesize, linesize); | |
| 75 | 102513 | h261_loop_filter(dest_y + 8 * linesize + 8, linesize); | |
| 76 | 102513 | h261_loop_filter(dest_cb, uvlinesize); | |
| 77 | 102513 | h261_loop_filter(dest_cr, uvlinesize); | |
| 78 | } | ||
| 79 |