Skip to content

Instantly share code, notes, and snippets.

@devarsht
Last active June 18, 2024 18:57
Show Gist options
  • Save devarsht/de6f5142f678bb1a5338abfd9f814abd to your computer and use it in GitHub Desktop.
Save devarsht/de6f5142f678bb1a5338abfd9f814abd to your computer and use it in GitHub Desktop.
V14 JPEG Encoder Crop Validation
full_width_half_height_NV12:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p.yuv -r 13 -w 1280 -h 720 -v 0 -l 0 -t 0 -x 1280 -y 360 -c 100 -o op_nv12_half_height.jpeg
c: m, optarg: 0
c: f, optarg: 720p.yuv
c: r, optarg: 13
c: w, optarg: 1280
[ 1192.843964] ##12
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 0
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv12_half_height.jpeg
mode: 0, input_filename: 720p.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 17895
Generating output file...
Output file: op_nv12_half_height.jpeg, size: 17895
root@am62axx-evm:~# dmesg | grep crop
[ 1192.849287] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000ceb9c598: crop rectangle: w: 1280, h : 360, l : 0, t : 0
[ 1192.850307] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 0, chroma crop offset : 0
root@am62axx-evm:~#
full_width_half_height_NV21:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p_nv21.yuv -r 14 -w 1280 -h 720 -v 0 -l 0 -t 0 -x 1280 -y 360 -c 100 -o op_nv21_half_height.jpeg
c: m, optarg: 0
c: f, optarg: 720p_nv21.yuv
c: r, optarg: 14
c: w, optarg: 1[ 1221.595974] ##12
280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 0
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv21_half_height.jpeg
mode: 0, input_filename: 720p_nv21.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 14, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 17895
Generating output file...
Output file: op_nv21_half_height.jpeg, size: 17895
root@am62axx-evm:~# dmesg | grep crop
[ 1221.601255] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000ceb9c598: crop rectangle: w: 1280, h : 360, l : 0, t : 0
[ 1221.602317] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 0, chroma crop offset : 0
root@am62axx-evm:~#
full_width_half_height_bottom_half_NV16:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p_nv16.yuv -r 11 -w 1280 -h 720 -v 0 -l 0 -t 360 -x 1280 -y 360 -c 100 -o op_nv16_bottom_half.jpeg
c: m, optarg: 0
c: f, optarg: 720p_nv16.yuv
c: r, optarg: 11
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 360
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv16_bottom_half.jpeg
mode: 0, input_filename: 720p_nv16.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 11, compr_quality: 100, subsampling: 0
input_file size: 1843200
setting output format: V4L2_PIX_FMT_JPEG[ 1277.522211] ##12
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 113179
Generating output file...
Output file: op_nv16_bottom_half.jpeg, size: 113179
root@am62axx-evm:~# dmesg | grep crop
[ 1277.527463] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000ceb9c598: crop rectangle: w: 1280, h : 360, l : 0, t : 360
[ 1277.528491] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 70800, chroma crop offset : 70800
full_width_half_height_bottom_half_NV61:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p_nv61.yuv -r 12 -w 1280 -h 720 -v 2 -l 0 -t 360 -x 1280 -y 360 -c 100 -o op_nv61_bottom_half.jpeg
c: m, optarg: 0
c: f, optarg: 720p_nv61.yuv
c: r, optarg: 12
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 360
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv61_bottom_half.jpeg
mode: 0, input_filename: 720p_nv61.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 12, compr_quality: 100, subsampling: 0
input_file size: 1843200
setting output format: V4L2_PIX_FMT_JPEG[ 1295.833638] ##12
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 113179
Generating output file...
Output file: op_nv61_bottom_half.jpeg, size: 113179
root@am62axx-evm:~# dmesg | grep crop
[ 1295.838899] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000ff206264: crop rectangle: w: 1280, h : 360, l : 0, t : 360
[ 1295.839967] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 70800, chroma crop offset : 70800
root@am62axx-evm:~#
half_width_full_height_right_half_NV12:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p.yuv -r 13 -w 1280 -h 720 -v 2 -l 0 -t 0 -x 1280 -y 360 -c 100 -o op_nv12_half_height.jpeg
c: m, optarg: 0
c: f, optarg: 720p.yuv
c: r, optarg: 13
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 0
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv12_half_height.jpeg
mode: 0, input_filename: 720p.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 17895
Generating output file...
Output file: op_nv12_half_height.jpeg, size: 17895
half_width_full_height_right_half_NV21:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p_nv21.yuv -r 13 -w 1280 -h 720 -v 2 -l 0 -t 0 -x 1280 -y 360 -c 100 -o op_nv21_half_height.jpeg
c: m, optarg: 0
c: f, optarg: 720p_nv21.yuv
c: r, optarg: 13
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 0
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv21_half_height.jpeg
mode: 0, input_filename: 720p_nv21.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 17904
Generating output file...
Output file: op_nv21_half_height.jpeg, size: 17904
half_width_full_height_NV16:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p_nv16.yuv -r 11 -w 1280 -h 720 -v 2 -l 0 -t 360 -x 1280 -y 360 -c 100 -o op_nv16_bottom_half.jpeg
c: m, optarg: 0
c: f, optarg: 720p_nv16.yuv
c: r, optarg: 11
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 0
c: t, optarg: 360
c: x, optarg: 1280
c: y, optarg: 360
c: c, optarg: 100
c: o, optarg: op_nv16_bottom_half.jpeg
mode: 0, input_filename: 720p_nv16.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 11, compr_quality: 100, subsampling: 0
input_file size: 1843200
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 1280x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 113179
Generating output file...
Output file: op_nv16_bottom_half.jpeg, size: 113179
root@am62axx-evm:~# ^C
half_width_full_height_NV61:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p_nv61.yuv -r 12 -w 1280 -h 720 -v 2 -l 0 -t 360 -x 1280 -y 360 -c 100 -o op_nv61_bottom_half.jpeg
c: m, optarg: 0
centre_subrectangle_NV12:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p.yuv -r 13 -w 1280 -h 720 -v 2 -l 321 -t 181 -x 642 -y 358 -c 100 -o op_nv12_centre_flag_0.jpeg
c: m, optarg: 0
c: f, optarg: 720p.yuv
c: r, optarg: 13
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 321
c: t, optarg: 181
c: x, optarg: 642
c: y, optarg: 358
c: c, optarg: 100
c: o, optarg: op_nv12_centre_flag_0.jpeg
mode: 0, input_filename: 720p.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 640x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 14130
Generating output file...
Output file: op_nv12_centre_flag_0.jpeg, size: 14130
root@am62axx-evm:~# dmesg | grep crop
[ 789.113203] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x000000004251bc88: crop rectangle: w: 640, h : 360, l : 320, t : 120
[ 789.114298] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 25940, chroma crop offset : 12d40
[ 934.337364] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000b3c4a6bd: crop rectangle: w: 640, h : 360, l : 320, t : 180
[ 934.338456] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 38540, chroma crop offset : 1c340
root@am62axx-evm:~# ^C
root@am62axx-evm:~# ^C
root@am62axx-evm:~# ^C
centre_subrectangle_NV12_gt :
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p.yuv -r 13 -w 1280 -h 720 -v 2 -l 310 -t 170 -x 630 -y 350 -c 100 -o op_nv12_centre_gt.jpeg
c: m, optarg: 0
c: f, optarg: 720p.yuv
c: r, optarg: 13
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 310
c: t, optarg: 170
c: x, optarg: 630
c: y, optarg: 350
c: c, optarg: 100
c: o, optarg: op_nv12_centre_gt.jpeg
mode: 0, input_filename: 720p.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 640x352
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 14049
Generating output file...
Output file: op_nv12_centre_gt.jpeg, size: 14049
centre_subrectangle_NV12_le:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p.yuv -r 13 -w 1280 -h 720 -v 2 -l 322 -t 181 -x 644 -y 361 -c 100 -o op_nv12_centre_lt.jpeg
c: m, optarg: 0
c: f, optarg: 720p.yuv
c: r, optarg: 13
c: w, optarg: 1280
c:[17203.314156] ##12
h, optarg: 720
c: v, optarg: 0
c: l, optarg: 322
c: t, optarg: 181
c: x, optarg: 644
c: y, optarg: 361
c: c, optarg: 100
c: o, optarg: op_nv12_centre_lt.jpeg
mode: 0, input_filename: 720p.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
cropped rectangle: 640x360
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 14130
Generating output file...
Output file: op_nv12_centre_lt.jpeg, size: 14130
root@am62axx-evm:~# dmesg | grep "crop"
[15095.044375] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000c4e8e4d8: crop rectangle: w: 640, h : 360, l : 320, t : 180
[15095.045399] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 38540, chroma crop offset : 1c340
[15543.978805] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x0000000067847911: crop rectangle: w: 640, h : 360, l : 320, t : 180
[15543.979824] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 38540, chroma crop offset : 1c340
[17203.319780] e5010 fd20000.jpeg-encoder: e5010_s_selection: ctx: 0x00000000c4e8e4d8: crop rectangle: w: 640, h : 360, l : 320, t : 180
[17203.320812] e5010 fd20000.jpeg-encoder: e5010_device_run: Luma crop offset : 38540, chroma crop offset : 1c340
centre_subrectangle_NV12_gt_le:
root@am62axx-evm:~# ./test-jpeg-mplane.out -m 0 -f 720p.yuv -r 13 -w 1280 -h 720 -v 2 -l 322 -t 181 -x 644 -y 361 -c 100 -o op_nv12_centre_lt_gt.jpeg
c: m, optarg: 0
c: f, optarg: 720p.yuv
c: r, optarg: 13
c: w, optarg: 1280
c: h, optarg: 720
c: v, optarg: 0
c: l, optarg: 322
c: t, optarg: 181
c: x, optarg: 644
c: y, optarg: 361
c: c, optarg: 100
c: o, optarg: op_nv12_centre_lt_gt.jpeg
mode: 0, input_filename: 720p.yuv, video_node: /dev/video0, width: 1280, height: 720, fourcc: 13, compr_quality: 100, subsampling: 0
input_file size: 1382400
setting output format: V4L2_PIX_FMT_JPEG
output format set: V4L2_PIX_FMT_JPEG
output image dimensions: 1280x720
raw image cropping failed
Dequeued source buffer, index: 0
Dequeued dst buffer, index: 0: buf.bytesused 124784
Generating output file...
Output file: op_nv12_centre_lt_gt.jpeg, size: 124784
root@am62axx-evm:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment