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 | unsigned size; | 58 | unsigned size; |
| 59 | uint8_t *slice; | 59 | uint8_t *slice; |
| 60 | uint8_t *bitslice; | 60 | uint8_t *bitslice; |
| 61 | PTable counts[256]; | 61 | int64_t counts[256]; |
| 62 | } Slice; | 62 | } Slice; |
| 63 | 63 | ||
| 64 | typedef struct MagicYUVContext { | 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 | static void count_usage(const uint8_t *src, int width, | 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 | for (int j = 0; j < height; j++) { | 293 | for (int j = 0; j < height; j++) { |
| 294 | for (int i = 0; i < width; i++) | 294 | for (int i = 0; i < width; i++) |
| 295 | counts[src[i]].prob++; | 295 | counts[src[i]]++; |
| 296 | src += width; | 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 | MagicYUVContext *s = avctx->priv_data; | 378 | MagicYUVContext *s = avctx->priv_data; |
| 379 | Slice *sl = &s->slices[n * s->planes + plane]; | 379 | Slice *sl = &s->slices[n * s->planes + plane]; |
| 380 | const uint8_t *dst = sl->slice; | 380 | const uint8_t *dst = sl->slice; |
| 381 | PTable *counts = sl->counts; | 381 | int64_t *counts = sl->counts; |
| 382 | const int slice_height = s->slice_height; | 382 | const int slice_height = s->slice_height; |
| 383 | const int last_height = FFMIN(slice_height, avctx->height - n * slice_height); | 383 | const int last_height = FFMIN(slice_height, avctx->height - n * slice_height); |
| 384 | const int height = (n < (s->nb_slices - 1)) ? slice_height : last_height; | 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 | for (int n = 0; n < s->nb_slices; n++) { | 406 | for (int n = 0; n < s->nb_slices; n++) { |
| 407 | Slice *sl = &s->slices[n * s->planes + plane]; | 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 | for (int i = 0; i < 256; i++) | 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 | magy_huffman_compute_bits(counts, he, codes_counts, 256, 12); | 414 | magy_huffman_compute_bits(counts, he, codes_counts, 256, 12); |