Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: source/libvpx/tools_common.c

Issue 148913004: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/tools_common.h ('k') | source/libvpx/vp8/common/alloccommon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/tools_common.c
===================================================================
--- source/libvpx/tools_common.c (revision 247498)
+++ source/libvpx/tools_common.c (working copy)
@@ -15,6 +15,10 @@
#include <stdlib.h>
#include <string.h>
+#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
+#include "vpx/vp8dx.h"
+#endif
+
#if defined(_WIN32) || defined(__OS2__)
#include <io.h>
#include <fcntl.h>
@@ -60,6 +64,15 @@
LOG_ERROR("Warning");
}
+void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
+ const char *detail = vpx_codec_error_detail(ctx);
+
+ printf("%s: %s\n", s, vpx_codec_error(ctx));
+ if (detail)
+ printf(" %s\n", detail);
+ exit(EXIT_FAILURE);
+}
+
uint16_t mem_get_le16(const void *data) {
uint16_t val;
const uint8_t *mem = (const uint8_t*)data;
@@ -130,3 +143,34 @@
return shortread;
}
+
+vpx_codec_iface_t *get_codec_interface(unsigned int fourcc) {
+ switch (fourcc) {
+#if CONFIG_VP8_DECODER
+ case VP8_FOURCC:
+ return vpx_codec_vp8_dx();
+#endif
+#if CONFIG_VP9_DECODER
+ case VP9_FOURCC:
+ return vpx_codec_vp9_dx();
+#endif
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+void vpx_img_write(const vpx_image_t *img, FILE *file) {
+ int plane, y;
+
+ for (plane = 0; plane < 3; ++plane) {
+ const unsigned char *buf = img->planes[plane];
+ const int stride = img->stride[plane];
+ const int w = plane ? (img->d_w + 1) >> 1 : img->d_w;
+ const int h = plane ? (img->d_h + 1) >> 1 : img->d_h;
+ for (y = 0; y < h; ++y) {
+ fwrite(buf, 1, w, file);
+ buf += stride;
+ }
+ }
+}
« no previous file with comments | « source/libvpx/tools_common.h ('k') | source/libvpx/vp8/common/alloccommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698