gecko-dev/third_party/aom/common/rawenc.c
Thomas Daede a6f10c9181 Bug 1489285: Update libaom. r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D6206

--HG--
rename : third_party/aom/aom_ports/ppc.h => third_party/aom/aom_dsp/x86/sum_squares_sse2.h
rename : third_party/aom/av1/decoder/obu.h => third_party/aom/av1/common/obu_util.h
rename : third_party/aom/build/make/ios-Info.plist => third_party/aom/build/cmake/ios-Info.plist
rename : third_party/aom/build/make/iosbuild.sh => third_party/aom/build/cmake/iosbuild.sh
rename : third_party/aom/build/make/rtcd.pl => third_party/aom/build/cmake/rtcd.pl
rename : third_party/aom/common/y4menc.h => third_party/aom/common/rawenc.h
extra : moz-landing-system : lando
2018-09-19 21:27:06 +00:00

45 lines
1.7 KiB
C

/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "common/rawenc.h"
void raw_write_image_file(const aom_image_t *img, const int *planes,
const int num_planes, FILE *file) {
const int bytes_per_sample = ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 2 : 1);
for (int i = 0; i < num_planes; ++i) {
const int plane = planes[i];
const unsigned char *buf = img->planes[plane];
const int stride = img->stride[plane];
const int w = aom_img_plane_width(img, plane);
const int h = aom_img_plane_height(img, plane);
for (int y = 0; y < h; ++y) {
fwrite(buf, bytes_per_sample, w, file);
buf += stride;
}
}
}
void raw_update_image_md5(const aom_image_t *img, const int *planes,
const int num_planes, MD5Context *md5) {
for (int i = 0; i < num_planes; ++i) {
const int plane = planes[i];
const unsigned char *buf = img->planes[plane];
const int stride = img->stride[plane];
const int w = aom_img_plane_width(img, plane) *
((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) ? 2 : 1);
const int h = aom_img_plane_height(img, plane);
for (int y = 0; y < h; ++y) {
MD5Update(md5, buf, w);
buf += stride;
}
}
}