1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/flvenc: Move ff_flv2_encode_ac_esc() to ituh263enc.c

This is the only place where it is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-05-25 22:20:23 +02:00
parent 61d34c2b8e
commit 514e5ea0db
3 changed files with 23 additions and 27 deletions

View File

@ -67,28 +67,6 @@ int ff_flv_encode_picture_header(MPVMainEncContext *const m)
return 0;
}
void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
int run, int last)
{
unsigned code;
int bits;
if (level < 64) { // 7-bit level
bits = 1 + 1 + 6 + 7;
code = (0 << (1 + 6 + 7)) |
(last << (6 + 7)) |
(run << 7) |
(slevel & 0x7f);
} else {
/* 11-bit level */
bits = 1 + 1 + 6 + 11;
code = (1 << (1 + 6 + 11)) |
(last << (6 + 11)) |
(run << 11) |
(slevel & 0x7ff);
}
put_bits(pb, bits, code);
}
const FFCodec ff_flv_encoder = {
.p.name = "flv",
CODEC_LONG_NAME("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),

View File

@ -21,12 +21,8 @@
#ifndef AVCODEC_FLVENC_H
#define AVCODEC_FLVENC_H
#include "put_bits.h"
typedef struct MPVMainEncContext MPVMainEncContext;
int ff_flv_encode_picture_header(MPVMainEncContext *const m);
void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run,
int last);
#endif /* AVCODEC_FLV_H */

View File

@ -417,6 +417,28 @@ void ff_clean_h263_qscales(MPVEncContext *const s)
static const int dquant_code[5]= {1,0,9,2,3};
static void flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
int run, int last)
{
unsigned code;
int bits;
if (level < 64) { // 7-bit level
bits = 1 + 1 + 6 + 7;
code = (0 << (1 + 6 + 7)) |
(last << (6 + 7)) |
(run << 7) |
(slevel & 0x7f);
} else {
/* 11-bit level */
bits = 1 + 1 + 6 + 11;
code = (1 << (1 + 6 + 11)) |
(last << (6 + 11)) |
(run << 11) |
(slevel & 0x7ff);
}
put_bits(pb, bits, code);
}
/**
* Encode an 8x8 block.
* @param block the 8x8 block
@ -522,7 +544,7 @@ static void h263_encode_block(MPVEncContext *const s, int16_t block[], int n)
put_sbits(&s->pb, 6, slevel>>5);
}
} else {
ff_flv2_encode_ac_esc(&s->pb, slevel, level, run, last);
flv2_encode_ac_esc(&s->pb, slevel, level, run, last);
}
} else {
put_bits(&s->pb, 1, sign);