OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 "b239c6b301c0b835485be349ca83a7e3"}, | 50 "b239c6b301c0b835485be349ca83a7e3"}, |
51 {"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, | 51 {"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, |
52 "5a6481a550821dab6d0192f5c63845e9"}, | 52 "5a6481a550821dab6d0192f5c63845e9"}, |
53 }; | 53 }; |
54 | 54 |
55 static void write_image_file(const vpx_image_t *img, FILE *file) { | 55 static void write_image_file(const vpx_image_t *img, FILE *file) { |
56 int plane, y; | 56 int plane, y; |
57 for (plane = 0; plane < 3; ++plane) { | 57 for (plane = 0; plane < 3; ++plane) { |
58 const unsigned char *buf = img->planes[plane]; | 58 const unsigned char *buf = img->planes[plane]; |
59 const int stride = img->stride[plane]; | 59 const int stride = img->stride[plane]; |
60 const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGH) ? 2 : 1; | 60 const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1; |
61 const int h = (plane ? (img->d_h + img->y_chroma_shift) >> | 61 const int h = (plane ? (img->d_h + img->y_chroma_shift) >> |
62 img->y_chroma_shift : img->d_h); | 62 img->y_chroma_shift : img->d_h); |
63 const int w = (plane ? (img->d_w + img->x_chroma_shift) >> | 63 const int w = (plane ? (img->d_w + img->x_chroma_shift) >> |
64 img->x_chroma_shift : img->d_w); | 64 img->x_chroma_shift : img->d_w); |
65 for (y = 0; y < h; ++y) { | 65 for (y = 0; y < h; ++y) { |
66 fwrite(buf, bytes_per_sample, w, file); | 66 fwrite(buf, bytes_per_sample, w, file); |
67 buf += stride; | 67 buf += stride; |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 TEST_P(Y4mVideoWriteTest, WriteTest) { | 184 TEST_P(Y4mVideoWriteTest, WriteTest) { |
185 const Y4mTestParam t = GetParam(); | 185 const Y4mTestParam t = GetParam(); |
186 Init(t.filename, kFrames); | 186 Init(t.filename, kFrames); |
187 HeaderChecks(t.bit_depth, t.format); | 187 HeaderChecks(t.bit_depth, t.format); |
188 Md5Check(t.md5raw); | 188 Md5Check(t.md5raw); |
189 } | 189 } |
190 | 190 |
191 INSTANTIATE_TEST_CASE_P(C, Y4mVideoWriteTest, | 191 INSTANTIATE_TEST_CASE_P(C, Y4mVideoWriteTest, |
192 ::testing::ValuesIn(kY4mTestVectors)); | 192 ::testing::ValuesIn(kY4mTestVectors)); |
193 } // namespace | 193 } // namespace |
OLD | NEW |