| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return VPX_CODEC_OK; | 105 return VPX_CODEC_OK; |
| 106 } | 106 } |
| 107 | 107 |
| 108 static vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data, | 108 static vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data, |
| 109 unsigned int data_sz, | 109 unsigned int data_sz, |
| 110 vpx_codec_stream_info_t *si, | 110 vpx_codec_stream_info_t *si, |
| 111 vpx_decrypt_cb decrypt_cb, | 111 vpx_decrypt_cb decrypt_cb, |
| 112 void *decrypt_state) { | 112 void *decrypt_state) { |
| 113 uint8_t clear_buffer[9]; | 113 uint8_t clear_buffer[9]; |
| 114 | 114 |
| 115 if (data_sz <= 8) | |
| 116 return VPX_CODEC_UNSUP_BITSTREAM; | |
| 117 | |
| 118 if (data + data_sz <= data) | 115 if (data + data_sz <= data) |
| 119 return VPX_CODEC_INVALID_PARAM; | 116 return VPX_CODEC_INVALID_PARAM; |
| 120 | 117 |
| 121 si->is_kf = 0; | 118 si->is_kf = 0; |
| 122 si->w = si->h = 0; | 119 si->w = si->h = 0; |
| 123 | 120 |
| 124 if (decrypt_cb) { | 121 if (decrypt_cb) { |
| 125 data_sz = MIN(sizeof(clear_buffer), data_sz); | 122 data_sz = MIN(sizeof(clear_buffer), data_sz); |
| 126 decrypt_cb(decrypt_state, data, clear_buffer, data_sz); | 123 decrypt_cb(decrypt_state, data, clear_buffer, data_sz); |
| 127 data = clear_buffer; | 124 data = clear_buffer; |
| 128 } | 125 } |
| 129 | 126 |
| 130 { | 127 { |
| 131 struct vp9_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL }; | 128 struct vp9_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL }; |
| 132 const int frame_marker = vp9_rb_read_literal(&rb, 2); | 129 const int frame_marker = vp9_rb_read_literal(&rb, 2); |
| 133 const int version = vp9_rb_read_bit(&rb); | 130 const int version = vp9_rb_read_bit(&rb); |
| 134 (void) vp9_rb_read_bit(&rb); // unused version bit | 131 (void) vp9_rb_read_bit(&rb); // unused version bit |
| 135 | 132 |
| 136 if (frame_marker != VP9_FRAME_MARKER) | 133 if (frame_marker != VP9_FRAME_MARKER) |
| 137 return VPX_CODEC_UNSUP_BITSTREAM; | 134 return VPX_CODEC_UNSUP_BITSTREAM; |
| 135 |
| 138 if (version > 1) return VPX_CODEC_UNSUP_BITSTREAM; | 136 if (version > 1) return VPX_CODEC_UNSUP_BITSTREAM; |
| 139 | 137 |
| 140 if (vp9_rb_read_bit(&rb)) { // show an existing frame | 138 if (vp9_rb_read_bit(&rb)) { // show an existing frame |
| 141 return VPX_CODEC_OK; | 139 return VPX_CODEC_OK; |
| 142 } | 140 } |
| 143 | 141 |
| 142 if (data_sz <= 8) |
| 143 return VPX_CODEC_UNSUP_BITSTREAM; |
| 144 |
| 144 si->is_kf = !vp9_rb_read_bit(&rb); | 145 si->is_kf = !vp9_rb_read_bit(&rb); |
| 145 if (si->is_kf) { | 146 if (si->is_kf) { |
| 146 const int sRGB = 7; | 147 const int sRGB = 7; |
| 147 int colorspace; | 148 int colorspace; |
| 148 | 149 |
| 149 rb.bit_offset += 1; // show frame | 150 rb.bit_offset += 1; // show frame |
| 150 rb.bit_offset += 1; // error resilient | 151 rb.bit_offset += 1; // error resilient |
| 151 | 152 |
| 152 if (vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_0 || | 153 if (vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_0 || |
| 153 vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_1 || | 154 vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_1 || |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 { // NOLINT | 803 { // NOLINT |
| 803 NOT_IMPLEMENTED, // vpx_codec_enc_cfg_map_t | 804 NOT_IMPLEMENTED, // vpx_codec_enc_cfg_map_t |
| 804 NOT_IMPLEMENTED, // vpx_codec_encode_fn_t | 805 NOT_IMPLEMENTED, // vpx_codec_encode_fn_t |
| 805 NOT_IMPLEMENTED, // vpx_codec_get_cx_data_fn_t | 806 NOT_IMPLEMENTED, // vpx_codec_get_cx_data_fn_t |
| 806 NOT_IMPLEMENTED, // vpx_codec_enc_config_set_fn_t | 807 NOT_IMPLEMENTED, // vpx_codec_enc_config_set_fn_t |
| 807 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t | 808 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t |
| 808 NOT_IMPLEMENTED, // vpx_codec_get_preview_frame_fn_t | 809 NOT_IMPLEMENTED, // vpx_codec_get_preview_frame_fn_t |
| 809 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t | 810 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t |
| 810 } | 811 } |
| 811 }; | 812 }; |
| OLD | NEW |