56 if (!sw_frame || !hw_frame || !download) {
76 for (
int y = 0; y <
h; y++)
77 for (
int x = 0; x < linesizes[
i]; x++)
79 (uint8_t)(x + y * 3 +
i * 17);
91 download->format = fmt;
93 download->height = 64;
110 for (
int y = 0; y <
h; y++) {
112 if (memcmp(sw_frame->
data[
i] + off,
113 download->data[
i] + off,
115 printf(
"fail: %-16s plane %d row %d mismatch\n",
156 return ret >= 0 ?
AVERROR(EINVAL) : 0;
172 printf(
"No CUDA device available, skipping.\n");
186 printf(
"fail: %-16s wrongly accepted\n",
193 printf(
"fail: %-16s %s\n",
206 printf(
"%d tests passed.\n", total);
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
__device__ int printf(const char *,...)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
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_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.
static int shift(int a, int b)
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_CUDA
HW acceleration through CUDA.
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
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 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_format(AVBufferRef *device_ref, enum AVPixelFormat fmt)
static int test_rejected(AVBufferRef *device_ref, enum AVPixelFormat fmt)