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 "codec_internal.h" 29#include "mpegvideo.h" 30#include "mpegvideoenc.h" 31#include "put_bits.h" 32#include "rv10enc.h" 33 34int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number) 35{ 36 int full_frame= 0; 37 38 align_put_bits(&s->pb); 39 40 put_bits(&s->pb, 1, 1); /* marker */ 41 42 put_bits(&s->pb, 1, (s->pict_type == AV_PICTURE_TYPE_P)); 43 44 put_bits(&s->pb, 1, 0); /* not PB-mframe */ 45 46 put_bits(&s->pb, 5, s->qscale); 47 48 if (s->pict_type == AV_PICTURE_TYPE_I) { 49 /* specific MPEG like DC coding not used */ 50 } 51 /* if multiple packets per frame are sent, the position at which 52 to display the macroblocks is coded here */ 53 if(!full_frame){ 54 if (s->mb_width * s->mb_height >= (1U << 12)) { 55 avpriv_report_missing_feature(s->avctx, "Encoding frames with %d (>= 4096) macroblocks", 56 s->mb_width * s->mb_height); 57 return AVERROR(ENOSYS); 58 } 59 put_bits(&s->pb, 6, 0); /* mb_x */ 60 put_bits(&s->pb, 6, 0); /* mb_y */ 61 put_bits(&s->pb, 12, s->mb_width * s->mb_height); 62 } 63 64 put_bits(&s->pb, 3, 0); /* ignored */ 65 return 0; 66} 67 68const FFCodec ff_rv10_encoder = { 69 .p.name = "rv10", 70 .p.long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), 71 .p.type = AVMEDIA_TYPE_VIDEO, 72 .p.id = AV_CODEC_ID_RV10, 73 .p.priv_class = &ff_mpv_enc_class, 74 .priv_data_size = sizeof(MpegEncContext), 75 .init = ff_mpv_encode_init, 76 FF_CODEC_ENCODE_CB(ff_mpv_encode_picture), 77 .close = ff_mpv_encode_end, 78 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, 79 .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, 80}; 81