FFmpeg
mpegvideodec.h
Go to the documentation of this file.
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  */
51 
53 
55 /**
56  * Ensure that the dummy frames are allocated according to pict_type if necessary.
57  */
59 void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64]);
62 
64  const MPVPicture *p, int qp_type);
66 void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
67 void ff_mpeg_flush(AVCodecContext *avctx);
69 
70 void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict);
71 
72 static inline int mpeg_get_qscale(MpegEncContext *s)
73 {
74  int qscale = get_bits(&s->gb, 5);
75  if (s->q_scale_type)
76  return ff_mpeg2_non_linear_qscale[qscale];
77  else
78  return qscale << 1;
79 }
80 
81 static inline int check_marker(void *logctx, GetBitContext *s, const char *msg)
82 {
83  int bit = get_bits1(s);
84  if (!bit)
85  av_log(logctx, AV_LOG_INFO, "Marker bit missing at %d of %d %s\n",
86  get_bits_count(s) - 1, s->size_in_bits, msg);
87 
88  return bit;
89 }
90 
91 #endif /* AVCODEC_MPEGVIDEODEC_H */
ff_mpv_frame_start
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
Definition: mpegvideo_dec.c:344
ff_mpv_decode_init
int ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
Initialize the given MpegEncContext for decoding.
Definition: mpegvideo_dec.c:46
ff_mpv_export_qp_table
int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, const MPVPicture *p, int qp_type)
Definition: mpegvideo_dec.c:410
ff_mpeg_update_thread_context
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Definition: mpegvideo_dec.c:77
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:266
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
ff_mpeg2_non_linear_qscale
const uint8_t ff_mpeg2_non_linear_qscale[32]
Definition: mpegvideodata.c:26
mpegvideo.h
ff_mpv_report_decode_progress
void ff_mpv_report_decode_progress(MpegEncContext *s)
Definition: mpegvideo_dec.c:463
bit
#define bit(string, value)
Definition: cbs_mpeg2.c:56
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:335
GetBitContext
Definition: get_bits.h:108
s
#define s(width, name)
Definition: cbs_vp9.c:198
ff_mpeg_draw_horiz_band
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
Definition: mpegvideo_dec.c:441
get_bits.h
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:388
check_marker
static int check_marker(void *logctx, GetBitContext *s, const char *msg)
Definition: mpegvideodec.h:81
f
f
Definition: af_crystalizer.c:122
ff_mpv_reconstruct_mb
void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64])
Definition: mpegvideo_dec.c:910
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
frame.h
mpegpicture.h
mpegvideodata.h
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:220
ff_print_debug_info
void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict)
Definition: mpegvideo_dec.c:403
ff_mpv_alloc_dummy_frames
int ff_mpv_alloc_dummy_frames(MpegEncContext *s)
Ensure that the dummy frames are allocated according to pict_type if necessary.
Definition: mpegvideo_dec.c:301
log.h
ff_mpv_decode_close
int ff_mpv_decode_close(AVCodecContext *avctx)
Definition: mpegvideo_dec.c:163
avcodec.h
ff_mpv_common_frame_size_change
int ff_mpv_common_frame_size_change(MpegEncContext *s)
Definition: mpegvideo_dec.c:172
AVCodecContext
main external API structure.
Definition: avcodec.h:451
mpeg_get_qscale
static int mpeg_get_qscale(MpegEncContext *s)
Definition: mpegvideodec.h:72
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
h
h
Definition: vp9dsp_template.c:2070
MPVPicture
MPVPicture.
Definition: mpegpicture.h:58
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:73
ff_mpeg_flush
void ff_mpeg_flush(AVCodecContext *avctx)
Definition: mpegvideo_dec.c:449
src
#define src
Definition: vp8dsp.c:248
ff_mpv_frame_end
void ff_mpv_frame_end(MpegEncContext *s)
Definition: mpegvideo_dec.c:395