| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * RAW LCEVC video demuxer | ||
| 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 | #include "libavcodec/lcevc.h" | ||
| 22 | |||
| 23 | #include "avformat.h" | ||
| 24 | #include "rawdec.h" | ||
| 25 | |||
| 26 | 8363 | static int lcevc_probe(const AVProbeData *p) | |
| 27 | { | ||
| 28 | 8363 | uint32_t code = -1; | |
| 29 | 8363 | int idr = 0; | |
| 30 | int i; | ||
| 31 | |||
| 32 |
2/2✓ Branch 0 taken 403735250 times.
✓ Branch 1 taken 4219 times.
|
403739469 | for (i = 0; i < p->buf_size - 1; i++) { |
| 33 | 403735250 | code = (code << 8) + p->buf[i]; | |
| 34 |
2/2✓ Branch 0 taken 4147 times.
✓ Branch 1 taken 403731103 times.
|
403735250 | if ((code & 0xffffff00) == 0x100) { |
| 35 | 4147 | int nal2 = p->buf[i + 1]; | |
| 36 | 4147 | int type = (code & 0x3E) >> 1; | |
| 37 | |||
| 38 |
2/2✓ Branch 0 taken 1053 times.
✓ Branch 1 taken 3094 times.
|
4147 | if (code & 0x80) // forbidden zero bit |
| 39 | 1053 | return 0; | |
| 40 |
2/2✓ Branch 0 taken 2476 times.
✓ Branch 1 taken 618 times.
|
3094 | if (!(code & 0x40)) // forbidden one bit |
| 41 | 2476 | return 0; | |
| 42 |
4/4✓ Branch 0 taken 315 times.
✓ Branch 1 taken 303 times.
✓ Branch 2 taken 312 times.
✓ Branch 3 taken 3 times.
|
618 | if (!(code & 1) || nal2 != 0xff) // reserved ones |
| 43 | 615 | return 0; | |
| 44 | |||
| 45 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | switch (type) { |
| 46 | 2 | case LCEVC_IDR_NUT: idr++; break; | |
| 47 | } | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 4217 times.
|
4219 | if (idr) |
| 52 | 2 | return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg | |
| 53 | 4217 | return 0; | |
| 54 | } | ||
| 55 | |||
| 56 | FF_DEF_RAWVIDEO_DEMUXER(lcevc, "raw LCEVC video", lcevc_probe, "lcevc", AV_CODEC_ID_LCEVC) | ||
| 57 |