Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * MPEG-4 encoder/decoder internal header. | ||
3 | * Copyright (c) 2000,2001 Fabrice Bellard | ||
4 | * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at> | ||
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 | #ifndef AVCODEC_MPEG4VIDEO_H | ||
24 | #define AVCODEC_MPEG4VIDEO_H | ||
25 | |||
26 | #include <stdint.h> | ||
27 | |||
28 | #include "mpegvideo.h" | ||
29 | |||
30 | void ff_mpeg4_clean_buffers(MpegEncContext *s); | ||
31 | int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s); | ||
32 | void ff_mpeg4_init_direct_mv(MpegEncContext *s); | ||
33 | |||
34 | /** | ||
35 | * @return the mb_type | ||
36 | */ | ||
37 | int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my); | ||
38 | |||
39 | /** | ||
40 | * Predict the dc. | ||
41 | * @param n block index (0-3 are luma, 4-5 are chroma) | ||
42 | * @param dir_ptr pointer to an integer where the prediction direction will be stored | ||
43 | */ | ||
44 | 2411262 | static inline int ff_mpeg4_pred_dc(MpegEncContext *s, int n, int *dir_ptr) | |
45 | { | ||
46 | int a, b, c, wrap, pred; | ||
47 | const int16_t *dc_val; | ||
48 | |||
49 | /* find prediction */ | ||
50 | |||
51 | 2411262 | wrap = s->block_wrap[n]; | |
52 | 2411262 | dc_val = s->dc_val[0] + s->block_index[n]; | |
53 | |||
54 | /* B C | ||
55 | * A X | ||
56 | */ | ||
57 | 2411262 | a = dc_val[-1]; | |
58 | 2411262 | b = dc_val[-1 - wrap]; | |
59 | 2411262 | c = dc_val[-wrap]; | |
60 | |||
61 | /* outside slice handling (we can't do that by memset as we need the | ||
62 | * dc for error resilience) */ | ||
63 |
4/4✓ Branch 0 taken 283548 times.
✓ Branch 1 taken 2127714 times.
✓ Branch 2 taken 236290 times.
✓ Branch 3 taken 47258 times.
|
2411262 | if (s->first_slice_line && n != 3) { |
64 |
2/2✓ Branch 0 taken 189032 times.
✓ Branch 1 taken 47258 times.
|
236290 | if (n != 2) |
65 | 189032 | b = c = 1024; | |
66 |
4/4✓ Branch 0 taken 189032 times.
✓ Branch 1 taken 47258 times.
✓ Branch 2 taken 10008 times.
✓ Branch 3 taken 179024 times.
|
236290 | if (n != 1 && s->mb_x == s->resync_mb_x) |
67 | 10008 | b = a = 1024; | |
68 | } | ||
69 |
4/4✓ Branch 0 taken 106050 times.
✓ Branch 1 taken 2305212 times.
✓ Branch 2 taken 15072 times.
✓ Branch 3 taken 90978 times.
|
2411262 | if (s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y + 1) { |
70 |
6/6✓ Branch 0 taken 12560 times.
✓ Branch 1 taken 2512 times.
✓ Branch 2 taken 10048 times.
✓ Branch 3 taken 2512 times.
✓ Branch 4 taken 2512 times.
✓ Branch 5 taken 7536 times.
|
15072 | if (n == 0 || n == 4 || n == 5) |
71 | 7536 | b = 1024; | |
72 | } | ||
73 | |||
74 |
2/2✓ Branch 0 taken 884359 times.
✓ Branch 1 taken 1526903 times.
|
2411262 | if (abs(a - b) < abs(b - c)) { |
75 | 884359 | pred = c; | |
76 | 884359 | *dir_ptr = 1; /* top */ | |
77 | } else { | ||
78 | 1526903 | pred = a; | |
79 | 1526903 | *dir_ptr = 0; /* left */ | |
80 | } | ||
81 | 2411262 | return pred; | |
82 | } | ||
83 | |||
84 | #endif /* AVCODEC_MPEG4VIDEO_H */ | ||
85 |