About 1% better compression with large slices
Unified · Split
| @@ -108,14 +108,14 @@ typedef struct FFV1SliceContext { · 107 unmodified lines | ||
| 108 | 108 | }; |
| 109 | 109 | int remap_count[4]; |
| 110 | 110 | |
| 111 | − uint16_t *bitmap [4]; //float encode | |
| 111 | + uint32_t *bitmap [4]; //float encode | |
| 112 | 112 | uint16_t *fltmap [4]; //halffloat encode & decode |
| 113 | 113 | uint32_t *fltmap32[4]; //float decode |
| 114 | 114 | unsigned int fltmap_size[4]; |
| 115 | 115 | unsigned int fltmap32_size[4]; |
| 116 | 116 | struct Unit { |
| 117 | 117 | uint32_t val; //this is unneeded if you accept a dereference on each access |
| 118 | − uint16_t ndx; | |
| 118 | + uint32_t ndx; | |
| 119 | 119 | } *unit[4]; |
| 120 | 120 | } FFV1SliceContext; |
| 121 | 121 | |
| @@ -577,9 +577,6 @@ int ff_ffv1_encode_determine_slices(AVCodecContext *avctx) · 576 unmodified lines | ||
| 577 | 577 | continue; |
| 578 | 578 | if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24) |
| 579 | 579 | continue; |
| 580 | − if (s->bits_per_raw_sample == 32) | |
| 581 | − if (maxw * maxh > 65536) | |
| 582 | − continue; | |
| 583 | 580 | if (s->version < 4) |
| 584 | 581 | if ( ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift) |
| 585 | 582 | ||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 | ||
| 1382 | 1379 | |
| 1383 | 1380 | if (update) { |
| 1384 | 1381 | sc->c = rc; |
| 1385 | − av_assert0(compact_index <= 65535); | |
| 1386 | 1382 | sc->remap_count[p] = compact_index + 1; |
| 1387 | 1383 | } |
| 1388 | 1384 | return get_rac_count(&rc); |
| @@ -1400,8 +1396,6 @@ static void encode_float32_remap(FFV1Context *f, FFV1SliceContext *sc, · 11 unmodified lines | ||
| 1400 | 1396 | const int stair_mode = ((int[]){ 0, 0, 0, 1, 0, 0})[f->remap_optimizer]; |
| 1401 | 1397 | const int magic_log2 = ((int[]){ 1, 1, 1, 1, 0, 0})[f->remap_optimizer]; |
| 1402 | 1398 | |
| 1403 | − av_assert0 (pixel_num <= 65536); | |
| 1404 | − | |
| 1405 | 1399 | for (int p= 0; p < 1 + 2*f->chroma_planes + f->transparency; p++) { |
| 1406 | 1400 | int best_log2_mul_count = 0; |
| 1407 | 1401 | float score_sum[11] = {0}; |