hardware/intel/libva
Revision | d446db390a91ddbc87f9c448611fbc2df76e31ca (tree) |
---|---|
Zeit | 2013-05-28 17:46:47 |
Autor | Zhou Chang <chang.zhou@inte...> |
Commiter | Xiang, Haihao |
test/encode/avcenc: Support continue B frames in test code.
Signed-off-by: Zhou Chang <chang.zhou@intel.com>
@@ -469,9 +469,11 @@ static void end_picture(int slice_type, int next_is_bpic) | ||
469 | 469 | surface_ids[SID_REFERENCE_PICTURE_L0] = tempID; |
470 | 470 | } |
471 | 471 | } else { |
472 | - surface_ids[SID_RECON_PICTURE] = surface_ids[SID_REFERENCE_PICTURE_L0]; | |
473 | - surface_ids[SID_REFERENCE_PICTURE_L0] = surface_ids[SID_REFERENCE_PICTURE_L1]; | |
474 | - surface_ids[SID_REFERENCE_PICTURE_L1] = tempID; | |
472 | + if (!next_is_bpic) { | |
473 | + surface_ids[SID_RECON_PICTURE] = surface_ids[SID_REFERENCE_PICTURE_L0]; | |
474 | + surface_ids[SID_REFERENCE_PICTURE_L0] = surface_ids[SID_REFERENCE_PICTURE_L1]; | |
475 | + surface_ids[SID_REFERENCE_PICTURE_L1] = tempID; | |
476 | + } | |
475 | 477 | } |
476 | 478 | |
477 | 479 | avcenc_destroy_buffers(&avcenc_context.seq_param_buf_id, 1); |
@@ -1013,15 +1015,23 @@ static void encode_p_picture(FILE *yuv_fp, FILE *avc_fp, int f) | ||
1013 | 1015 | SLICE_TYPE_P, 0); |
1014 | 1016 | } |
1015 | 1017 | |
1016 | -static void encode_pb_pictures(FILE *yuv_fp, FILE *avc_fp, int f) | |
1018 | +static void encode_pb_pictures(FILE *yuv_fp, FILE *avc_fp, int f, int nbframes) | |
1017 | 1019 | { |
1020 | + int i; | |
1018 | 1021 | encode_picture(yuv_fp, avc_fp, |
1019 | - enc_frame_number, f + 1, | |
1022 | + enc_frame_number, f + nbframes, | |
1020 | 1023 | 0, |
1021 | 1024 | SLICE_TYPE_P, 1); |
1022 | 1025 | |
1026 | + for( i = 0; i < nbframes - 1; i++) { | |
1027 | + encode_picture(yuv_fp, avc_fp, | |
1028 | + enc_frame_number + 1, f + i, | |
1029 | + 0, | |
1030 | + SLICE_TYPE_B, 1); | |
1031 | + } | |
1032 | + | |
1023 | 1033 | encode_picture(yuv_fp, avc_fp, |
1024 | - enc_frame_number + 1, f, | |
1034 | + enc_frame_number + 1, f + nbframes - 1, | |
1025 | 1035 | 0, |
1026 | 1036 | SLICE_TYPE_B, 0); |
1027 | 1037 | } |
@@ -1223,8 +1233,8 @@ int main(int argc, char *argv[]) | ||
1223 | 1233 | f++; |
1224 | 1234 | enc_frame_number++; |
1225 | 1235 | } else if ( is_bslice) { |
1226 | - encode_pb_pictures(yuv_fp, avc_fp, f); | |
1227 | - f+=2; | |
1236 | + encode_pb_pictures(yuv_fp, avc_fp, f, 2); //last parameter is continue B frames number | |
1237 | + f += (1 + 2); | |
1228 | 1238 | enc_frame_number++; |
1229 | 1239 | } else { |
1230 | 1240 | encode_p_picture(yuv_fp, avc_fp, f); |