History

avcodec/magicyuvenc: Only keep in Slice what is used

Namely the number of counts.

Andreas Rheinhardt committed 1 year ago

Commit 4e0a29d1 parent a6c2c461 file · +6 −6Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/magicyuvenc.c+6−6
@@ -58,7 +58,7 @@ typedef struct Slice { · 57 unmodified lines
5858 unsigned size;
5959 uint8_t *slice;
6060 uint8_t *bitslice;
61− PTable counts[256];
61+ int64_t counts[256];
6262 } Slice;
6363
6464 typedef struct MagicYUVContext {
@@ -288,11 +288,11 @@ static void calculate_codes(HuffEntry *he, uint16_t codes_count[33]) · 223 unmodified lines
288288 }
289289
290290 static void count_usage(const uint8_t *src, int width,
291− int height, PTable *counts)
291+ int height, int64_t *counts)
292292 {
293293 for (int j = 0; j < height; j++) {
294294 for (int i = 0; i < width; i++)
295− counts[src[i]].prob++;
295+ counts[src[i]]++;
296296 src += width;
297297 }
298298 }
@@ -378,7 +378,7 @@ static int count_plane_slice(AVCodecContext *avctx, int n, int plane) · 79 unmodified lines
378378 MagicYUVContext *s = avctx->priv_data;
379379 Slice *sl = &s->slices[n * s->planes + plane];
380380 const uint8_t *dst = sl->slice;
381− PTable *counts = sl->counts;
381+ int64_t *counts = sl->counts;
382382 const int slice_height = s->slice_height;
383383 const int last_height = FFMIN(slice_height, avctx->height - n * slice_height);
384384 const int height = (n < (s->nb_slices - 1)) ? slice_height : last_height;
@@ -405,10 +405,10 @@ static int encode_table(AVCodecContext *avctx, · 20 unmodified lines
405405
406406 for (int n = 0; n < s->nb_slices; n++) {
407407 Slice *sl = &s->slices[n * s->planes + plane];
408− PTable *slice_counts = sl->counts;
408+ int64_t *slice_counts = sl->counts;
409409
410410 for (int i = 0; i < 256; i++)
411− counts[i].prob += slice_counts[i].prob;
411+ counts[i].prob += slice_counts[i];
412412 }
413413
414414 magy_huffman_compute_bits(counts, he, codes_counts, 256, 12);

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