Namely the number of counts.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -58,7 +58,7 @@ typedef struct Slice { · 57 unmodified lines | ||
| 58 | 58 | unsigned size; |
| 59 | 59 | uint8_t *slice; |
| 60 | 60 | uint8_t *bitslice; |
| 61 | − PTable counts[256]; | |
| 61 | + int64_t counts[256]; | |
| 62 | 62 | } Slice; |
| 63 | 63 | |
| 64 | 64 | typedef struct MagicYUVContext { |
| @@ -288,11 +288,11 @@ static void calculate_codes(HuffEntry *he, uint16_t codes_count[33]) · 223 unmodified lines | ||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | static void count_usage(const uint8_t *src, int width, |
| 291 | − int height, PTable *counts) | |
| 291 | + int height, int64_t *counts) | |
| 292 | 292 | { |
| 293 | 293 | for (int j = 0; j < height; j++) { |
| 294 | 294 | for (int i = 0; i < width; i++) |
| 295 | − counts[src[i]].prob++; | |
| 295 | + counts[src[i]]++; | |
| 296 | 296 | src += width; |
| 297 | 297 | } |
| 298 | 298 | } |
| @@ -378,7 +378,7 @@ static int count_plane_slice(AVCodecContext *avctx, int n, int plane) · 79 unmodified lines | ||
| 378 | 378 | MagicYUVContext *s = avctx->priv_data; |
| 379 | 379 | Slice *sl = &s->slices[n * s->planes + plane]; |
| 380 | 380 | const uint8_t *dst = sl->slice; |
| 381 | − PTable *counts = sl->counts; | |
| 381 | + int64_t *counts = sl->counts; | |
| 382 | 382 | const int slice_height = s->slice_height; |
| 383 | 383 | const int last_height = FFMIN(slice_height, avctx->height - n * slice_height); |
| 384 | 384 | 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 | ||
| 405 | 405 | |
| 406 | 406 | for (int n = 0; n < s->nb_slices; n++) { |
| 407 | 407 | Slice *sl = &s->slices[n * s->planes + plane]; |
| 408 | − PTable *slice_counts = sl->counts; | |
| 408 | + int64_t *slice_counts = sl->counts; | |
| 409 | 409 | |
| 410 | 410 | for (int i = 0; i < 256; i++) |
| 411 | − counts[i].prob += slice_counts[i].prob; | |
| 411 | + counts[i].prob += slice_counts[i]; | |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | magy_huffman_compute_bits(counts, he, codes_counts, 256, 12); |