2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02: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 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
2012-11-27 20:16:15 +01:00
|
|
|
#include <assert.h>
|
2013-12-20 20:10:24 +01:00
|
|
|
#include "vp9/encoder/vp9_writer.h"
|
2013-05-08 19:04:14 +02:00
|
|
|
#include "vp9/common/vp9_entropy.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2013-05-01 01:39:07 +02:00
|
|
|
void vp9_start_encode(vp9_writer *br, uint8_t *source) {
|
2012-07-14 00:21:29 +02:00
|
|
|
br->lowvalue = 0;
|
|
|
|
br->range = 255;
|
|
|
|
br->value = 0;
|
|
|
|
br->count = -24;
|
|
|
|
br->buffer = source;
|
|
|
|
br->pos = 0;
|
2013-06-07 03:03:44 +02:00
|
|
|
vp9_write_bit(br, 0);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2013-05-01 01:39:07 +02:00
|
|
|
void vp9_stop_encode(vp9_writer *br) {
|
2012-07-14 00:21:29 +02:00
|
|
|
int i;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 32; i++)
|
2013-05-08 03:19:50 +02:00
|
|
|
vp9_write_bit(br, 0);
|
2013-03-12 22:30:18 +01: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 17:58:33 +02:00
|
|
|
}
|
|
|
|
|