| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * MPEG-4 Audio PCE copying function | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef AVCODEC_MPEG4AUDIO_COPY_PCE_H | ||
| 22 | #define AVCODEC_MPEG4AUDIO_COPY_PCE_H | ||
| 23 | |||
| 24 | #include "libavutil/attributes.h" | ||
| 25 | |||
| 26 | #include "get_bits.h" | ||
| 27 | #include "put_bits.h" | ||
| 28 | |||
| 29 | 216 | static av_always_inline unsigned int ff_pce_copy_bits(PutBitContext *pb, | |
| 30 | GetBitContext *gb, | ||
| 31 | int bits) | ||
| 32 | { | ||
| 33 | 216 | unsigned int el = get_bits(gb, bits); | |
| 34 | 216 | put_bits(pb, bits, el); | |
| 35 | 216 | return el; | |
| 36 | } | ||
| 37 | |||
| 38 | 18 | static inline int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb) | |
| 39 | { | ||
| 40 | int five_bit_ch, four_bit_ch, comment_size, bits; | ||
| 41 | 18 | int offset = put_bits_count(pb); | |
| 42 | |||
| 43 | 18 | ff_pce_copy_bits(pb, gb, 10); // Tag, Object Type, Frequency | |
| 44 | 18 | five_bit_ch = ff_pce_copy_bits(pb, gb, 4); // Front | |
| 45 | 18 | five_bit_ch += ff_pce_copy_bits(pb, gb, 4); // Side | |
| 46 | 18 | five_bit_ch += ff_pce_copy_bits(pb, gb, 4); // Back | |
| 47 | 18 | four_bit_ch = ff_pce_copy_bits(pb, gb, 2); // LFE | |
| 48 | 18 | four_bit_ch += ff_pce_copy_bits(pb, gb, 3); // Data | |
| 49 | 18 | five_bit_ch += ff_pce_copy_bits(pb, gb, 4); // Coupling | |
| 50 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
|
18 | if (ff_pce_copy_bits(pb, gb, 1)) // Mono Mixdown |
| 51 | ✗ | ff_pce_copy_bits(pb, gb, 4); | |
| 52 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
|
18 | if (ff_pce_copy_bits(pb, gb, 1)) // Stereo Mixdown |
| 53 | ✗ | ff_pce_copy_bits(pb, gb, 4); | |
| 54 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
|
18 | if (ff_pce_copy_bits(pb, gb, 1)) // Matrix Mixdown |
| 55 | ✗ | ff_pce_copy_bits(pb, gb, 3); | |
| 56 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | for (bits = five_bit_ch*5+four_bit_ch*4; bits > 16; bits -= 16) |
| 57 | ✗ | ff_pce_copy_bits(pb, gb, 16); | |
| 58 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if (bits) |
| 59 | 18 | ff_pce_copy_bits(pb, gb, bits); | |
| 60 | 18 | align_put_bits(pb); | |
| 61 | 18 | align_get_bits(gb); | |
| 62 | 18 | comment_size = ff_pce_copy_bits(pb, gb, 8); | |
| 63 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | for (; comment_size > 0; comment_size--) |
| 64 | ✗ | ff_pce_copy_bits(pb, gb, 8); | |
| 65 | |||
| 66 | 18 | return put_bits_count(pb) - offset; | |
| 67 | } | ||
| 68 | |||
| 69 | #endif /* AVCODEC_MPEG4AUDIO_COPY_PCE_H */ | ||
| 70 |