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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 die_codec(&codec, "Failed to initialize encoder"); | 194 die_codec(&codec, "Failed to initialize encoder"); |
195 | 195 |
196 frame_avail = 1; | 196 frame_avail = 1; |
197 got_data = 0; | 197 got_data = 0; |
198 while(frame_avail || got_data) { | 198 while(frame_avail || got_data) { |
199 vpx_codec_iter_t iter = NULL; | 199 vpx_codec_iter_t iter = NULL; |
200 const vpx_codec_cx_pkt_t *pkt; | 200 const vpx_codec_cx_pkt_t *pkt; |
201 | 201 |
202 if(frame_cnt + 1 == 22) { | 202 if(frame_cnt + 1 == 22) { |
203 vpx_roi_map_t roi; | 203 vpx_roi_map_t roi; |
204 int i; | 204 unsigned int i; |
205 | 205 |
206 roi.rows = cfg.g_h/16; | 206 roi.rows = cfg.g_h/16; |
207 roi.cols = cfg.g_w/16; | 207 roi.cols = cfg.g_w/16; |
208 | 208 |
209 roi.delta_q[0] = 0; | 209 roi.delta_q[0] = 0; |
210 roi.delta_q[1] = -2; | 210 roi.delta_q[1] = -2; |
211 roi.delta_q[2] = -4; | 211 roi.delta_q[2] = -4; |
212 roi.delta_q[3] = -6; | 212 roi.delta_q[3] = -6; |
213 | 213 |
214 roi.delta_lf[0] = 0; | 214 roi.delta_lf[0] = 0; |
(...skipping 10 matching lines...) Expand all Loading... |
225 roi.roi_map = malloc(roi.rows * roi.cols); | 225 roi.roi_map = malloc(roi.rows * roi.cols); |
226 for(i=0;i<roi.rows*roi.cols;i++) | 226 for(i=0;i<roi.rows*roi.cols;i++) |
227 roi.roi_map[i] = i & 3; | 227 roi.roi_map[i] = i & 3; |
228 | 228 |
229 if(vpx_codec_control(&codec, VP8E_SET_ROI_MAP, &roi)) | 229 if(vpx_codec_control(&codec, VP8E_SET_ROI_MAP, &roi)) |
230 die_codec(&codec, "Failed to set ROI map"); | 230 die_codec(&codec, "Failed to set ROI map"); |
231 | 231 |
232 free(roi.roi_map); | 232 free(roi.roi_map); |
233 } else if(frame_cnt + 1 == 33) { | 233 } else if(frame_cnt + 1 == 33) { |
234 vpx_active_map_t active; | 234 vpx_active_map_t active; |
235 int i; | 235 unsigned int i; |
236 | 236 |
237 active.rows = cfg.g_h/16; | 237 active.rows = cfg.g_h/16; |
238 active.cols = cfg.g_w/16; | 238 active.cols = cfg.g_w/16; |
239 | 239 |
240 /* generate active map for example */ | 240 /* generate active map for example */ |
241 active.active_map = malloc(active.rows * active.cols); | 241 active.active_map = malloc(active.rows * active.cols); |
242 for(i=0;i<active.rows*active.cols;i++) | 242 for(i=0;i<active.rows*active.cols;i++) |
243 active.active_map[i] = i & 1; | 243 active.active_map[i] = i & 1; |
244 | 244 |
245 if(vpx_codec_control(&codec, VP8E_SET_ACTIVEMAP, &active)) | 245 if(vpx_codec_control(&codec, VP8E_SET_ACTIVEMAP, &active)) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 vpx_img_free(&raw); | 287 vpx_img_free(&raw); |
288 if(vpx_codec_destroy(&codec)) | 288 if(vpx_codec_destroy(&codec)) |
289 die_codec(&codec, "Failed to destroy codec"); | 289 die_codec(&codec, "Failed to destroy codec"); |
290 | 290 |
291 /* Try to rewrite the file header with the actual frame count */ | 291 /* Try to rewrite the file header with the actual frame count */ |
292 if(!fseek(outfile, 0, SEEK_SET)) | 292 if(!fseek(outfile, 0, SEEK_SET)) |
293 write_ivf_file_header(outfile, &cfg, frame_cnt-1); | 293 write_ivf_file_header(outfile, &cfg, frame_cnt-1); |
294 fclose(outfile); | 294 fclose(outfile); |
295 return EXIT_SUCCESS; | 295 return EXIT_SUCCESS; |
296 } | 296 } |
OLD | NEW |