OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 vp8_write_token(bc, vp8_bmode_tree, p, vp8_bmode_encodings + m); | 152 vp8_write_token(bc, vp8_bmode_tree, p, vp8_bmode_encodings + m); |
153 } | 153 } |
154 | 154 |
155 static void write_split(vp8_writer *bc, int x) | 155 static void write_split(vp8_writer *bc, int x) |
156 { | 156 { |
157 vp8_write_token( | 157 vp8_write_token( |
158 bc, vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings + x | 158 bc, vp8_mbsplit_tree, vp8_mbsplit_probs, vp8_mbsplit_encodings + x |
159 ); | 159 ); |
160 } | 160 } |
161 | 161 |
162 void vp8_pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount) | 162 void vp8_pack_tokens(vp8_writer *w, const TOKENEXTRA *p, int xcount) |
163 { | 163 { |
164 const TOKENEXTRA *stop = p + xcount; | 164 const TOKENEXTRA *stop = p + xcount; |
165 unsigned int split; | 165 unsigned int split; |
166 unsigned int shift; | 166 unsigned int shift; |
167 int count = w->count; | 167 int count = w->count; |
168 unsigned int range = w->range; | 168 unsigned int range = w->range; |
169 unsigned int lowvalue = w->lowvalue; | 169 unsigned int lowvalue = w->lowvalue; |
170 | 170 |
171 while (p < stop) | 171 while (p < stop) |
172 { | 172 { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 csize = size & 0xff; | 368 csize = size & 0xff; |
369 *cx_data = csize; | 369 *cx_data = csize; |
370 csize = (size >> 8) & 0xff; | 370 csize = (size >> 8) & 0xff; |
371 *(cx_data + 1) = csize; | 371 *(cx_data + 1) = csize; |
372 csize = (size >> 16) & 0xff; | 372 csize = (size >> 16) & 0xff; |
373 *(cx_data + 2) = csize; | 373 *(cx_data + 2) = csize; |
374 | 374 |
375 } | 375 } |
376 | 376 |
377 static void pack_tokens_into_partitions_c(VP8_COMP *cpi, unsigned char *cx_data, | 377 static void pack_tokens_into_partitions(VP8_COMP *cpi, unsigned char *cx_data, |
378 unsigned char * cx_data_end, | 378 unsigned char * cx_data_end, |
379 int num_part) | 379 int num_part) |
380 { | 380 { |
381 | 381 |
382 int i; | 382 int i; |
383 unsigned char *ptr = cx_data; | 383 unsigned char *ptr = cx_data; |
384 unsigned char *ptr_end = cx_data_end; | 384 unsigned char *ptr_end = cx_data_end; |
385 vp8_writer * w; | 385 vp8_writer * w; |
386 | 386 |
387 for (i = 0; i < num_part; i++) | 387 for (i = 0; i < num_part; i++) |
388 { | 388 { |
389 int mb_row; | 389 int mb_row; |
390 | 390 |
391 w = cpi->bc + i + 1; | 391 w = cpi->bc + i + 1; |
392 | 392 |
393 vp8_start_encode(w, ptr, ptr_end); | 393 vp8_start_encode(w, ptr, ptr_end); |
394 | 394 |
395 for (mb_row = i; mb_row < cpi->common.mb_rows; mb_row += num_part) | 395 for (mb_row = i; mb_row < cpi->common.mb_rows; mb_row += num_part) |
396 { | 396 { |
397 const TOKENEXTRA *p = cpi->tplist[mb_row].start; | 397 const TOKENEXTRA *p = cpi->tplist[mb_row].start; |
398 const TOKENEXTRA *stop = cpi->tplist[mb_row].stop; | 398 const TOKENEXTRA *stop = cpi->tplist[mb_row].stop; |
399 int tokens = (int)(stop - p); | 399 int tokens = (int)(stop - p); |
400 | 400 |
401 vp8_pack_tokens_c(w, p, tokens); | 401 vp8_pack_tokens(w, p, tokens); |
402 } | 402 } |
403 | 403 |
404 vp8_stop_encode(w); | 404 vp8_stop_encode(w); |
405 ptr += w->pos; | 405 ptr += w->pos; |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 static void pack_mb_row_tokens_c(VP8_COMP *cpi, vp8_writer *w) | 410 static void pack_mb_row_tokens(VP8_COMP *cpi, vp8_writer *w) |
411 { | 411 { |
412 int mb_row; | 412 int mb_row; |
413 | 413 |
414 for (mb_row = 0; mb_row < cpi->common.mb_rows; mb_row++) | 414 for (mb_row = 0; mb_row < cpi->common.mb_rows; mb_row++) |
415 { | 415 { |
416 const TOKENEXTRA *p = cpi->tplist[mb_row].start; | 416 const TOKENEXTRA *p = cpi->tplist[mb_row].start; |
417 const TOKENEXTRA *stop = cpi->tplist[mb_row].stop; | 417 const TOKENEXTRA *stop = cpi->tplist[mb_row].stop; |
418 int tokens = (int)(stop - p); | 418 int tokens = (int)(stop - p); |
419 | 419 |
420 vp8_pack_tokens_c(w, p, tokens); | 420 vp8_pack_tokens(w, p, tokens); |
421 } | 421 } |
422 | 422 |
423 } | 423 } |
424 | 424 |
425 static void write_mv_ref | 425 static void write_mv_ref |
426 ( | 426 ( |
427 vp8_writer *w, MB_PREDICTION_MODE m, const vp8_prob *p | 427 vp8_writer *w, MB_PREDICTION_MODE m, const vp8_prob *p |
428 ) | 428 ) |
429 { | 429 { |
430 #if CONFIG_DEBUG | 430 #if CONFIG_DEBUG |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 { | 1669 { |
1670 bc[1].error = &pc->error; | 1670 bc[1].error = &pc->error; |
1671 | 1671 |
1672 vp8_start_encode(&cpi->bc[1], cx_data, cx_data_end); | 1672 vp8_start_encode(&cpi->bc[1], cx_data, cx_data_end); |
1673 | 1673 |
1674 #if CONFIG_MULTITHREAD | 1674 #if CONFIG_MULTITHREAD |
1675 if (cpi->b_multi_threaded) | 1675 if (cpi->b_multi_threaded) |
1676 pack_mb_row_tokens(cpi, &cpi->bc[1]); | 1676 pack_mb_row_tokens(cpi, &cpi->bc[1]); |
1677 else | 1677 else |
1678 #endif | 1678 #endif |
1679 pack_tokens(&cpi->bc[1], cpi->tok, cpi->tok_count); | 1679 vp8_pack_tokens(&cpi->bc[1], cpi->tok, cpi->tok_count); |
1680 | 1680 |
1681 vp8_stop_encode(&cpi->bc[1]); | 1681 vp8_stop_encode(&cpi->bc[1]); |
1682 | 1682 |
1683 *size += cpi->bc[1].pos; | 1683 *size += cpi->bc[1].pos; |
1684 cpi->partition_sz[1] = cpi->bc[1].pos; | 1684 cpi->partition_sz[1] = cpi->bc[1].pos; |
1685 } | 1685 } |
1686 #endif | 1686 #endif |
1687 } | 1687 } |
1688 | 1688 |
1689 #ifdef VP8_ENTROPY_STATS | 1689 #ifdef VP8_ENTROPY_STATS |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 fprintf(f, " },\n"); | 1728 fprintf(f, " },\n"); |
1729 } | 1729 } |
1730 | 1730 |
1731 fprintf(f, " },\n"); | 1731 fprintf(f, " },\n"); |
1732 } | 1732 } |
1733 | 1733 |
1734 fprintf(f, "};\n"); | 1734 fprintf(f, "};\n"); |
1735 fclose(f); | 1735 fclose(f); |
1736 } | 1736 } |
1737 #endif | 1737 #endif |
OLD | NEW |