37 int shift = (
i == 1 ||
i == 2) ?
desc->log2_chroma_h : 0;
45 int flip_upload,
int flip_download)
72 if (!sw_frame || !hw_frame || !download) {
94 for (
int y = 0; y <
h; y++)
95 for (
int x = 0; x < linesizes[
i]; x++)
97 (uint8_t)(x + y * 3 +
i * 17);
109 download->format = fmt;
110 download->width = 64;
111 download->height = 64;
130 for (
int y = 0; y <
h; y++) {
132 download->data[
i] + y * download->linesize[
i],
134 printf(
"fail: %-16s plane %d row %d mismatch\n",
154static void CUDAAPI
hold_stream(CUstream stream, CUresult status,
void *opaque)
174 if (!frames_ref || !sw_frame || !hw_frame || !download)
189 sw_frame->
width = 64;
193 for (
int y = 0; y < 64; y++)
201 if (cu->cuCtxPushCurrent(hwctx->
cuda_ctx) != CUDA_SUCCESS)
205 cu->cuCtxPopCurrent(&
dummy);
215 for (
int y = 0; y < 64; y++)
218 fprintf(stderr,
"source reuse checksum: %08"PRIx32
"\n", checksum);
268 fprintf(stderr,
"No CUDA device available, skipping.\n");
282 printf(
"fail: %-16s wrongly accepted\n",
291 printf(
"fail: %-16s %s\n",
311 printf(
"%d tests passed.\n", total);
Public header for Adler-32 hash function implementation.
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
__device__ int printf(const char *,...)
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, size_t len)
Calculate the Adler32 checksum of a buffer.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_QUIET
Print no output.
#define AV_LOG_INFO
Standard information.
void av_log_set_level(int level)
Set the log level.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
int av_hwframe_get_transfer_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame)
Allocate the buffers of a software frame that data is transferred to or from frames of the given AVHW...
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags)
Copy data to or from a hw surface.
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
FFmpeg internal API for CUDA.
static int shift(int a, int b)
static void flip(AVCodecContext *avctx, AVFrame *frame)
Memory handling functions.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NB
number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of...
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
#define FF_ARRAY_ELEMS(a)
#define atomic_store(object, desired)
#define atomic_load(object)
A reference to a data buffer.
uint8_t * data
The data buffer.
This struct is allocated as AVHWDeviceContext.hwctx.
AVCUDADeviceContextInternal * internal
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int width
The allocated dimensions of the frames in this pool.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int test_source_reuse(AVBufferRef *device_ref)
static void CUDAAPI hold_stream(CUstream stream, CUresult status, void *opaque)
static void vflip(AVFrame *frame, const AVPixFmtDescriptor *desc)
static int test_format(AVBufferRef *device_ref, enum AVPixelFormat fmt, int flip_upload, int flip_download)
static int test_rejected(AVBufferRef *device_ref, enum AVPixelFormat fmt)
static atomic_int source_overwritten
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.