FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/rv20enc.c
Date: 2025-06-01 09:29:47
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 1 1 100.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /*
2 * RV20 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 * RV20 encoder
26 */
27
28 #include "codec_internal.h"
29 #include "mpegvideo.h"
30 #include "mpegvideodata.h"
31 #include "mpegvideoenc.h"
32 #include "h263data.h"
33 #include "h263enc.h"
34 #include "put_bits.h"
35 #include "rv10enc.h"
36
37 150 int ff_rv20_encode_picture_header(MPVMainEncContext *const m)
38 {
39 150 MPVEncContext *const s = &m->s;
40
41 150 put_bits_assume_flushed(&s->pb);
42
43 150 put_bits(&s->pb, 2, s->c.pict_type); //I 0 vs. 1 ?
44 150 put_bits(&s->pb, 1, 0); /* unknown bit */
45 150 put_bits(&s->pb, 5, s->c.qscale);
46
47 150 put_sbits(&s->pb, 8, s->c.picture_number); //FIXME wrong, but correct is not known
48 150 s->c.mb_x = s->c.mb_y = 0;
49 150 ff_h263_encode_mba(s);
50
51 150 put_bits(&s->pb, 1, s->c.no_rounding);
52
53 av_assert1(s->f_code == 1);
54 av_assert1(!s->c.unrestricted_mv);
55 av_assert1(!s->c.alt_inter_vlc);
56 av_assert1(!s->c.umvplus);
57 av_assert1(s->c.modified_quant == 1);
58 av_assert1(s->c.loop_filter == 1);
59
60 150 s->c.h263_aic = s->c.pict_type == AV_PICTURE_TYPE_I;
61
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 135 times.
150 if (s->c.h263_aic) {
62 15 s->c.y_dc_scale_table =
63 15 s->c.c_dc_scale_table = ff_aic_dc_scale_table;
64 }else{
65 135 s->c.y_dc_scale_table =
66 135 s->c.c_dc_scale_table = ff_mpeg1_dc_scale_table;
67 }
68 150 return 0;
69 }
70
71 const FFCodec ff_rv20_encoder = {
72 .p.name = "rv20",
73 CODEC_LONG_NAME("RealVideo 2.0"),
74 .p.type = AVMEDIA_TYPE_VIDEO,
75 .p.id = AV_CODEC_ID_RV20,
76 .p.priv_class = &ff_mpv_enc_class,
77 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
78 .priv_data_size = sizeof(MPVMainEncContext),
79 .init = ff_mpv_encode_init,
80 FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
81 .close = ff_mpv_encode_end,
82 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
83 CODEC_PIXFMTS(AV_PIX_FMT_YUV420P),
84 .color_ranges = AVCOL_RANGE_MPEG,
85 };
86