return PIPE_VIDEO_FORMAT_VC1;
case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_CONSTRAINED_BASELINE:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
case PIPE_VIDEO_PROFILE_HEVC_MAIN_444:
return PIPE_VIDEO_FORMAT_HEVC;
+ case PIPE_VIDEO_PROFILE_JPEG_BASELINE:
+ return PIPE_VIDEO_FORMAT_JPEG;
+
+ case PIPE_VIDEO_PROFILE_VP9_PROFILE0:
+ case PIPE_VIDEO_PROFILE_VP9_PROFILE2:
+ return PIPE_VIDEO_FORMAT_VP9;
+
default:
return PIPE_VIDEO_FORMAT_UNKNOWN;
}
}
}
+/**
+ * \brief Copy YV12 chroma data while converting it NV12
+ *
+ * Given a set of YV12 source pointers and -pitches, copy the data to a
+ * layout typical for NV12 video buffers.
+ *
+ * \param source data[in] The plane data pointers. Array of 3.
+ * \param source_pitches[in] The plane pitches. Array of 3.
+ * \param dst_plane[in] The destination plane to copy to. For NV12 always 1.
+ * \param dst_field[in] The destination field if interlaced.
+ * \param dst_stride[in] The destination stride for this plane.
+ * \param num_fields[in] The number of fields in the video buffer.
+ * \param dst[in] The destination plane pointer.
+ * \param width[in] The source plane width.
+ * \param height[in] The source plane height.
+ */
+static inline void
+u_copy_nv12_from_yv12(const void *const *source_data,
+ uint32_t const *source_pitches,
+ int dst_plane, int dst_field,
+ int dst_stride, int num_fields,
+ uint8_t *dst,
+ int width, int height)
+{
+ int x, y;
+ unsigned u_stride = source_pitches[2] * num_fields;
+ unsigned v_stride = source_pitches[1] * num_fields;
+ uint8_t *u_src = (uint8_t *)source_data[2] + source_pitches[2] * dst_field;
+ uint8_t *v_src = (uint8_t *)source_data[1] + source_pitches[1] * dst_field;
+
+ /* TODO: SIMD */
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ dst[2*x] = u_src[x];
+ dst[2*x+1] = v_src[x];
+ }
+ u_src += u_stride;
+ v_src += v_stride;
+ dst += dst_stride;
+ }
+}
+
static inline void
u_copy_yv12_to_nv12(void *const *destination_data,
uint32_t const *destination_pitches,
}
}
-static inline void
-u_copy_yv12_img_to_nv12_surf(ubyte *const *src,
- ubyte *dst,
- unsigned width,
- unsigned height,
- unsigned src_stride,
- unsigned dst_stride,
- int field)
-{
- if (field == 0) {
- ubyte *src_0 = src[field];
- for (int i = 0; i < height ; i++) {
- memcpy(dst, src_0, width);
- dst += dst_stride;
- src_0 += src_stride;
- }
- } else if (field == 1) {
- const ubyte *src_1 = src[field];
- const ubyte *src_2 = src[field+1];
- bool odd = false;
- for (unsigned i = 0; i < height ; i++) {
- for (unsigned j = 0; j < width*2 ; j++) {
- if (odd == false) {
- dst[j] = src_1[j/2];
- odd = true;
- } else {
- dst[j] = src_2[j/2];
- odd = false;
- }
- }
- dst += dst_stride;
- src_1 += src_stride;
- src_2 += src_stride;
- }
- }
-}
-
static inline void
u_copy_swap422_packed(void *const *destination_data,
uint32_t const *destination_pitches,
return 52;
}
+static inline uint32_t
+u_get_h264_profile_idc(enum pipe_video_profile profile)
+{
+ switch (profile) {
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_CONSTRAINED_BASELINE:
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+ return 66;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
+ return 77;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED:
+ return 88;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
+ return 100;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10:
+ return 110;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422:
+ return 122;
+ case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444:
+ return 244;
+ default:
+ return 66; //use baseline profile instead
+ }
+}
+
#ifdef __cplusplus
}
#endif