question: public byte [ ] convertNv21toJpeg ( byte [ ] data_copy , int w , int h , int [ ] strides ) { Log . e ( TAG , "TIMER_BEGIN NV21 to Jpeg Conversion." ) ; YuvImage yuvImage = new YuvImage ( data_copy , ImageFormat . NV21 , w , h , strides ) ; ByteArrayOutputStream postViewBytes = new ByteArrayOutputStream ( ) ; yuvImage . compressToJpeg ( new Rect ( 0 , 0 , w , h ) , 90 , postViewBytes ) ; try { postViewBytes . flush ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } Log . e ( TAG , "TIMER_END NV21 to Jpeg Conversion." ) ; return postViewBytes . toByteArray ( ) ; }
target:  Wraps the Android built-in YUV to Jpeg conversion routine. Pass in a valid NV21 image and get back a compressed JPEG buffer. A good default JPEG compression implementation that should be supported on all platforms.