| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * MPEGVideo decoders header | ||
| 3 | * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | ||
| 4 | * Copyright (c) 2002-2004 Michael Niedermayer | ||
| 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 | * mpegvideo decoder header. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef AVCODEC_MPEGVIDEODEC_H | ||
| 29 | #define AVCODEC_MPEGVIDEODEC_H | ||
| 30 | |||
| 31 | #include "libavutil/frame.h" | ||
| 32 | #include "libavutil/log.h" | ||
| 33 | |||
| 34 | #include "avcodec.h" | ||
| 35 | #include "get_bits.h" | ||
| 36 | #include "mpegpicture.h" | ||
| 37 | #include "mpegvideo.h" | ||
| 38 | #include "mpegvideodata.h" | ||
| 39 | |||
| 40 | #define FF_MPV_QSCALE_TYPE_MPEG1 0 | ||
| 41 | #define FF_MPV_QSCALE_TYPE_MPEG2 1 | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Initialize the given MpegEncContext for decoding. | ||
| 45 | * the changed fields will not depend upon | ||
| 46 | * the prior state of the MpegEncContext. | ||
| 47 | * | ||
| 48 | * Also initialize the picture pool. | ||
| 49 | */ | ||
| 50 | int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx); | ||
| 51 | |||
| 52 | int ff_mpv_common_frame_size_change(MpegEncContext *s); | ||
| 53 | |||
| 54 | int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx); | ||
| 55 | /** | ||
| 56 | * Ensure that the dummy frames are allocated according to pict_type if necessary. | ||
| 57 | */ | ||
| 58 | int ff_mpv_alloc_dummy_frames(MpegEncContext *s); | ||
| 59 | void ff_mpv_reconstruct_mb(MPVContext *s, int16_t block[][64]); | ||
| 60 | void ff_mpv_frame_end(MpegEncContext *s); | ||
| 61 | |||
| 62 | int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, | ||
| 63 | const MPVPicture *p, int qp_type); | ||
| 64 | /** | ||
| 65 | * update_thread_context for mpegvideo-based decoders. It updates | ||
| 66 | * the MPVPictures and generic stream-level parameters. If necessary | ||
| 67 | * (on dimension changes), it also performs reinitialization. | ||
| 68 | * | ||
| 69 | * @retval 1 if a reinitialization happened | ||
| 70 | * @retval 0 on success if no reinitialization happened | ||
| 71 | * @retval "<0" error code | ||
| 72 | */ | ||
| 73 | int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); | ||
| 74 | void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); | ||
| 75 | void ff_mpeg_flush(AVCodecContext *avctx); | ||
| 76 | int ff_mpv_decode_close(AVCodecContext *avctx); | ||
| 77 | |||
| 78 | void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict); | ||
| 79 | |||
| 80 | 440441 | static inline int mpeg_get_qscale(GetBitContext *const gb, int q_scale_type) | |
| 81 | { | ||
| 82 | 440441 | int qscale = get_bits(gb, 5); | |
| 83 |
2/2✓ Branch 0 taken 383444 times.
✓ Branch 1 taken 56997 times.
|
440441 | if (q_scale_type) |
| 84 | 383444 | return ff_mpeg2_non_linear_qscale[qscale]; | |
| 85 | else | ||
| 86 | 56997 | return qscale << 1; | |
| 87 | } | ||
| 88 | |||
| 89 | 25306 | static inline int check_marker(void *logctx, GetBitContext *s, const char *msg) | |
| 90 | { | ||
| 91 | 25306 | int bit = get_bits1(s); | |
| 92 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25306 times.
|
25306 | if (!bit) |
| 93 | ✗ | av_log(logctx, AV_LOG_INFO, "Marker bit missing at %d of %d %s\n", | |
| 94 | ✗ | get_bits_count(s) - 1, s->size_in_bits, msg); | |
| 95 | |||
| 96 | 25306 | return bit; | |
| 97 | } | ||
| 98 | |||
| 99 | #endif /* AVCODEC_MPEGVIDEODEC_H */ | ||
| 100 |