2010-05-18 11:58:33 -04:00
|
|
|
/*
|
2010-09-09 08:16:39 -04:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 11:58:33 -04:00
|
|
|
*
|
2010-06-18 12:39:21 -04:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 16:19:40 -04:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 12:39:21 -04:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 16:19:40 -04:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 11:58:33 -04:00
|
|
|
*/
|
|
|
|
|
2012-11-27 11:16:15 -08:00
|
|
|
#include <assert.h>
|
2013-12-20 11:10:24 -08:00
|
|
|
#include "vp9/encoder/vp9_writer.h"
|
2013-05-08 10:04:14 -07:00
|
|
|
#include "vp9/common/vp9_entropy.h"
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2013-04-30 16:39:07 -07:00
|
|
|
void vp9_start_encode(vp9_writer *br, uint8_t *source) {
|
2012-07-13 15:21:29 -07:00
|
|
|
br->lowvalue = 0;
|
|
|
|
br->range = 255;
|
|
|
|
br->value = 0;
|
|
|
|
br->count = -24;
|
|
|
|
br->buffer = source;
|
|
|
|
br->pos = 0;
|
2013-06-06 18:03:44 -07:00
|
|
|
vp9_write_bit(br, 0);
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|
2013-04-30 16:39:07 -07:00
|
|
|
void vp9_stop_encode(vp9_writer *br) {
|
2012-07-13 15:21:29 -07:00
|
|
|
int i;
|
2010-05-18 11:58:33 -04:00
|
|
|
|
2012-07-13 15:21:29 -07:00
|
|
|
for (i = 0; i < 32; i++)
|
2013-05-07 18:19:50 -07:00
|
|
|
vp9_write_bit(br, 0);
|
2013-03-12 14:30:18 -07:00
|
|
|
|
|
|
|
// Ensure there's no ambigous collision with any index marker bytes
|
|
|
|
if ((br->buffer[br->pos - 1] & 0xe0) == 0xc0)
|
|
|
|
br->buffer[br->pos++] = 0;
|
2010-05-18 11:58:33 -04:00
|
|
|
}
|
|
|
|
|