History

avcodec/ffv1enc: Remove 65536 pixel per slice limit for remap

About 1% better compression with large slices

Michael Niedermayer committed 1 year ago

Commit 1b04fb31 parent feceed92 files · +2 −8Browse files

Unified · Split

2 files
  1. libavcodec/ffv1.h +2 −2
  2. libavcodec/ffv1enc.c +0 −6
libavcodec/ffv1.h+2−2
@@ -108,14 +108,14 @@ typedef struct FFV1SliceContext { · 107 unmodified lines
108108 };
109109 int remap_count[4];
110110
111− uint16_t *bitmap [4]; //float encode
111+ uint32_t *bitmap [4]; //float encode
112112 uint16_t *fltmap [4]; //halffloat encode & decode
113113 uint32_t *fltmap32[4]; //float decode
114114 unsigned int fltmap_size[4];
115115 unsigned int fltmap32_size[4];
116116 struct Unit {
117117 uint32_t val; //this is unneeded if you accept a dereference on each access
118− uint16_t ndx;
118+ uint32_t ndx;
119119 } *unit[4];
120120 } FFV1SliceContext;
121121
libavcodec/ffv1enc.c+0−6
@@ -577,9 +577,6 @@ int ff_ffv1_encode_determine_slices(AVCodecContext *avctx) · 576 unmodified lines
577577 continue;
578578 if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
579579 continue;
580− if (s->bits_per_raw_sample == 32)
581− if (maxw * maxh > 65536)
582− continue;
583580 if (s->version < 4)
584581 if ( ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift)
585582 ||ff_need_new_slices(avctx->height, s->num_v_slices, s->chroma_v_shift))
@@ -1382,7 +1379,6 @@ static int encode_float32_remap_segment(FFV1SliceContext *sc, · 796 unmodified lines
13821379
13831380 if (update) {
13841381 sc->c = rc;
1385− av_assert0(compact_index <= 65535);
13861382 sc->remap_count[p] = compact_index + 1;
13871383 }
13881384 return get_rac_count(&rc);
@@ -1400,8 +1396,6 @@ static void encode_float32_remap(FFV1Context *f, FFV1SliceContext *sc, · 11 unmodified lines
14001396 const int stair_mode = ((int[]){ 0, 0, 0, 1, 0, 0})[f->remap_optimizer];
14011397 const int magic_log2 = ((int[]){ 1, 1, 1, 1, 0, 0})[f->remap_optimizer];
14021398
1403− av_assert0 (pixel_num <= 65536);
1404−
14051399 for (int p= 0; p < 1 + 2*f->chroma_planes + f->transparency; p++) {
14061400 int best_log2_mul_count = 0;
14071401 float score_sum[11] = {0};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t