FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/rv20enc.c
Date: 2025-04-25 22:50:00
Exec Total Coverage
Lines: 22 22 100.0%
Functions: 1 1 100.0%
Branches: 8 14 57.1%

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(&s->pb, 2, s->c.pict_type); //I 0 vs. 1 ?
42 150 put_bits(&s->pb, 1, 0); /* unknown bit */
43 150 put_bits(&s->pb, 5, s->c.qscale);
44
45 150 put_sbits(&s->pb, 8, s->c.picture_number); //FIXME wrong, but correct is not known
46 150 s->c.mb_x = s->c.mb_y = 0;
47 150 ff_h263_encode_mba(s);
48
49 150 put_bits(&s->pb, 1, s->c.no_rounding);
50
51
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_assert0(s->c.f_code == 1);
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_assert0(!s->c.unrestricted_mv);
53
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_assert0(!s->c.alt_inter_vlc);
54
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_assert0(!s->c.umvplus);
55
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_assert0(s->c.modified_quant==1);
56
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
150 av_assert0(s->c.loop_filter==1);
57
58 150 s->c.h263_aic = s->c.pict_type == AV_PICTURE_TYPE_I;
59
2/2
✓ Branch 0 taken 15 times.
✓ Branch 1 taken 135 times.
150 if (s->c.h263_aic) {
60 15 s->c.y_dc_scale_table =
61 15 s->c.c_dc_scale_table = ff_aic_dc_scale_table;
62 }else{
63 135 s->c.y_dc_scale_table =
64 135 s->c.c_dc_scale_table = ff_mpeg1_dc_scale_table;
65 }
66 150 return 0;
67 }
68
69 const FFCodec ff_rv20_encoder = {
70 .p.name = "rv20",
71 CODEC_LONG_NAME("RealVideo 2.0"),
72 .p.type = AVMEDIA_TYPE_VIDEO,
73 .p.id = AV_CODEC_ID_RV20,
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