@@ -140,55 +140,17 @@ static void hevc_d_prepare_dst_format(struct v4l2_pix_format_mplane *pix_fmt)
140140 bytesperline = width * 4 / 3 ;
141141 sizeimage = bytesperline * height ;
142142 break ;
143-
144- case V4L2_PIX_FMT_NV12_COL128 :
145- /* Width rounds up to columns */
146- width = ALIGN (width , 128 );
147- height = ALIGN (height , 8 );
148-
149- /* column height
150- * Accept suggested shape if at least min & < 2 * min
151- */
152- bytesperline = constrain2x (bytesperline , height * 3 / 2 );
153- sizeimage = bytesperline * width ;
154- break ;
155-
156- case V4L2_PIX_FMT_NV12_10_COL128 :
157- /* width in pixels (3 pels = 4 bytes) rounded to 128 byte
158- * columns
159- */
160- width = ALIGN (((width + 2 ) / 3 ), 32 ) * 3 ;
161- height = ALIGN (height , 8 );
162-
163- /* column height
164- * Accept suggested shape if at least min & < 2 * min
165- */
166- bytesperline = constrain2x (bytesperline , height * 3 / 2 );
167- sizeimage = bytesperline * width * 4 / 3 ;
168- break ;
169143 }
170144
171145 pix_fmt -> width = width ;
172146 pix_fmt -> height = height ;
173147
174148 pix_fmt -> field = V4L2_FIELD_NONE ;
175- switch (pix_fmt -> pixelformat ) {
176- default :
177- case V4L2_PIX_FMT_NV12MT_COL128 :
178- case V4L2_PIX_FMT_NV12MT_10_COL128 :
179- pix_fmt -> plane_fmt [0 ].bytesperline = bytesperline ;
180- pix_fmt -> plane_fmt [0 ].sizeimage = sizeimage ;
181- pix_fmt -> plane_fmt [1 ].bytesperline = bytesperline ;
182- pix_fmt -> plane_fmt [1 ].sizeimage = sizeimage / 2 ;
183- pix_fmt -> num_planes = 2 ;
184- break ;
185- case V4L2_PIX_FMT_NV12_COL128 :
186- case V4L2_PIX_FMT_NV12_10_COL128 :
187- pix_fmt -> plane_fmt [0 ].bytesperline = bytesperline ;
188- pix_fmt -> plane_fmt [0 ].sizeimage = sizeimage ;
189- pix_fmt -> num_planes = 1 ;
190- break ;
191- }
149+ pix_fmt -> plane_fmt [0 ].bytesperline = bytesperline ;
150+ pix_fmt -> plane_fmt [0 ].sizeimage = sizeimage ;
151+ pix_fmt -> plane_fmt [1 ].bytesperline = bytesperline ;
152+ pix_fmt -> plane_fmt [1 ].sizeimage = sizeimage / 2 ;
153+ pix_fmt -> num_planes = 2 ;
192154}
193155
194156static int hevc_d_querycap (struct file * file , void * priv ,
@@ -273,31 +235,19 @@ static int hevc_d_hevc_validate_sps(const struct v4l2_ctrl_hevc_sps * const sps)
273235static u32 pixelformat_from_sps (const struct v4l2_ctrl_hevc_sps * const sps ,
274236 const int index )
275237{
276- static const u32 all_formats [] = {
277- V4L2_PIX_FMT_NV12MT_COL128 ,
278- V4L2_PIX_FMT_NV12MT_10_COL128 ,
279- V4L2_PIX_FMT_NV12_COL128 ,
280- V4L2_PIX_FMT_NV12_10_COL128 ,
281- };
282238 u32 pf = 0 ;
283239
284240 if (!is_sps_set (sps ) || !hevc_d_hevc_validate_sps (sps )) {
285241 /* Treat this as an error? For now return both */
286-
287- if (index < ARRAY_SIZE (all_formats ))
288- pf = all_formats [index ];
289- } else {
290- if (index == 0 ) {
291- if (sps -> bit_depth_luma_minus8 == 0 )
292- pf = V4L2_PIX_FMT_NV12MT_COL128 ;
293- else if (sps -> bit_depth_luma_minus8 == 2 )
294- pf = V4L2_PIX_FMT_NV12MT_10_COL128 ;
295- } else if (index == 1 ) {
296- if (sps -> bit_depth_luma_minus8 == 0 )
297- pf = V4L2_PIX_FMT_NV12_COL128 ;
298- else if (sps -> bit_depth_luma_minus8 == 2 )
299- pf = V4L2_PIX_FMT_NV12_10_COL128 ;
300- }
242+ if (index == 0 )
243+ pf = V4L2_PIX_FMT_NV12MT_COL128 ;
244+ else if (index == 1 )
245+ pf = V4L2_PIX_FMT_NV12MT_10_COL128 ;
246+ } else if (index == 0 ) {
247+ if (sps -> bit_depth_luma_minus8 == 0 )
248+ pf = V4L2_PIX_FMT_NV12MT_COL128 ;
249+ else if (sps -> bit_depth_luma_minus8 == 2 )
250+ pf = V4L2_PIX_FMT_NV12MT_10_COL128 ;
301251 }
302252
303253 return pf ;
@@ -509,28 +459,17 @@ static int hevc_d_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
509459 }
510460
511461 if (* nplanes ) {
512- if (pix_fmt -> pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
513- pix_fmt -> pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128 ) {
514- if (* nplanes != expected_nplanes ||
515- sizes [0 ] < pix_fmt -> plane_fmt [0 ].sizeimage ||
516- sizes [1 ] < pix_fmt -> plane_fmt [1 ].sizeimage )
517- return - EINVAL ;
518- } else {
519- if (sizes [0 ] < pix_fmt -> plane_fmt [0 ].sizeimage )
520- return - EINVAL ;
521- }
462+ if (* nplanes != expected_nplanes ||
463+ sizes [0 ] < pix_fmt -> plane_fmt [0 ].sizeimage ||
464+ sizes [1 ] < pix_fmt -> plane_fmt [1 ].sizeimage )
465+ return - EINVAL ;
522466 } else {
523467 sizes [0 ] = pix_fmt -> plane_fmt [0 ].sizeimage ;
524468 if (V4L2_TYPE_IS_OUTPUT (vq -> type )) {
525469 * nplanes = 1 ;
526470 } else {
527- if (pix_fmt -> pixelformat == V4L2_PIX_FMT_NV12MT_COL128 ||
528- pix_fmt -> pixelformat == V4L2_PIX_FMT_NV12MT_10_COL128 ) {
529- sizes [1 ] = pix_fmt -> plane_fmt [1 ].sizeimage ;
530- * nplanes = 2 ;
531- } else {
532- * nplanes = 1 ;
533- }
471+ sizes [1 ] = pix_fmt -> plane_fmt [1 ].sizeimage ;
472+ * nplanes = 2 ;
534473 }
535474 }
536475
0 commit comments