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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 data_sz = MIN(sizeof(clear_buffer), data_sz); | 115 data_sz = MIN(sizeof(clear_buffer), data_sz); |
116 decrypt_cb(decrypt_state, data, clear_buffer, data_sz); | 116 decrypt_cb(decrypt_state, data, clear_buffer, data_sz); |
117 data = clear_buffer; | 117 data = clear_buffer; |
118 } | 118 } |
119 | 119 |
120 { | 120 { |
121 int show_frame; | 121 int show_frame; |
122 int error_resilient; | 122 int error_resilient; |
123 struct vp9_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL }; | 123 struct vp9_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL }; |
124 const int frame_marker = vp9_rb_read_literal(&rb, 2); | 124 const int frame_marker = vp9_rb_read_literal(&rb, 2); |
125 const int version = vp9_rb_read_bit(&rb); | 125 const BITSTREAM_PROFILE profile = vp9_read_profile(&rb); |
126 (void) vp9_rb_read_bit(&rb); // unused version bit | |
127 | 126 |
128 if (frame_marker != VP9_FRAME_MARKER) | 127 if (frame_marker != VP9_FRAME_MARKER) |
129 return VPX_CODEC_UNSUP_BITSTREAM; | 128 return VPX_CODEC_UNSUP_BITSTREAM; |
130 | 129 |
131 if (version > 1) return VPX_CODEC_UNSUP_BITSTREAM; | 130 if (profile >= MAX_PROFILES) return VPX_CODEC_UNSUP_BITSTREAM; |
132 | 131 |
133 if (vp9_rb_read_bit(&rb)) { // show an existing frame | 132 if (vp9_rb_read_bit(&rb)) { // show an existing frame |
134 vp9_rb_read_literal(&rb, 3); // Frame buffer to show. | 133 vp9_rb_read_literal(&rb, 3); // Frame buffer to show. |
135 return VPX_CODEC_OK; | 134 return VPX_CODEC_OK; |
136 } | 135 } |
137 | 136 |
138 if (data_sz <= 8) | 137 if (data_sz <= 8) |
139 return VPX_CODEC_UNSUP_BITSTREAM; | 138 return VPX_CODEC_UNSUP_BITSTREAM; |
140 | 139 |
141 si->is_kf = !vp9_rb_read_bit(&rb); | 140 si->is_kf = !vp9_rb_read_bit(&rb); |
142 show_frame = vp9_rb_read_bit(&rb); | 141 show_frame = vp9_rb_read_bit(&rb); |
143 error_resilient = vp9_rb_read_bit(&rb); | 142 error_resilient = vp9_rb_read_bit(&rb); |
144 | 143 |
145 if (si->is_kf) { | 144 if (si->is_kf) { |
146 const int sRGB = 7; | 145 const int sRGB = 7; |
147 int colorspace; | 146 int colorspace; |
148 | 147 |
149 if (!vp9_read_sync_code(&rb)) | 148 if (!vp9_read_sync_code(&rb)) |
150 return VPX_CODEC_UNSUP_BITSTREAM; | 149 return VPX_CODEC_UNSUP_BITSTREAM; |
151 | 150 |
| 151 if (profile > PROFILE_1) |
| 152 rb.bit_offset += 1; // Bit-depth 10 or 12 |
152 colorspace = vp9_rb_read_literal(&rb, 3); | 153 colorspace = vp9_rb_read_literal(&rb, 3); |
153 if (colorspace != sRGB) { | 154 if (colorspace != sRGB) { |
154 rb.bit_offset += 1; // [16,235] (including xvycc) vs [0,255] range | 155 rb.bit_offset += 1; // [16,235] (including xvycc) vs [0,255] range |
155 if (version == 1) { | 156 if (profile == PROFILE_1 || profile == PROFILE_3) { |
156 rb.bit_offset += 2; // subsampling x/y | 157 rb.bit_offset += 2; // subsampling x/y |
157 rb.bit_offset += 1; // has extra plane | 158 rb.bit_offset += 1; // has extra plane |
158 } | 159 } |
159 } else { | 160 } else { |
160 if (version == 1) { | 161 if (profile == PROFILE_1 || profile == PROFILE_3) { |
161 rb.bit_offset += 1; // has extra plane | 162 rb.bit_offset += 1; // has extra plane |
162 } else { | 163 } else { |
163 // RGB is only available in version 1 | 164 // RGB is only available in version 1 |
164 return VPX_CODEC_UNSUP_BITSTREAM; | 165 return VPX_CODEC_UNSUP_BITSTREAM; |
165 } | 166 } |
166 } | 167 } |
167 vp9_read_frame_size(&rb, (int *)&si->w, (int *)&si->h); | 168 vp9_read_frame_size(&rb, (int *)&si->w, (int *)&si->h); |
168 } else { | 169 } else { |
169 intra_only_flag = show_frame ? 0 : vp9_rb_read_bit(&rb); | 170 intra_only_flag = show_frame ? 0 : vp9_rb_read_bit(&rb); |
170 rb.bit_offset += error_resilient ? 0 : 2; // reset_frame_context | 171 rb.bit_offset += error_resilient ? 0 : 2; // reset_frame_context |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 { // NOLINT | 709 { // NOLINT |
709 NOT_IMPLEMENTED, // vpx_codec_enc_cfg_map_t | 710 NOT_IMPLEMENTED, // vpx_codec_enc_cfg_map_t |
710 NOT_IMPLEMENTED, // vpx_codec_encode_fn_t | 711 NOT_IMPLEMENTED, // vpx_codec_encode_fn_t |
711 NOT_IMPLEMENTED, // vpx_codec_get_cx_data_fn_t | 712 NOT_IMPLEMENTED, // vpx_codec_get_cx_data_fn_t |
712 NOT_IMPLEMENTED, // vpx_codec_enc_config_set_fn_t | 713 NOT_IMPLEMENTED, // vpx_codec_enc_config_set_fn_t |
713 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t | 714 NOT_IMPLEMENTED, // vpx_codec_get_global_headers_fn_t |
714 NOT_IMPLEMENTED, // vpx_codec_get_preview_frame_fn_t | 715 NOT_IMPLEMENTED, // vpx_codec_get_preview_frame_fn_t |
715 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t | 716 NOT_IMPLEMENTED // vpx_codec_enc_mr_get_mem_loc_fn_t |
716 } | 717 } |
717 }; | 718 }; |
OLD | NEW |