FFmpeg
rv10enc.c
Go to the documentation of this file.
1 /*
2  * RV10 encoder
3  * Copyright (c) 2000,2001 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  * RV10 encoder
26  */
27 
28 #include "mpegvideo.h"
29 #include "put_bits.h"
30 #include "rv10.h"
31 
33 {
34  int full_frame= 0;
35 
36  align_put_bits(&s->pb);
37 
38  put_bits(&s->pb, 1, 1); /* marker */
39 
40  put_bits(&s->pb, 1, (s->pict_type == AV_PICTURE_TYPE_P));
41 
42  put_bits(&s->pb, 1, 0); /* not PB-mframe */
43 
44  put_bits(&s->pb, 5, s->qscale);
45 
46  if (s->pict_type == AV_PICTURE_TYPE_I) {
47  /* specific MPEG like DC coding not used */
48  }
49  /* if multiple packets per frame are sent, the position at which
50  to display the macroblocks is coded here */
51  if(!full_frame){
52  if (s->mb_width * s->mb_height >= (1U << 12)) {
53  avpriv_report_missing_feature(s->avctx, "Encoding frames with %d (>= 4096) macroblocks",
54  s->mb_width * s->mb_height);
55  return AVERROR(ENOSYS);
56  }
57  put_bits(&s->pb, 6, 0); /* mb_x */
58  put_bits(&s->pb, 6, 0); /* mb_y */
59  put_bits(&s->pb, 12, s->mb_width * s->mb_height);
60  }
61 
62  put_bits(&s->pb, 3, 0); /* ignored */
63  return 0;
64 }
65 
67  .name = "rv10",
68  .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
69  .type = AVMEDIA_TYPE_VIDEO,
70  .id = AV_CODEC_ID_RV10,
71  .priv_class = &ff_mpv_enc_class,
72  .priv_data_size = sizeof(MpegEncContext),
74  .encode2 = ff_mpv_encode_picture,
75  .close = ff_mpv_encode_end,
78 };
AVCodec
AVCodec.
Definition: codec.h:202
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
align_put_bits
static void align_put_bits(PutBitContext *s)
Pad the bitstream with zeros up to the next byte boundary.
Definition: put_bits.h:412
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:220
mpegvideo.h
init
static int init
Definition: av_tx.c:47
U
#define U(x)
Definition: vp56_arith.h:37
s
#define s(width, name)
Definition: cbs_vp9.c:257
ff_mpv_encode_init
int ff_mpv_encode_init(AVCodecContext *avctx)
Definition: mpegvideo_enc.c:310
ff_mpv_encode_picture
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
Definition: mpegvideo_enc.c:1712
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
ff_rv10_encoder
const AVCodec ff_rv10_encoder
Definition: rv10enc.c:66
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
ff_rv10_encode_picture_header
int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
Definition: rv10enc.c:32
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
rv10.h
AV_CODEC_ID_RV10
@ AV_CODEC_ID_RV10
Definition: codec_id.h:55
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:50
ff_mpv_encode_end
int ff_mpv_encode_end(AVCodecContext *avctx)
Definition: mpegvideo_enc.c:965
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:209
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:275
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
ff_mpv_enc_class
const AVClass ff_mpv_enc_class
Definition: mpegvideo_enc.c:99
put_bits.h
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:71