FFmpeg: libavcodec/v210dec.c Source File
Go to the documentation of this file. 1 /*
2 * V210 decoder
3 *
4 * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
5 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
34
40
42 {
44
47
51
52 return 0;
53 }
54
57 {
60
62
67
74 }
75
78
82
84 *
u++ = (
val >> 10) & 0x3FF;
85 *y++ = (
val >> 20) & 0x3FF;
88
90 *y++ = (
val >> 10) & 0x3FF;
91
93 *
u++ = (
val >> 20) & 0x3FF;
96 *v++ = (
val >> 10) & 0x3FF;
97
99 *y++ = (
val >> 20) & 0x3FF;
100 }
101 }
102 }
103 }
104 }
105 }
106
108 {
119
121 decode_row((
const uint32_t *)psrc, py, pu, pv, avctx->
width,
s->unpack_frame);
123 py +=
frame->linesize[0] / 2;
124 pu +=
frame->linesize[1] / 2;
125 pv +=
frame->linesize[2] / 2;
126 }
127
128 return 0;
129 }
130
133 return aligned_width * 8 / 3;
134 }
135
138 {
142 const uint8_t *psrc = avpkt->
data;
143
144 if (
s->custom_stride )
145 stride =
s->custom_stride > 0 ?
s->custom_stride : 0;
146 else {
152 if (avpkt->
size == small_stride * avctx->
height) {
154 if (!
s->stride_warning_shown)
156 s->stride_warning_shown = 1;
157 break;
158 }
159 }
160 if (align < 6 && avctx->codec_tag ==
MKTAG(
'b',
'x',
'y',
'2'))
162 }
163 }
164
168 }
169
174 }
179 psrc += 64;
180
181 aligned_input = !((uintptr_t)psrc & 0x1f) && !(
stride & 0x1f);
182 if (aligned_input !=
s->aligned_input) {
183 s->aligned_input = aligned_input;
185 }
186
189
195 } else {
197 int linesizes[4];
205 }
206
208 /* we have interlaced material flagged in container */
212 }
213
214 *got_frame = 1;
215
217 }
218
219 #define V210DEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
224 };
225
231 };
232
245 };
static const AVOption v210dec_options[]
#define AV_LOG_WARNING
Something somehow does not look correct.
static int v210_stride(int width, int align)
static av_cold int decode_init(AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
#define u(width, name, range_min, range_max)
enum AVFieldOrder field_order
Field order.
#define READ_PIXELS(a, b, c)
static int decode_frame(AVCodecContext *avctx, AVFrame *pic, int *got_frame, AVPacket *avpkt)
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
@ AV_FIELD_TT
Top coded_first, top displayed first.
AVCodec p
The public AVCodec.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
static void unpack_frame(EVRCContext *e)
Frame unpacking for RATE_FULL, RATE_HALF and RATE_QUANT.
static double val(void *priv, double ch)
@ AV_FIELD_TB
Top coded first, bottom displayed first.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_CODEC_DECODE_CB(func)
static av_unused av_cold void ff_v210dec_init(V210DecContext *s)
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Undefined Behavior In the C some operations are like signed integer dereferencing freed pointers
#define CODEC_LONG_NAME(str)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const char * av_default_item_name(void *ptr)
Return the context name.
#define AV_PIX_FMT_YUV422P10
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)
Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static const uint8_t *BS_FUNC() align(BSCTX *bc)
Skip bits to a byte boundary.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
const FFCodec ff_v210_decoder
static const AVClass v210dec_class
Used for passing data between threads.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
static void decode_row(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, const int width, void(*unpack_frame)(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width))
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
@ AV_OPT_TYPE_INT
Underlying C type is int.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This structure stores compressed data.
static int v210_decode_slice(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
Generated on Fri Oct 17 2025 19:22:38 for FFmpeg by
doxygen
1.8.17