]> granicus.if.org Git - libvpx/blobdiff - ivfdec.c
Merge "vp10: merge keyframe/interframe uvintramode/partition probabilities."
[libvpx] / ivfdec.c
index b9fec26a4b65729b852d0b9e348b6a292cf639c1..6dcd66f734d575ceb48474cf332bc1dde693133c 100644 (file)
--- 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";
@@ -108,68 +110,3 @@ int ivf_read_frame(FILE *infile, uint8_t **buffer,
 
   return 1;
 }
-
-struct vpx_video {
-  FILE *file;
-  unsigned char *buffer;
-  size_t buffer_size;
-  size_t frame_size;
-  unsigned int fourcc;
-  int width;
-  int height;
-};
-
-vpx_video_t *vpx_video_open_file(FILE *file) {
-  char raw_hdr[32];
-  vpx_video_t *video;
-
-  if (fread(raw_hdr, 1, 32, file) != 32)
-    return NULL;  // Can't read file header;
-
-  if (memcmp(IVF_SIGNATURE, raw_hdr, 4) != 0)
-    return NULL;  // Wrong IVF signature
-
-  if (mem_get_le16(raw_hdr + 4) != 0)
-    return NULL;  // Wrong IVF version
-
-  video = (vpx_video_t *)malloc(sizeof(*video));
-  video->file = file;
-  video->buffer = NULL;
-  video->buffer_size = 0;
-  video->frame_size = 0;
-  video->fourcc = mem_get_le32(raw_hdr + 8);
-  video->width = mem_get_le16(raw_hdr + 12);
-  video->height = mem_get_le16(raw_hdr + 14);
-  return video;
-}
-
-void vpx_video_close(vpx_video_t *video) {
-  if (video) {
-    free(video->buffer);
-    free(video);
-  }
-}
-
-int vpx_video_get_width(vpx_video_t *video) {
-  return video->width;
-}
-
-int vpx_video_get_height(vpx_video_t *video) {
-  return video->height;
-}
-
-unsigned int vpx_video_get_fourcc(vpx_video_t *video) {
-  return video->fourcc;
-}
-
-int vpx_video_read_frame(vpx_video_t *video) {
-  return !ivf_read_frame(video->file, &video->buffer, &video->frame_size,
-                         &video->buffer_size);
-}
-
-const unsigned char *vpx_video_get_frame(vpx_video_t *video, size_t *size) {
-  if (size)
-    *size = video->frame_size;
-
-  return video->buffer;
-}