vl: add H264 encoding interface
Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Leo Liu <leo.liu@amd.com>
This commit is contained in:
parent
eaf3358e0a
commit
ee978aee94
|
@ -39,7 +39,7 @@ vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile
|
|||
assert(screen);
|
||||
switch (u_reduce_video_profile(profile)) {
|
||||
case PIPE_VIDEO_FORMAT_MPEG12:
|
||||
return true;
|
||||
return entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -233,10 +233,11 @@ int rvid_get_video_param(struct pipe_screen *screen,
|
|||
case PIPE_VIDEO_FORMAT_MPEG12:
|
||||
case PIPE_VIDEO_FORMAT_MPEG4:
|
||||
case PIPE_VIDEO_FORMAT_MPEG4_AVC:
|
||||
return true;
|
||||
return entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE;
|
||||
case PIPE_VIDEO_FORMAT_VC1:
|
||||
/* FIXME: VC-1 simple/main profile is broken */
|
||||
return profile == PIPE_VIDEO_PROFILE_VC1_ADVANCED;
|
||||
return profile == PIPE_VIDEO_PROFILE_VC1_ADVANCED &&
|
||||
entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,14 @@ struct pipe_video_codec
|
|||
const void * const *buffers,
|
||||
const unsigned *sizes);
|
||||
|
||||
/**
|
||||
* encode to a bitstream
|
||||
*/
|
||||
void (*encode_bitstream)(struct pipe_video_codec *codec,
|
||||
struct pipe_video_buffer *source,
|
||||
struct pipe_resource *destination,
|
||||
void **feedback);
|
||||
|
||||
/**
|
||||
* end decoding of the current frame
|
||||
*/
|
||||
|
@ -98,6 +106,11 @@ struct pipe_video_codec
|
|||
* should be called before a video_buffer is acessed by the state tracker again
|
||||
*/
|
||||
void (*flush)(struct pipe_video_codec *codec);
|
||||
|
||||
/**
|
||||
* get encoder feedback
|
||||
*/
|
||||
void (*get_feedback)(struct pipe_video_codec *codec, void *feedback, unsigned *size);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,8 +72,8 @@ enum pipe_video_entrypoint
|
|||
PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
|
||||
PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
|
||||
PIPE_VIDEO_ENTRYPOINT_IDCT,
|
||||
PIPE_VIDEO_ENTRYPOINT_MC
|
||||
PIPE_VIDEO_ENTRYPOINT_MC,
|
||||
PIPE_VIDEO_ENTRYPOINT_ENCODE
|
||||
};
|
||||
|
||||
|
||||
#endif /* PIPE_VIDEO_ENUMS_H */
|
||||
|
|
|
@ -110,6 +110,24 @@ enum pipe_h264_slice_type
|
|||
PIPE_H264_SLICE_TYPE_SI = 0x4
|
||||
};
|
||||
|
||||
enum pipe_h264_enc_picture_type
|
||||
{
|
||||
PIPE_H264_ENC_PICTURE_TYPE_P = 0x00,
|
||||
PIPE_H264_ENC_PICTURE_TYPE_B = 0x01,
|
||||
PIPE_H264_ENC_PICTURE_TYPE_I = 0x02,
|
||||
PIPE_H264_ENC_PICTURE_TYPE_IDR = 0x03,
|
||||
PIPE_H264_ENC_PICTURE_TYPE_SKIP = 0x04
|
||||
};
|
||||
|
||||
enum pipe_h264_enc_rate_control_method
|
||||
{
|
||||
PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00,
|
||||
PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01,
|
||||
PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02,
|
||||
PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03,
|
||||
PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04
|
||||
};
|
||||
|
||||
struct pipe_picture_desc
|
||||
{
|
||||
enum pipe_video_profile profile;
|
||||
|
@ -325,6 +343,33 @@ struct pipe_h264_picture_desc
|
|||
struct pipe_video_buffer *ref[16];
|
||||
};
|
||||
|
||||
struct pipe_h264_enc_rate_control
|
||||
{
|
||||
enum pipe_h264_enc_rate_control_method rate_ctrl_method;
|
||||
unsigned target_bitrate;
|
||||
unsigned peak_bitrate;
|
||||
unsigned frame_rate_num;
|
||||
unsigned frame_rate_den;
|
||||
unsigned vbv_buffer_size;
|
||||
unsigned target_bits_picture;
|
||||
unsigned peak_bits_picture_integer;
|
||||
unsigned peak_bits_picture_fraction;
|
||||
};
|
||||
|
||||
struct pipe_h264_enc_picture_desc
|
||||
{
|
||||
struct pipe_picture_desc base;
|
||||
|
||||
struct pipe_h264_enc_rate_control rate_ctrl;
|
||||
|
||||
unsigned quant_i_frames;
|
||||
unsigned quant_p_frames;
|
||||
unsigned quant_b_frames;
|
||||
|
||||
enum pipe_h264_enc_picture_type picture_type;
|
||||
unsigned frame_num;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue