mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
avcodec/flashsvenc: add compression_level option
This allows setting the compression level used by zlib. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
3827233187
commit
3661d1982d
@ -67,6 +67,7 @@ typedef struct FlashSVContext {
|
||||
unsigned packet_size;
|
||||
int64_t last_key_frame;
|
||||
uint8_t tmpblock[3 * 256 * 256];
|
||||
int compression_level;
|
||||
} FlashSVContext;
|
||||
|
||||
static int copy_region_enc(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,
|
||||
@ -121,6 +122,10 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
|
||||
nb_blocks = h_blocks * v_blocks;
|
||||
s->packet_size = 4 + nb_blocks * (2 + 3 * BLOCK_WIDTH * BLOCK_HEIGHT);
|
||||
|
||||
s->compression_level = avctx->compression_level == FF_COMPRESSION_DEFAULT
|
||||
? Z_DEFAULT_COMPRESSION
|
||||
: av_clip(avctx->compression_level, 0, 9);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -170,9 +175,10 @@ static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf,
|
||||
p->linesize[0], previous_frame);
|
||||
|
||||
if (res || *I_frame) {
|
||||
unsigned long zsize = 3 * block_width * block_height;
|
||||
unsigned long zsize = 3 * block_width * block_height + 12;
|
||||
ret = compress2(ptr + 2, &zsize, s->tmpblock,
|
||||
3 * cur_blk_width * cur_blk_height, 9);
|
||||
3 * cur_blk_width * cur_blk_height,
|
||||
s->compression_level);
|
||||
|
||||
if (ret != Z_OK)
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
|
@ -1,4 +1,4 @@
|
||||
97894502b4cb57aca1105b6333f72dae *tests/data/fate/vsynth1-flashsv.flv
|
||||
61b0825258ac6fe85691bdefd892960d *tests/data/fate/vsynth1-flashsv.flv
|
||||
14681925 tests/data/fate/vsynth1-flashsv.flv
|
||||
791e1fb999deb2e4156e2286d48c4ed1 *tests/data/fate/vsynth1-flashsv.out.rawvideo
|
||||
stddev: 2.84 PSNR: 39.04 MAXDIFF: 49 bytes: 7603200/ 7603200
|
||||
|
@ -1,4 +1,4 @@
|
||||
f4b45770dd93b43b4077532e8ef90bfc *tests/data/fate/vsynth2-flashsv.flv
|
||||
11636546 tests/data/fate/vsynth2-flashsv.flv
|
||||
a2f145e6e44b51f8fc64ead06a994273 *tests/data/fate/vsynth2-flashsv.flv
|
||||
11637702 tests/data/fate/vsynth2-flashsv.flv
|
||||
7f0fc12c02e68faddc153e69ddd6841c *tests/data/fate/vsynth2-flashsv.out.rawvideo
|
||||
stddev: 1.20 PSNR: 46.52 MAXDIFF: 20 bytes: 7603200/ 7603200
|
||||
|
@ -1,4 +1,4 @@
|
||||
832fe60169f4d91339458c60a5292924 *tests/data/fate/vsynth3-flashsv.flv
|
||||
a05a9ab0ae21925dd10a83639de77d77 *tests/data/fate/vsynth3-flashsv.flv
|
||||
171419 tests/data/fate/vsynth3-flashsv.flv
|
||||
faa660b0ecaaab1bf9b5d7284019aa01 *tests/data/fate/vsynth3-flashsv.out.rawvideo
|
||||
stddev: 2.97 PSNR: 38.67 MAXDIFF: 49 bytes: 86700/ 86700
|
||||
|
@ -1,4 +1,4 @@
|
||||
0667077971e0cb63b5f49c580006e90e *tests/data/fate/vsynth_lena-flashsv.flv
|
||||
59cdcf5f92c5113e27b2fda632ccd55c *tests/data/fate/vsynth_lena-flashsv.flv
|
||||
12368953 tests/data/fate/vsynth_lena-flashsv.flv
|
||||
3a984506f1ebfc9fb73b6814cab201cc *tests/data/fate/vsynth_lena-flashsv.out.rawvideo
|
||||
stddev: 0.66 PSNR: 51.73 MAXDIFF: 14 bytes: 7603200/ 7603200
|
||||
|
Loading…
x
Reference in New Issue
Block a user