ref: 4334c07357e70b2653e83abb3601680c8366d677
parent: 4632a96d9771b49d6edfe78b68e5dfbafa75fff3
author: Dmitry Kovalev <[email protected]>
date: Wed Feb 26 11:32:09 EST 2014
Reusing mem_get_le{16, 32} defined in vpx_ports/mem_opts.h. Change-Id: If4b5209ac14aaba6f1c1014bc0497baa8eabfaff
--- a/examples.mk
+++ b/examples.mk
@@ -19,6 +19,8 @@
# while EXAMPLES demonstrate specific portions of the API.
UTILS-$(CONFIG_DECODERS) += vpxdec.c
vpxdec.SRCS += md5_utils.c md5_utils.h
+vpxdec.SRCS += vpx_ports/mem_ops.h
+vpxdec.SRCS += vpx_ports/mem_ops_aligned.h
vpxdec.SRCS += vpx_ports/vpx_timer.h
vpxdec.SRCS += vpx/vpx_integer.h
vpxdec.SRCS += args.c args.h
@@ -85,6 +87,8 @@
simple_decoder.SRCS += tools_common.h tools_common.c
simple_decoder.SRCS += video_common.h
simple_decoder.SRCS += video_reader.h video_reader.c
+simple_decoder.SRCS += vpx_ports/mem_ops.h
+simple_decoder.SRCS += vpx_ports/mem_ops_aligned.h
simple_decoder.DESCRIPTION = Simplified decoder loop
EXAMPLES-$(CONFIG_VP8_DECODER) += postproc.c
postproc.SRCS += ivfdec.h ivfdec.c
@@ -91,6 +95,8 @@
postproc.SRCS += tools_common.h tools_common.c
postproc.SRCS += video_common.h
postproc.SRCS += video_reader.h video_reader.c
+postproc.SRCS += vpx_ports/mem_ops.h
+postproc.SRCS += vpx_ports/mem_ops_aligned.h
postproc.GUID = 65E33355-F35E-4088-884D-3FD4905881D7
postproc.DESCRIPTION = Decoder postprocessor control
EXAMPLES-$(CONFIG_VP8_DECODER) += decode_to_md5.c
@@ -99,6 +105,8 @@
decode_to_md5.SRCS += tools_common.h tools_common.c
decode_to_md5.SRCS += video_common.h
decode_to_md5.SRCS += video_reader.h video_reader.c
+decode_to_md5.SRCS += vpx_ports/mem_ops.h
+decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h
decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
EXAMPLES-$(CONFIG_VP8_ENCODER) += simple_encoder.c
@@ -124,6 +132,8 @@
decode_with_drops.SRCS += tools_common.h tools_common.c
decode_with_drops.SRCS += video_common.h
decode_with_drops.SRCS += video_reader.h video_reader.c
+decode_with_drops.SRCS += vpx_ports/mem_ops.h
+decode_with_drops.SRCS += vpx_ports/mem_ops_aligned.h
endif
decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
decode_with_drops.DESCRIPTION = Drops frames while decoding
--- a/ivfdec.c
+++ b/ivfdec.c
@@ -12,6 +12,8 @@
#include <stdlib.h>
#include <string.h>
+#include "vpx_ports/mem_ops.h"
+
#include "./ivfdec.h"
static const char *IVF_SIGNATURE = "DKIF";
--- a/tools_common.c
+++ b/tools_common.c
@@ -77,26 +77,6 @@
exit(EXIT_FAILURE);
}
-uint16_t mem_get_le16(const void *data) {
- uint16_t val;
- const uint8_t *mem = (const uint8_t*)data;
-
- val = mem[1] << 8;
- val |= mem[0];
- return val;
-}
-
-uint32_t mem_get_le32(const void *data) {
- uint32_t val;
- const uint8_t *mem = (const uint8_t*)data;
-
- val = mem[3] << 24;
- val |= mem[2] << 16;
- val |= mem[1] << 8;
- val |= mem[0];
- return val;
-}
-
int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) {
FILE *f = input_ctx->file;
struct FileTypeDetectionBuffer *detect = &input_ctx->detect;
--- a/tools_common.h
+++ b/tools_common.h
@@ -118,9 +118,6 @@
/* The tool including this file must define usage_exit() */
void usage_exit();
-uint16_t mem_get_le16(const void *data);
-uint32_t mem_get_le32(const void *data);
-
int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame);
typedef struct VpxInterface {
--- a/video_reader.c
+++ b/video_reader.c
@@ -14,6 +14,8 @@
#include "./ivfdec.h"
#include "./video_reader.h"
+#include "vpx_ports/mem_ops.h"
+
static const char *const kIVFSignature = "DKIF";
struct VpxVideoReaderStruct {
--- a/vpx_ports/mem_ops_aligned.h
+++ b/vpx_ports/mem_ops_aligned.h
@@ -11,6 +11,8 @@
#ifndef VPX_PORTS_MEM_OPS_ALIGNED_H_
#define VPX_PORTS_MEM_OPS_ALIGNED_H_
+#include "vpx/vpx_integer.h"
+
/* \file
* \brief Provides portable memory access primitives for operating on aligned
* data
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -23,6 +23,7 @@
#define VPX_CODEC_DISABLE_COMPAT 1
#include "./vpx_config.h"
#include "vpx/vpx_decoder.h"
+#include "vpx_ports/mem_ops.h"
#include "vpx_ports/vpx_timer.h"
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER