avcodec/h263enc: Remove no-output code
The no-output mode (guarded by AV_CODEC_FLAG2_NO_OUTPUT)
does not provide a noteworthy speedup; in fact, it even
turned out to be slower than the code with the no-output
code removed (ordinary encode: 153259721 decicycles,
noout encode: 153259721; encode with this patch applied:
152451581 decicycles; timings are for encode_frame callbacks
when encoding a 1080p sample to MPEG-4).
(Furthermore, this code was broken for most of its existence
(since 9207dc3b0d
) and no one
noticed, so the no-output mode is probably not used at all.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
d40b46f47c
commit
646ace34cd
@ -37,36 +37,11 @@ void ff_clean_h263_qscales(MpegEncContext *s);
|
||||
void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);
|
||||
void ff_h263_update_mb(MpegEncContext *s);
|
||||
|
||||
static inline int h263_get_motion_length(int val, int f_code)
|
||||
{
|
||||
int bit_size, code, sign;
|
||||
|
||||
if (val == 0) {
|
||||
return 1; /* ff_mvtab[0][1] */
|
||||
} else {
|
||||
bit_size = f_code - 1;
|
||||
/* modulo encoding */
|
||||
val = sign_extend(val, 6 + bit_size);
|
||||
sign = val >> 31;
|
||||
val = (val ^ sign) - sign; /* val = FFABS(val) */
|
||||
val--;
|
||||
code = (val >> bit_size) + 1;
|
||||
|
||||
return ff_mvtab[code][1] + 1 + bit_size;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ff_h263_encode_motion_vector(MpegEncContext * s,
|
||||
int x, int y, int f_code)
|
||||
{
|
||||
if (s->avctx->flags2 & AV_CODEC_FLAG2_NO_OUTPUT) {
|
||||
skip_put_bits(&s->pb,
|
||||
h263_get_motion_length(x, f_code) +
|
||||
h263_get_motion_length(y, f_code));
|
||||
} else {
|
||||
ff_h263_encode_motion(&s->pb, x, f_code);
|
||||
ff_h263_encode_motion(&s->pb, y, f_code);
|
||||
}
|
||||
ff_h263_encode_motion(&s->pb, x, f_code);
|
||||
ff_h263_encode_motion(&s->pb, y, f_code);
|
||||
}
|
||||
|
||||
static inline int get_p_cbp(MpegEncContext * s,
|
||||
|
Loading…
Reference in New Issue
Block a user