FFmpeg
Loading...
Searching...
No Matches
mpegpicture.h
Go to the documentation of this file.
1/*
2 * Mpeg video formats-related defines and utility functions
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_MPEGPICTURE_H
22#define AVCODEC_MPEGPICTURE_H
23
24#include <limits.h>
25#include <stddef.h>
26#include <stdint.h>
27
28#include "avcodec.h"
29#include "threadprogress.h"
30
31#define MPV_MAX_PLANES 3
32#define EDGE_WIDTH 16
33
34typedef struct ScratchpadContext {
35 uint8_t *edge_emu_buffer; ///< temporary buffer for if MVs point to out-of-frame data
37 union {
38 uint8_t *scratchpad_buf; ///< the other *_scratchpad point into this buffer
39 uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision
40 };
41 int linesize; ///< linesize that the buffers in this context have been allocated for
43
44typedef struct BufferPoolContext {
50 int alloc_mb_width; ///< mb_width used to allocate tables
51 int alloc_mb_height; ///< mb_height used to allocate tables
52 int alloc_mb_stride; ///< mb_stride used to allocate tables
54
55/**
56 * MPVPicture.
57 */
58typedef struct MPVPicture {
59 struct AVFrame *f;
60
62 int8_t *qscale_table;
63
64 int16_t (*motion_val_base[2])[2];
65 int16_t (*motion_val[2])[2];
66
67 uint32_t *mb_type_base;
68 uint32_t *mb_type; ///< types and macros are defined in mpegutils.h
69
70 uint8_t *mbskip_table;
71
72 int8_t *ref_index[2];
73
74 /// RefStruct reference for hardware accelerator private data
76
77 int mb_width; ///< mb_width of the tables
78 int mb_height; ///< mb_height of the tables
79 int mb_stride; ///< mb_stride of the tables
80
81 int dummy; ///< Picture is a dummy and should not be output
82 int field_picture; ///< whether or not the picture was encoded in separate fields
83
85
87 int shared;
88
91
94
95typedef struct MPVWorkPicture {
98
99 MPVPicture *ptr; ///< RefStruct reference
100
102
103 int16_t (*motion_val[2])[2];
104
105 uint32_t *mb_type; ///< types and macros are defined in mpegutils.h
106
107 uint8_t *mbskip_table;
108
109 int8_t *ref_index[2];
110
113
114/**
115 * Allocate a pool of MPVPictures.
116 */
117struct AVRefStructPool *ff_mpv_alloc_pic_pool(int init_progress);
118
119/**
120 * Allocate an MPVPicture's accessories (but not the AVFrame's buffer itself)
121 * and set the MPVWorkPicture's fields.
122 */
125 BufferPoolContext *pools, int mb_height);
126
127/**
128 * Check that the linesizes of an AVFrame are consistent with the requirements
129 * of mpegvideo.
130 * FIXME: There should be no need for this function. mpegvideo should be made
131 * to work with changing linesizes.
132 */
133int ff_mpv_pic_check_linesize(void *logctx, const struct AVFrame *f,
134 ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep);
135
137 ScratchpadContext *sc, int linesize);
138
139/**
140 * Disable allocating the ScratchpadContext's buffers in future calls
141 * to ff_mpv_framesize_alloc().
142 */
144{
145 sc->linesize = INT_MAX;
146}
147
151
152#endif /* AVCODEC_MPEGPICTURE_H */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
Libavcodec external API header.
#define f(width, name)
Definition cbs_vp8.c:236
void ff_mpv_unref_picture(MPVWorkPicture *pic)
Definition mpegpicture.c:98
void ff_mpv_workpic_from_pic(MPVWorkPicture *wpic, MPVPicture *pic)
static void ff_mpv_framesize_disable(ScratchpadContext *sc)
Disable allocating the ScratchpadContext's buffers in future calls to ff_mpv_framesize_alloc().
struct AVRefStructPool * ff_mpv_alloc_pic_pool(int init_progress)
Allocate a pool of MPVPictures.
Definition mpegpicture.c:90
#define MPV_MAX_PLANES
Definition mpegpicture.h:31
int ff_mpv_alloc_pic_accessories(AVCodecContext *avctx, MPVWorkPicture *pic, ScratchpadContext *sc, BufferPoolContext *pools, int mb_height)
Allocate an MPVPicture's accessories (but not the AVFrame's buffer itself) and set the MPVWorkPicture...
int ff_mpv_pic_check_linesize(void *logctx, const struct AVFrame *f, ptrdiff_t *linesizep, ptrdiff_t *uvlinesizep)
Check that the linesizes of an AVFrame are consistent with the requirements of mpegvideo.
void ff_mpv_replace_picture(MPVWorkPicture *dst, const MPVWorkPicture *src)
int ff_mpv_framesize_alloc(AVCodecContext *avctx, ScratchpadContext *sc, int linesize)
main external API structure.
Definition avcodec.h:443
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
AVRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
Definition refstruct.c:183
struct AVRefStructPool * mbskip_table_pool
Definition mpegpicture.h:45
struct AVRefStructPool * mb_type_pool
Definition mpegpicture.h:47
struct AVRefStructPool * ref_index_pool
Definition mpegpicture.h:49
struct AVRefStructPool * qscale_table_pool
Definition mpegpicture.h:46
int alloc_mb_width
mb_width used to allocate tables
Definition mpegpicture.h:50
struct AVRefStructPool * motion_val_pool
Definition mpegpicture.h:48
int alloc_mb_stride
mb_stride used to allocate tables
Definition mpegpicture.h:52
int alloc_mb_height
mb_height used to allocate tables
Definition mpegpicture.h:51
MPVPicture.
Definition mpegpicture.h:58
ThreadProgress progress
Definition mpegpicture.h:92
int b_frame_score
Definition mpegpicture.h:84
int16_t(*[2] motion_val_base)[2]
Definition mpegpicture.h:64
int dummy
Picture is a dummy and should not be output.
Definition mpegpicture.h:81
uint32_t * mb_type_base
Definition mpegpicture.h:67
uint32_t * mb_type
types and macros are defined in mpegutils.h
Definition mpegpicture.h:68
struct AVFrame * f
Definition mpegpicture.h:59
int display_picture_number
Definition mpegpicture.h:89
int coded_picture_number
Definition mpegpicture.h:90
int field_picture
whether or not the picture was encoded in separate fields
Definition mpegpicture.h:82
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.
Definition mpegpicture.h:75
int mb_height
mb_height of the tables
Definition mpegpicture.h:78
int mb_stride
mb_stride of the tables
Definition mpegpicture.h:79
int16_t(*[2] motion_val)[2]
Definition mpegpicture.h:65
int mb_width
mb_width of the tables
Definition mpegpicture.h:77
uint8_t * mbskip_table
Definition mpegpicture.h:70
int8_t * ref_index[2]
Definition mpegpicture.h:72
int8_t * qscale_table_base
Definition mpegpicture.h:61
int8_t * qscale_table
Definition mpegpicture.h:62
uint32_t * mb_type
types and macros are defined in mpegutils.h
MPVPicture * ptr
RefStruct reference.
Definition mpegpicture.h:99
int16_t(*[2] motion_val)[2]
ptrdiff_t linesize[MPV_MAX_PLANES]
Definition mpegpicture.h:97
int8_t * ref_index[2]
uint8_t * data[MPV_MAX_PLANES]
Definition mpegpicture.h:96
uint8_t * mbskip_table
int8_t * qscale_table
int linesize
linesize that the buffers in this context have been allocated for
Definition mpegpicture.h:41
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
Definition mpegpicture.h:35
uint8_t * obmc_scratchpad
Definition mpegpicture.h:36
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
Definition mpegpicture.h:39
uint8_t * scratchpad_buf
the other *_scratchpad point into this buffer
Definition mpegpicture.h:38
ThreadProgress is an API to easily notify other threads about progress of any kind as long as it can ...
#define src
Definition vp8dsp.c:248