/* * 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 <stdbool.h> #include "common/rawenc.h" // Number of bytes to write per batch in write_greyscale. #define BATCH_SIZE … // Interface to writing to either a file or MD5Context. Takes a pointer to // either the file or MD5Context, the buffer, the size of each element, and // number of elements to write. Note that size and nmemb (last two args) must // be unsigned int, as the interface to MD5Update requires that. WRITER; static void write_file(void *fp, const uint8_t *buffer, unsigned int size, unsigned int nmemb) { … } static void write_md5(void *md5, const uint8_t *buffer, unsigned int size, unsigned int nmemb) { … } // Writes out n neutral chroma samples (for greyscale). static void write_greyscale(const aom_image_t *img, int n, WRITER writer_func, void *file_or_md5) { … } // Encapsulates the logic for writing raw data to either an image file or // to an MD5 context. static void raw_write_image_file_or_md5(const aom_image_t *img, const int *planes, const int num_planes, void *file_or_md5, WRITER writer_func) { … } void raw_write_image_file(const aom_image_t *img, const int *planes, const int num_planes, FILE *file) { … } void raw_update_image_md5(const aom_image_t *img, const int *planes, const int num_planes, MD5Context *md5) { … }