FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/rv10enc.c
Date: 2025-04-25 22:50:00
Exec Total Coverage
Lines: 16 19 84.2%
Functions: 1 1 100.0%
Branches: 2 4 50.0%

Line Branch Exec Source
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
34 175 int ff_rv10_encode_picture_header(MPVMainEncContext *const m)
35 {
36 175 MPVEncContext *const s = &m->s;
37 175 int full_frame= 0;
38
39 175 align_put_bits(&s->pb);
40
41 175 put_bits(&s->pb, 1, 1); /* marker */
42
43 175 put_bits(&s->pb, 1, (s->c.pict_type == AV_PICTURE_TYPE_P));
44
45 175 put_bits(&s->pb, 1, 0); /* not PB-mframe */
46
47 175 put_bits(&s->pb, 5, s->c.qscale);
48
49 175 if (s->c.pict_type == AV_PICTURE_TYPE_I) {
50 /* specific MPEG like DC coding not used */
51 }
52 /* if multiple packets per frame are sent, the position at which
53 to display the macroblocks is coded here */
54
1/2
✓ Branch 0 taken 175 times.
✗ Branch 1 not taken.
175 if(!full_frame){
55
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 175 times.
175 if (s->c.mb_width * s->c.mb_height >= (1U << 12)) {
56 avpriv_report_missing_feature(s->c.avctx, "Encoding frames with %d (>= 4096) macroblocks",
57 s->c.mb_width * s->c.mb_height);
58 return AVERROR(ENOSYS);
59 }
60 175 put_bits(&s->pb, 6, 0); /* mb_x */
61 175 put_bits(&s->pb, 6, 0); /* mb_y */
62 175 put_bits(&s->pb, 12, s->c.mb_width * s->c.mb_height);
63 }
64
65 175 put_bits(&s->pb, 3, 0); /* ignored */
66 175 return 0;
67 }
68
69 const FFCodec ff_rv10_encoder = {
70 .p.name = "rv10",
71 CODEC_LONG_NAME("RealVideo 1.0"),
72 .p.type = AVMEDIA_TYPE_VIDEO,
73 .p.id = AV_CODEC_ID_RV10,
74 .p.priv_class = &ff_mpv_enc_class,
75 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
76 .priv_data_size = sizeof(MPVMainEncContext),
77 .init = ff_mpv_encode_init,
78 FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
79 .close = ff_mpv_encode_end,
80 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
81 CODEC_PIXFMTS(AV_PIX_FMT_YUV420P),
82 .color_ranges = AVCOL_RANGE_MPEG,
83 };
84