Nathan E. Egge | 8043cc4 | 2016-03-06 12:42:47 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
| 3 | * |
| 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
| 10 | */ |
| 11 | |
| 12 | #include <string.h> |
| 13 | #include "aom_dsp/daalaboolwriter.h" |
| 14 | |
| 15 | void aom_daala_start_encode(daala_writer *br, uint8_t *source) { |
| 16 | br->buffer = source; |
| 17 | br->pos = 0; |
| 18 | od_ec_enc_init(&br->ec, 62025); |
| 19 | } |
| 20 | |
| 21 | void aom_daala_stop_encode(daala_writer *br) { |
| 22 | uint32_t daala_bytes; |
| 23 | unsigned char *daala_data; |
| 24 | daala_data = od_ec_enc_done(&br->ec, &daala_bytes); |
| 25 | memcpy(br->buffer, daala_data, daala_bytes); |
| 26 | br->pos = daala_bytes; |
Nathan E. Egge | e734fcb | 2016-10-14 07:07:03 -0400 | [diff] [blame] | 27 | od_ec_enc_clear(&br->ec); |
Nathan E. Egge | 8043cc4 | 2016-03-06 12:42:47 -0500 | [diff] [blame] | 28 | } |