Remove duplication on vp8/9_write_yuv_frame.
Change-Id: Ib3546032a27c715bf509c0e24d26a189bc829da8
This commit is contained in:
parent
e50ea014c3
commit
ff2d220d21
@ -12,6 +12,7 @@
|
|||||||
#include "vp8/common/alloccommon.h"
|
#include "vp8/common/alloccommon.h"
|
||||||
#include "vpx_dsp/vpx_dsp_common.h"
|
#include "vpx_dsp/vpx_dsp_common.h"
|
||||||
#include "vpx_mem/vpx_mem.h"
|
#include "vpx_mem/vpx_mem.h"
|
||||||
|
#include "vpx_util/vpx_write_yuv_frame.h"
|
||||||
|
|
||||||
int compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
|
int compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
|
||||||
int stride, int strideuv, int consec_zeromv,
|
int stride, int strideuv, int consec_zeromv,
|
||||||
@ -94,7 +95,7 @@ void compute_skin_map(VP8_COMP *const cpi, FILE *yuv_skinmap_file) {
|
|||||||
src_u += (src_uvstride << 3) - (num_bl << 3);
|
src_u += (src_uvstride << 3) - (num_bl << 3);
|
||||||
src_v += (src_uvstride << 3) - (num_bl << 3);
|
src_v += (src_uvstride << 3) - (num_bl << 3);
|
||||||
}
|
}
|
||||||
vp8_write_yuv_frame(yuv_skinmap_file, &skinmap);
|
vpx_write_yuv_frame(yuv_skinmap_file, &skinmap);
|
||||||
vpx_free_frame_buffer(&skinmap);
|
vpx_free_frame_buffer(&skinmap);
|
||||||
}
|
}
|
||||||
#endif // OUTPUT_YUV_SKINMAP
|
#endif // OUTPUT_YUV_SKINMAP
|
||||||
|
@ -29,7 +29,6 @@ int compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
|
|||||||
#ifdef OUTPUT_YUV_SKINMAP
|
#ifdef OUTPUT_YUV_SKINMAP
|
||||||
// For viewing skin map on input source.
|
// For viewing skin map on input source.
|
||||||
void compute_skin_map(struct VP8_COMP *const cpi, FILE *yuv_skinmap_file);
|
void compute_skin_map(struct VP8_COMP *const cpi, FILE *yuv_skinmap_file);
|
||||||
extern void vp8_write_yuv_frame(FILE *f, YV12_BUFFER_CONFIG *s);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -2484,35 +2484,6 @@ int vp8_update_entropy(VP8_COMP *cpi, int update) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OUTPUT_YUV_SRC) || defined(OUTPUT_YUV_DENOISED) || \
|
|
||||||
defined(OUTPUT_YUV_SKINMAP)
|
|
||||||
void vp8_write_yuv_frame(FILE *yuv_file, YV12_BUFFER_CONFIG *s) {
|
|
||||||
unsigned char *src = s->y_buffer;
|
|
||||||
int h = s->y_crop_height;
|
|
||||||
|
|
||||||
do {
|
|
||||||
fwrite(src, s->y_width, 1, yuv_file);
|
|
||||||
src += s->y_stride;
|
|
||||||
} while (--h);
|
|
||||||
|
|
||||||
src = s->u_buffer;
|
|
||||||
h = s->uv_crop_height;
|
|
||||||
|
|
||||||
do {
|
|
||||||
fwrite(src, s->uv_width, 1, yuv_file);
|
|
||||||
src += s->uv_stride;
|
|
||||||
} while (--h);
|
|
||||||
|
|
||||||
src = s->v_buffer;
|
|
||||||
h = s->uv_crop_height;
|
|
||||||
|
|
||||||
do {
|
|
||||||
fwrite(src, s->uv_width, 1, yuv_file);
|
|
||||||
src += s->uv_stride;
|
|
||||||
} while (--h);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) {
|
static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) {
|
||||||
VP8_COMMON *cm = &cpi->common;
|
VP8_COMMON *cm = &cpi->common;
|
||||||
|
|
||||||
|
@ -2581,39 +2581,6 @@ int vp9_update_entropy(VP9_COMP *cpi, int update) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OUTPUT_YUV_DENOISED) || defined(OUTPUT_YUV_SKINMAP)
|
|
||||||
// The denoiser buffer is allocated as a YUV 440 buffer. This function writes it
|
|
||||||
// as YUV 420. We simply use the top-left pixels of the UV buffers, since we do
|
|
||||||
// not denoise the UV channels at this time. If ever we implement UV channel
|
|
||||||
// denoising we will have to modify this.
|
|
||||||
// TODO(jianj): Remove the duplicated one in vp8 and move it to vpx_util.
|
|
||||||
void vp9_write_yuv_frame_420(YV12_BUFFER_CONFIG *s, FILE *f) {
|
|
||||||
uint8_t *src = s->y_buffer;
|
|
||||||
int h = s->y_crop_height;
|
|
||||||
|
|
||||||
do {
|
|
||||||
fwrite(src, s->y_width, 1, f);
|
|
||||||
src += s->y_stride;
|
|
||||||
} while (--h);
|
|
||||||
|
|
||||||
src = s->u_buffer;
|
|
||||||
h = s->uv_crop_height;
|
|
||||||
|
|
||||||
do {
|
|
||||||
fwrite(src, s->uv_width, 1, f);
|
|
||||||
src += s->uv_stride;
|
|
||||||
} while (--h);
|
|
||||||
|
|
||||||
src = s->v_buffer;
|
|
||||||
h = s->uv_crop_height;
|
|
||||||
|
|
||||||
do {
|
|
||||||
fwrite(src, s->uv_width, 1, f);
|
|
||||||
src += s->uv_stride;
|
|
||||||
} while (--h);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OUTPUT_YUV_REC
|
#ifdef OUTPUT_YUV_REC
|
||||||
void vp9_write_yuv_rec_frame(VP9_COMMON *cm) {
|
void vp9_write_yuv_rec_frame(VP9_COMMON *cm) {
|
||||||
YV12_BUFFER_CONFIG *s = cm->frame_to_show;
|
YV12_BUFFER_CONFIG *s = cm->frame_to_show;
|
||||||
|
@ -130,7 +130,7 @@ void vp9_compute_skin_map(VP9_COMP *const cpi, FILE *yuv_skinmap_file) {
|
|||||||
src_u += (src_uvstride << shuv) - (num_bl << shuv);
|
src_u += (src_uvstride << shuv) - (num_bl << shuv);
|
||||||
src_v += (src_uvstride << shuv) - (num_bl << shuv);
|
src_v += (src_uvstride << shuv) - (num_bl << shuv);
|
||||||
}
|
}
|
||||||
vp9_write_yuv_frame_420(&skinmap, yuv_skinmap_file);
|
vpx_write_yuv_frame(yuv_skinmap_file, &skinmap);
|
||||||
vpx_free_frame_buffer(&skinmap);
|
vpx_free_frame_buffer(&skinmap);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "vp9/common/vp9_blockd.h"
|
#include "vp9/common/vp9_blockd.h"
|
||||||
#include "vpx_dsp/skin_detection.h"
|
#include "vpx_dsp/skin_detection.h"
|
||||||
|
#include "vpx_util/vpx_write_yuv_frame.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -27,7 +28,6 @@ int vp9_compute_skin_block(const uint8_t *y, const uint8_t *u, const uint8_t *v,
|
|||||||
#ifdef OUTPUT_YUV_SKINMAP
|
#ifdef OUTPUT_YUV_SKINMAP
|
||||||
// For viewing skin map on input source.
|
// For viewing skin map on input source.
|
||||||
void vp9_compute_skin_map(struct VP9_COMP *const cpi, FILE *yuv_skinmap_file);
|
void vp9_compute_skin_map(struct VP9_COMP *const cpi, FILE *yuv_skinmap_file);
|
||||||
extern void vp9_write_yuv_frame_420(YV12_BUFFER_CONFIG *s, FILE *f);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -12,3 +12,5 @@ UTIL_SRCS-yes += vpx_util.mk
|
|||||||
UTIL_SRCS-yes += vpx_thread.c
|
UTIL_SRCS-yes += vpx_thread.c
|
||||||
UTIL_SRCS-yes += vpx_thread.h
|
UTIL_SRCS-yes += vpx_thread.h
|
||||||
UTIL_SRCS-yes += endian_inl.h
|
UTIL_SRCS-yes += endian_inl.h
|
||||||
|
UTIL_SRCS-yes += vpx_write_yuv_frame.h
|
||||||
|
UTIL_SRCS-yes += vpx_write_yuv_frame.c
|
||||||
|
46
vpx_util/vpx_write_yuv_frame.c
Normal file
46
vpx_util/vpx_write_yuv_frame.c
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 The WebM project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vpx_dsp/skin_detection.h"
|
||||||
|
#include "vpx_util/vpx_write_yuv_frame.h"
|
||||||
|
|
||||||
|
void vpx_write_yuv_frame(FILE *yuv_file, YV12_BUFFER_CONFIG *s) {
|
||||||
|
#if defined(OUTPUT_YUV_SRC) || defined(OUTPUT_YUV_DENOISED) || \
|
||||||
|
defined(OUTPUT_YUV_SKINMAP)
|
||||||
|
|
||||||
|
unsigned char *src = s->y_buffer;
|
||||||
|
int h = s->y_crop_height;
|
||||||
|
|
||||||
|
do {
|
||||||
|
fwrite(src, s->y_width, 1, yuv_file);
|
||||||
|
src += s->y_stride;
|
||||||
|
} while (--h);
|
||||||
|
|
||||||
|
src = s->u_buffer;
|
||||||
|
h = s->uv_crop_height;
|
||||||
|
|
||||||
|
do {
|
||||||
|
fwrite(src, s->uv_width, 1, yuv_file);
|
||||||
|
src += s->uv_stride;
|
||||||
|
} while (--h);
|
||||||
|
|
||||||
|
src = s->v_buffer;
|
||||||
|
h = s->uv_crop_height;
|
||||||
|
|
||||||
|
do {
|
||||||
|
fwrite(src, s->uv_width, 1, yuv_file);
|
||||||
|
src += s->uv_stride;
|
||||||
|
} while (--h);
|
||||||
|
|
||||||
|
#else
|
||||||
|
(void)yuv_file;
|
||||||
|
(void)s;
|
||||||
|
#endif
|
||||||
|
}
|
27
vpx_util/vpx_write_yuv_frame.h
Normal file
27
vpx_util/vpx_write_yuv_frame.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 The WebM project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef VPX_UTIL_VPX_WRITE_YUV_FRAME_H_
|
||||||
|
#define VPX_UTIL_VPX_WRITE_YUV_FRAME_H_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "vpx_scale/yv12config.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void vpx_write_yuv_frame(FILE *yuv_file, YV12_BUFFER_CONFIG *s);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // VPX_UTIL_VPX_WRITE_YUV_FRAME_H_
|
Loading…
x
Reference in New Issue
Block a user